Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions apps/oxlint/fixtures/tsgolint/test.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script>
debugger;

export let title;
export let person;

// this will update `document.title` whenever
// the `title` prop changes
$: document.title = title;

$: {
console.log(`multiple statements can be combined`);
console.log(`the current title is ${title}`);
}

// this will update `name` when 'person' changes
$: ({ name } = person);

// don't do this. it will run before the previous line
let name2 = name;
</script>

<h1>Hello {name}!</h1>
8 changes: 8 additions & 0 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1250,4 +1250,12 @@ mod test {
let args = &["--type-aware", "no-floating-promises", "-c", "config-test.json"];
Tester::new().with_cwd("fixtures/tsgolint".into()).test_and_snapshot(args);
}

#[test]
#[cfg(not(target_endian = "big"))]
fn test_tsgolint_no_typescript_files() {
// tsgolint shouldn't run when no files need type aware linting
let args = &["--type-aware", "test.svelte"];
Tester::new().with_cwd("fixtures/tsgolint".into()).test_and_snapshot(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
source: apps/oxlint/src/tester.rs
---
##########
arguments: --type-aware test.svelte
working directory: fixtures/tsgolint
----------

x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed
,-[test.svelte:2:2]
1 | <script>
2 | debugger;
: ^^^^^^^^^
3 |
`----
help: Remove the debugger statement

Found 0 warnings and 1 error.
Finished in <variable>ms on 1 file using 1 threads.
----------
CLI result: LintFoundErrors
----------
4 changes: 4 additions & 0 deletions crates/oxc_linter/src/tsgolint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ impl TsGoLintState {

let json_input = self.json_input(paths, &mut resolved_configs);

if json_input.files.is_empty() {
return Ok(());
}

let handler = std::thread::spawn(move || {
let mut cmd = std::process::Command::new(&self.executable_path);
cmd.arg("headless")
Expand Down
Loading