Skip to content

Commit 5bd6072

Browse files
committed
feat(linter): pretty print tsgolint internal diagnostics
1 parent 6f9c859 commit 5bd6072

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const one = 1;

apps/oxlint/src/snapshots/[email protected]

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ source: apps/oxlint/src/tester.rs
55
arguments: --type-aware
66
working directory: fixtures/tsgolint_config_error
77
----------
8-
Error running tsgolint: "exit status: exit status: 0, error: Option 'baseUrl' has been removed. Please remove it from your configuration."----------
9-
CLI result: TsGoLintError
8+
9+
x Option 'baseUrl' has been removed. Please remove it from your configuration.
10+
11+
Found 0 warnings and 1 error.
12+
Finished in <variable>ms on 1 file with 103 rules using 1 threads.
13+
----------
14+
CLI result: LintFoundErrors
1015
----------

crates/oxc_linter/src/tsgolint.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::{
99
use rustc_hash::FxHashMap;
1010
use serde::{Deserialize, Serialize};
1111

12-
use oxc_diagnostics::{DiagnosticSender, DiagnosticService, OxcDiagnostic, Severity};
12+
use oxc_diagnostics::{DiagnosticSender, DiagnosticService, Error, OxcDiagnostic, Severity};
1313
use oxc_span::{SourceType, Span};
1414

1515
use super::{AllowWarnDeny, ConfigStore, DisableDirectives, ResolvedLinterState, read_to_string};
@@ -278,7 +278,9 @@ impl TsGoLintState {
278278
}
279279
}
280280
TsGoLintDiagnostic::Internal(e) => {
281-
return Err(e.message.description);
281+
let e: OxcDiagnostic = e.into();
282+
let e: Error = e.into();
283+
error_sender.send(vec![e]).unwrap();
282284
}
283285
}
284286
}

0 commit comments

Comments
 (0)