@@ -11,6 +11,8 @@ use serde::{Deserialize, Serialize};
1111use oxc_diagnostics:: { DiagnosticSender , DiagnosticService , OxcDiagnostic , Severity } ;
1212use oxc_span:: { SourceType , Span } ;
1313
14+ use crate :: fixer:: { CompositeFix , Message , PossibleFixes } ;
15+
1416use super :: { AllowWarnDeny , ConfigStore , ResolvedLinterState , read_to_string} ;
1517
1618/// State required to initialize the `tsgolint` linter.
@@ -294,7 +296,7 @@ struct TsGoLintDiagnosticPayload {
294296 pub file_path : PathBuf ,
295297}
296298
297- /// Represents a message from `tsgolint`, ready to be converted into [`OxcDiagnostic`].
299+ /// Represents a message from `tsgolint`, ready to be converted into [`OxcDiagnostic`] or [`Message`] .
298300#[ derive( Debug , Clone ) ]
299301pub struct TsGoLintDiagnostic {
300302 pub r#type : MessageType ,
@@ -318,6 +320,28 @@ impl From<TsGoLintDiagnostic> for OxcDiagnostic {
318320 }
319321}
320322
323+ impl Message < ' _ > {
324+ /// Converts a `TsGoLintDiagnostic` into a `Message` with possible fixes.
325+ #[ expect( dead_code) ]
326+ fn from_tsgo_lint_diagnostic ( val : TsGoLintDiagnostic , source_text : & str ) -> Self {
327+ let possible_fix = if val. fixes . is_empty ( ) {
328+ PossibleFixes :: None
329+ } else {
330+ let fixes = val
331+ . fixes
332+ . iter ( )
333+ . map ( |fix| crate :: fixer:: Fix {
334+ content : fix. text . clone ( ) . into ( ) ,
335+ span : Span :: new ( fix. range . pos , fix. range . end ) ,
336+ message : None ,
337+ } )
338+ . collect ( ) ;
339+ PossibleFixes :: Single ( CompositeFix :: merge_fixes ( fixes, source_text) )
340+ } ;
341+
342+ Self :: new ( val. into ( ) , possible_fix)
343+ }
344+ }
321345// TODO: Should this be removed and replaced with a `Span`?
322346#[ derive( Clone , Debug , Serialize , Deserialize ) ]
323347pub struct Range {
0 commit comments