Skip to content

Commit

Permalink
fix: Update RuleVisitor type
Browse files Browse the repository at this point in the history
fixes #134
  • Loading branch information
nzakas committed Nov 25, 2024
1 parent 8852527 commit 8df4bf4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,19 @@ export type RuleType = "problem" | "suggestion" | "layout";
*/
export type RuleFixType = "code" | "whitespace";

/* eslint-disable @typescript-eslint/consistent-indexed-object-style -- Needs to be interface so people can extend it. */
/* eslint-disable @typescript-eslint/no-explicit-any -- Necessary to allow subclasses to work correctly */
/**
* An object containing visitor information for a rule. Each method is either the
* name of a node type or a selector, or is a method that will be called at specific
* times during the traversal.
*/
export interface RuleVisitor {
export type RuleVisitor = {

Check failure on line 101 in packages/core/src/types.ts

View workflow job for this annotation

GitHub Actions / Verify Files

A record is preferred over an index signature
/**
* Called for each node in the AST or at specific times during the traversal.
*/
[key: string]: (...args: any[]) => void;
}
/* eslint-enable @typescript-eslint/consistent-indexed-object-style -- Needs to be interface so people can extend it. */
[key in string]?: (...args: any[]) => void;
};

/* eslint-enable @typescript-eslint/no-explicit-any -- Necessary to allow subclasses to work correctly */

/**
Expand Down

0 comments on commit 8df4bf4

Please sign in to comment.