Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0a517f

Browse files
committed
refactor(linter): pass cwd instead of LintServiceOptions into TsGoLintState (#13127)
1 parent b638371 commit f0a517f

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

apps/oxlint/src/lint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ impl LintRunner {
304304
// Run type-aware linting through tsgolint
305305
// TODO: Add a warning message if `tsgolint` cannot be found, but type-aware rules are enabled
306306
if self.options.type_aware {
307-
if let Err(err) =
308-
TsGoLintState::new(config_store.clone(), &paths, &options).lint(tx_error.clone())
307+
if let Err(err) = TsGoLintState::new(options.cwd(), config_store.clone(), &paths)
308+
.lint(tx_error.clone())
309309
{
310310
print_and_flush_stdout(stdout, &err);
311311
return CliRunResult::TsGoLintError;

crates/oxc_linter/src/tsgolint.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
1111
use oxc_diagnostics::{DiagnosticSender, DiagnosticService, OxcDiagnostic, Severity};
1212
use oxc_span::{SourceType, Span};
1313

14-
use super::{AllowWarnDeny, ConfigStore, LintServiceOptions, ResolvedLinterState, read_to_string};
14+
use super::{AllowWarnDeny, ConfigStore, ResolvedLinterState, read_to_string};
1515

1616
/// State required to initialize the `tsgolint` linter.
1717
#[derive(Debug, Clone)]
@@ -27,16 +27,11 @@ pub struct TsGoLintState<'a> {
2727
}
2828

2929
impl<'a> TsGoLintState<'a> {
30-
pub fn new(
31-
config_store: ConfigStore,
32-
paths: &'a Vec<Arc<OsStr>>,
33-
options: &LintServiceOptions,
34-
) -> Self {
30+
pub fn new(cwd: &Path, config_store: ConfigStore, paths: &'a Vec<Arc<OsStr>>) -> Self {
3531
TsGoLintState {
3632
config_store,
37-
executable_path: try_find_tsgolint_executable(options.cwd())
38-
.unwrap_or(PathBuf::from("tsgolint")),
39-
cwd: options.cwd().to_path_buf(),
33+
executable_path: try_find_tsgolint_executable(cwd).unwrap_or(PathBuf::from("tsgolint")),
34+
cwd: cwd.to_path_buf(),
4035
paths,
4136
}
4237
}

0 commit comments

Comments
 (0)