Skip to content
Closed
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
9 changes: 8 additions & 1 deletion apps/oxlint/src/config_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{
};

use ignore::DirEntry;
use tracing::debug;

use oxc_diagnostics::OxcDiagnostic;
use oxc_linter::{
Expand Down Expand Up @@ -496,9 +497,15 @@ impl<'a> ConfigLoader<'a> {

// Fallback: check for vite.config.ts with .lint field (lowest priority)
// If .lint field is missing, `load_root_js_config` returns `Ok(None)` to skip.
// If loading fails (e.g. unresolvable dependencies), skip rather than aborting config discovery.
let vite_config_path = dir.join(VITE_CONFIG_NAME);
if vite_config_path.is_file() {
return self.load_root_js_config(&vite_config_path);
match self.load_root_js_config(&vite_config_path) {
Ok(config) => return Ok(config),
Err(err) => {
debug!("Failed to load {}: {err}, skipping", vite_config_path.display());
}
}
}

Ok(None)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debugger;
3 changes: 3 additions & 0 deletions apps/oxlint/test/fixtures/vite_config_load_error/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleThread": true
}
19 changes: 19 additions & 0 deletions apps/oxlint/test/fixtures/vite_config_load_error/output.snap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Exit code
0

# stdout
```
! eslint(no-debugger): `debugger` statement is not allowed
,-[files/test.js:1:1]
1 | debugger;
: ^^^^^^^^^
`----
help: Remove the debugger statement

Found 1 warning and 0 errors.
Finished in Xms on 1 file with 93 rules using X threads.
```

# stderr
```
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import "non-existent-module";

export default {
lint: {
rules: {
"no-debugger": "error",
},
},
};