@@ -26,7 +26,9 @@ pub mod table;
2626
2727use std:: { path:: Path , rc:: Rc , sync:: Arc } ;
2828
29+ use oxc_diagnostics:: OxcDiagnostic ;
2930use oxc_semantic:: { AstNode , Semantic } ;
31+ use oxc_span:: Span ;
3032
3133pub use crate :: {
3234 config:: {
@@ -35,7 +37,7 @@ pub use crate::{
3537 } ,
3638 context:: LintContext ,
3739 external_linter:: {
38- ExternalLinter , ExternalLinterCb , ExternalLinterLoadPluginCb , PluginLoadResult ,
40+ ExternalLinter , ExternalLinterCb , ExternalLinterLoadPluginCb , LintResult , PluginLoadResult ,
3941 } ,
4042 external_plugin_store:: ExternalPluginStore ,
4143 fixer:: FixKind ,
@@ -52,7 +54,7 @@ pub use crate::{
5254use crate :: {
5355 config:: { LintConfig , OxlintEnv , OxlintGlobals , OxlintSettings , ResolvedLinterState } ,
5456 context:: ContextHost ,
55- fixer:: { Fixer , Message } ,
57+ fixer:: { Fixer , Message , PossibleFixes } ,
5658 rules:: RuleEnum ,
5759 utils:: iter_possible_jest_call_node,
5860} ;
@@ -204,8 +206,31 @@ impl Linter {
204206 external_rules. iter ( ) . map ( |( rule_id, _) | rule_id. as_u32 ( ) ) . collect ( ) ,
205207 ) ;
206208 match result {
207- Ok ( ( ) ) => {
208- // TODO: report diagnostics
209+ Ok ( diagnostics) => {
210+ for diagnostic in diagnostics {
211+ match self . config . resolve_plugin_rule_names ( diagnostic. external_rule_id )
212+ {
213+ Some ( ( plugin_name, rule_name) ) => {
214+ ctx_host. push_diagnostic ( Message :: new (
215+ // TODO: `error` isn't right, we need to get the severity from `external_rules`
216+ OxcDiagnostic :: error ( diagnostic. message )
217+ . with_label ( Span :: new (
218+ diagnostic. loc . start ,
219+ diagnostic. loc . end ,
220+ ) )
221+ . with_error_code (
222+ plugin_name. to_string ( ) ,
223+ rule_name. to_string ( ) ,
224+ ) ,
225+ PossibleFixes :: None ,
226+ ) ) ;
227+ }
228+ None => {
229+ // TODO: report diagnostic, this should be unreachable
230+ debug_assert ! ( false ) ;
231+ }
232+ }
233+ }
209234 }
210235 Err ( _err) => {
211236 // TODO: report diagnostic
0 commit comments