Skip to content

Commit 34ae2f0

Browse files
committed
refactor(linter): move tsgolint.rs to oxc_linter crate (#13126)
The language server wants type aware feature too ❤️
1 parent 51f6c84 commit 34ae2f0

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

apps/oxlint/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ mod lint;
1010
mod output_formatter;
1111
mod result;
1212
mod tester;
13-
mod tsgolint;
1413
mod walk;
1514

1615
pub mod cli {

apps/oxlint/src/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ use oxc_diagnostics::{DiagnosticSender, DiagnosticService, GraphicalReportHandle
1717
use oxc_linter::{
1818
AllowWarnDeny, Config, ConfigStore, ConfigStoreBuilder, ExternalLinter, ExternalPluginStore,
1919
InvalidFilterKind, LintFilter, LintOptions, LintService, LintServiceOptions, Linter, Oxlintrc,
20+
TsGoLintState,
2021
};
2122

2223
use crate::{
2324
cli::{CliRunResult, LintCommand, MiscOptions, ReportUnusedDirectives, WarningOptions},
2425
output_formatter::{LintCommandInfo, OutputFormatter},
25-
tsgolint::TsGoLintState,
2626
walk::Walk,
2727
};
2828

crates/oxc_linter/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ mod module_record;
2626
mod options;
2727
mod rule;
2828
mod service;
29+
mod tsgolint;
2930
mod utils;
3031

3132
pub mod loader;
@@ -57,8 +58,8 @@ pub use crate::{
5758
options::{AllowWarnDeny, InvalidFilterKind, LintFilter, LintFilterKind},
5859
rule::{RuleCategory, RuleFixMeta, RuleMeta},
5960
service::{LintService, LintServiceOptions, RuntimeFileSystem},
60-
utils::read_to_arena_str,
61-
utils::read_to_string,
61+
tsgolint::TsGoLintState,
62+
utils::{read_to_arena_str, read_to_string},
6263
};
6364
use crate::{
6465
config::{LintConfig, OxlintEnv, OxlintGlobals, OxlintSettings},
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ use rustc_hash::FxHashMap;
99
use serde::{Deserialize, Serialize};
1010

1111
use oxc_diagnostics::{DiagnosticSender, DiagnosticService, OxcDiagnostic, Severity};
12-
use oxc_linter::{
13-
AllowWarnDeny, ConfigStore, LintServiceOptions, ResolvedLinterState, read_to_string,
14-
};
1512
use oxc_span::{SourceType, Span};
1613

14+
use super::{AllowWarnDeny, ConfigStore, LintServiceOptions, ResolvedLinterState, read_to_string};
15+
1716
/// State required to initialize the `tsgolint` linter.
1817
#[derive(Debug, Clone)]
1918
pub struct TsGoLintState<'a> {
@@ -42,6 +41,13 @@ impl<'a> TsGoLintState<'a> {
4241
}
4342
}
4443

44+
/// # Panics
45+
/// - when `stdin` of subprocess cannot be opened
46+
/// - when `stdout` of subprocess cannot be opened
47+
/// - when `tsgolint` process cannot be awaited
48+
///
49+
/// # Errors
50+
/// A human-readable error message indicating why the linting failed.
4551
pub fn lint(self, error_sender: DiagnosticSender) -> Result<(), String> {
4652
if self.paths.is_empty() {
4753
return Ok(());

0 commit comments

Comments
 (0)