@@ -187,6 +187,7 @@ export interface RuleContextTypeOptions {
187187 Code : SourceCode ;
188188 RuleOptions : unknown [ ] ;
189189 Node : unknown ;
190+ MessageIds : string ;
190191}
191192
192193/**
@@ -195,12 +196,7 @@ export interface RuleContextTypeOptions {
195196 * view into the outside world.
196197 */
197198export interface RuleContext <
198- Options extends RuleContextTypeOptions = {
199- LangOptions : LanguageOptions ;
200- Code : SourceCode ;
201- RuleOptions : unknown [ ] ;
202- Node : unknown ;
203- } ,
199+ Options extends RuleContextTypeOptions = RuleContextTypeOptions ,
204200> {
205201 /**
206202 * The current working directory for the session.
@@ -282,7 +278,9 @@ export interface RuleContext<
282278 * The report function that the rule should use to report problems.
283279 * @param violation The violation to report.
284280 */
285- report ( violation : ViolationReport < Options [ "Node" ] > ) : void ;
281+ report (
282+ violation : ViolationReport < Options [ "Node" ] , Options [ "MessageIds" ] > ,
283+ ) : void ;
286284}
287285
288286// #region Rule Fixing
@@ -402,11 +400,16 @@ interface ViolationReportBase {
402400 suggest ?: SuggestedEdit [ ] ;
403401}
404402
405- type ViolationMessage = { message : string } | { messageId : string } ;
403+ type ViolationMessage < MessageIds = string > =
404+ | { message : string }
405+ | { messageId : MessageIds } ;
406406type ViolationLocation < Node > = { loc : SourceLocation } | { node : Node } ;
407407
408- export type ViolationReport < Node = unknown > = ViolationReportBase &
409- ViolationMessage &
408+ export type ViolationReport <
409+ Node = unknown ,
410+ MessageIds = string ,
411+ > = ViolationReportBase &
412+ ViolationMessage < MessageIds > &
410413 ViolationLocation < Node > ;
411414
412415// #region Suggestions
@@ -469,6 +472,7 @@ export interface RuleDefinition<
469472 Code : Options [ "Code" ] ;
470473 RuleOptions : Options [ "RuleOptions" ] ;
471474 Node : Options [ "Node" ] ;
475+ MessageIds : Options [ "MessageIds" ] ;
472476 } > ,
473477 ) : Options [ "Visitor" ] ;
474478}
0 commit comments