From d63807e70392e95aff89eddac9415f61ad411a57 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Thu, 28 Mar 2024 15:23:12 +0800 Subject: [PATCH] feat(linter): fallback to the default tsconfig path (#2842) Users usually do not need to manually set the tsconfig path, as it is usually located in cwd/tsconfig.json. --- crates/oxc_linter/src/service.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/oxc_linter/src/service.rs b/crates/oxc_linter/src/service.rs index 1384d8635523..3aef6d03e83e 100644 --- a/crates/oxc_linter/src/service.rs +++ b/crates/oxc_linter/src/service.rs @@ -135,7 +135,9 @@ pub struct Runtime { impl Runtime { fn new(linter: Linter, options: LintServiceOptions) -> Self { - let resolver = linter.options().import_plugin.then(|| Self::get_resolver(options.tsconfig)); + let resolver = linter.options().import_plugin.then(|| { + Self::get_resolver(options.tsconfig.or_else(|| Some(options.cwd.join("tsconfig.json")))) + }); Self { cwd: options.cwd, paths: options.paths.iter().cloned().collect(),