Skip to content

Commit 42d6bd7

Browse files
committed
u
1 parent bdb4af2 commit 42d6bd7

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

apps/oxlint/src/lint.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -491,19 +491,12 @@ impl LintRunner {
491491
// when no file is found, the default configuration is returned
492492
fn find_oxlint_config(cwd: &Path, config: Option<&PathBuf>) -> Result<Oxlintrc, OxcDiagnostic> {
493493
let path: &Path = config.map_or(Self::DEFAULT_OXLINTRC.as_ref(), PathBuf::as_ref);
494-
match (absolute(cwd.join(path)), config) {
495-
// Config file exists, either explicitly provided or the default file name
496-
// Parse the config file and return it, or report an error if parsing fails
497-
(Ok(full_path), _) => Oxlintrc::from_file(&full_path),
498-
// Failed to resolve config, and it was explicitly provided
499-
// Return that the config file could not be found
500-
(Err(e), Some(config_path)) => Err(OxcDiagnostic::error(format!(
501-
"Failed to resolve config path {}: {e}",
502-
config_path.display()
503-
))),
504-
// Failed to resolve implicit path, return default config
505-
_ => Ok(Oxlintrc::default()),
494+
let full_path = cwd.join(path);
495+
496+
if config.is_some() || full_path.exists() {
497+
return Oxlintrc::from_file(&full_path);
506498
}
499+
Ok(Oxlintrc::default())
507500
}
508501

509502
/// Looks in a directory for an oxlint config file, returns the oxlint config if it exists

0 commit comments

Comments
 (0)