@@ -187,6 +187,7 @@ export interface RuleContextTypeOptions {
187
187
Code : SourceCode ;
188
188
RuleOptions : unknown [ ] ;
189
189
Node : unknown ;
190
+ MessageIds : string ;
190
191
}
191
192
192
193
/**
@@ -195,12 +196,7 @@ export interface RuleContextTypeOptions {
195
196
* view into the outside world.
196
197
*/
197
198
export interface RuleContext <
198
- Options extends RuleContextTypeOptions = {
199
- LangOptions : LanguageOptions ;
200
- Code : SourceCode ;
201
- RuleOptions : unknown [ ] ;
202
- Node : unknown ;
203
- } ,
199
+ Options extends RuleContextTypeOptions = RuleContextTypeOptions ,
204
200
> {
205
201
/**
206
202
* The current working directory for the session.
@@ -282,7 +278,9 @@ export interface RuleContext<
282
278
* The report function that the rule should use to report problems.
283
279
* @param violation The violation to report.
284
280
*/
285
- report ( violation : ViolationReport < Options [ "Node" ] > ) : void ;
281
+ report (
282
+ violation : ViolationReport < Options [ "Node" ] , Options [ "MessageIds" ] > ,
283
+ ) : void ;
286
284
}
287
285
288
286
// #region Rule Fixing
@@ -402,11 +400,16 @@ interface ViolationReportBase {
402
400
suggest ?: SuggestedEdit [ ] ;
403
401
}
404
402
405
- type ViolationMessage = { message : string } | { messageId : string } ;
403
+ type ViolationMessage < MessageIds = string > =
404
+ | { message : string }
405
+ | { messageId : MessageIds } ;
406
406
type ViolationLocation < Node > = { loc : SourceLocation } | { node : Node } ;
407
407
408
- export type ViolationReport < Node = unknown > = ViolationReportBase &
409
- ViolationMessage &
408
+ export type ViolationReport <
409
+ Node = unknown ,
410
+ MessageIds = string ,
411
+ > = ViolationReportBase &
412
+ ViolationMessage < MessageIds > &
410
413
ViolationLocation < Node > ;
411
414
412
415
// #region Suggestions
@@ -469,6 +472,7 @@ export interface RuleDefinition<
469
472
Code : Options [ "Code" ] ;
470
473
RuleOptions : Options [ "RuleOptions" ] ;
471
474
Node : Options [ "Node" ] ;
475
+ MessageIds : Options [ "MessageIds" ] ;
472
476
} > ,
473
477
) : Options [ "Visitor" ] ;
474
478
}
0 commit comments