@@ -459,6 +459,15 @@ export interface RuleTextEdit {
459459
460460// #endregion
461461
462+ /**
463+ * Fixes a violation.
464+ * @param fixer The text editor to apply the fix.
465+ * @returns The fix(es) for the violation.
466+ */
467+ type RuleFixer = (
468+ fixer : RuleTextEditor ,
469+ ) => RuleTextEdit | Iterable < RuleTextEdit > | null ;
470+
462471interface ViolationReportBase {
463472 /**
464473 * The type of node that the violation is for.
@@ -473,22 +482,22 @@ interface ViolationReportBase {
473482
474483 /**
475484 * The fix to be applied for the violation.
476- * @param fixer The text editor to apply the fix.
477- * @returns The fix(es) for the violation.
478485 */
479- fix ?( fixer : RuleTextEditor ) : RuleTextEdit | Iterable < RuleTextEdit > | null ;
486+ fix ?: RuleFixer | null | undefined ;
480487
481488 /**
482489 * An array of suggested fixes for the problem. These fixes may change the
483490 * behavior of the code, so they are not applied automatically.
484491 */
485- suggest ?: SuggestedEdit [ ] ;
492+ suggest ?: SuggestedEdit [ ] | null | undefined ;
486493}
487494
488495type ViolationMessage < MessageIds = string > =
489496 | { message : string }
490497 | { messageId : MessageIds } ;
491- type ViolationLocation < Node > = { loc : SourceLocation } | { node : Node } ;
498+ type ViolationLocation < Node > =
499+ | { loc : SourceLocation | Position }
500+ | { node : Node } ;
492501
493502export type ViolationReport <
494503 Node = unknown ,
@@ -507,10 +516,8 @@ interface SuggestedEditBase {
507516
508517 /**
509518 * The fix to be applied for the suggestion.
510- * @param fixer The text editor to apply the fix.
511- * @returns The fix for the suggestion.
512519 */
513- fix ?( fixer : RuleTextEditor ) : RuleTextEdit | Iterable < RuleTextEdit > | null ;
520+ fix ?: RuleFixer | null | undefined ;
514521}
515522
516523type SuggestionMessage = { desc : string } | { messageId : string } ;
0 commit comments