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.
This commit is contained in:
Dunqing 2024-03-28 15:23:12 +08:00 committed by GitHub
parent ab7d7dcbe8
commit d63807e703
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(),