Skip to content

⬅️ Back to Table of Contents

πŸ“„ Rule

πŸ“Š Analysis Summary

Metric Count
πŸ“¦ Imports 8
πŸ“ Interfaces 22
πŸ“‘ Type Aliases 16

πŸ“š Table of Contents

πŸ› οΈ File Location:

πŸ“‚ packages/utils/src/ts-eslint/Rule.ts

πŸ“¦ Imports

Name Source
JSONSchema4 ../json-schema
ParserServices ../ts-estree
TSESTree ../ts-estree
AST ./AST
FlatConfig ./Config
Linter ./Linter
Scope ./Scope
SourceCode ./SourceCode

Interfaces

RuleRecommendationAcrossConfigs<Options extends readonly unknown[]>

Interface Code
export interface RuleRecommendationAcrossConfigs<
  Options extends readonly unknown[],
> {
  recommended?: true;
  strict: Partial<Options>;
}

Properties

Name Type Optional Description
recommended true βœ“ not shown
strict Partial<Options> βœ— not shown

RuleMetaDataDocs

Interface Code
export interface RuleMetaDataDocs {
  /**
   * Concise description of the rule.
   */
  description: string;

  /**
   * The URL of the rule's docs.
   */
  url?: string;

  /**
   * Mark this rule as feature-frozen.
   */
  frozen?: boolean;

  /**
   * The dialects of the languages that the rule is intended to lint.
   * @example
   * ["JavaScript", "TypeScript"]
   *
   * since ESLint 10.2.0
   */
  dialects?: string[] | undefined;
}

Properties

Name Type Optional Description
description string βœ— not shown
url string βœ“ not shown
frozen boolean βœ“ not shown
dialects string[] \| undefined βœ“ not shown

ExternalSpecifier

Interface Code
export interface ExternalSpecifier {
  /**
   * Name of the referenced plugin / rule.
   */
  name?: string;
  /**
   * URL pointing to documentation for the plugin / rule.
   */
  url?: string;
}

Properties

Name Type Optional Description
name string βœ“ not shown
url string βœ“ not shown

ReplacedByInfo

Interface Code
export interface ReplacedByInfo {
  /**
   * General message presented to the user, e.g. how to replace the rule
   */
  message?: string;
  /**
   * URL to more information about this replacement in general
   */
  url?: string;
  /**
   * Name should be "eslint" if the replacement is an ESLint core rule. Omit
   * the property if the replacement is in the same plugin.
   */
  plugin?: ExternalSpecifier;
  /**
   * Name and documentation of the replacement rule
   */
  rule?: ExternalSpecifier;
}

Properties

Name Type Optional Description
message string βœ“ not shown
url string βœ“ not shown
plugin ExternalSpecifier βœ“ not shown
rule ExternalSpecifier βœ“ not shown

DeprecatedInfo

Interface Code
export interface DeprecatedInfo {
  /**
   * General message presented to the user, e.g. for the key rule why the rule
   * is deprecated or for info how to replace the rule.
   */
  message?: string;
  /**
   * URL to more information about this deprecation in general.
   */
  url?: string;
  /**
   * An empty array explicitly states that there is no replacement.
   */
  replacedBy?: ReplacedByInfo[];
  /**
   * The package version since when the rule is deprecated (should use full
   * semver without a leading "v").
   */
  deprecatedSince?: string;
  /**
   * The estimated version when the rule is removed (probably the next major
   * version). null means the rule is "frozen" (will be available but will not
   * be changed).
   */
  availableUntil?: string | null;
}

Properties

Name Type Optional Description
message string βœ“ not shown
url string βœ“ not shown
replacedBy ReplacedByInfo[] βœ“ not shown
deprecatedSince string βœ“ not shown
availableUntil string \| null βœ“ not shown

RuleMetaData<MessageIds extends string, PluginDocs = unknown, Options extends readonly unknown[] = []>

Interface Code
export interface RuleMetaData<
  MessageIds extends string,
  PluginDocs = unknown,
  Options extends readonly unknown[] = [],
> {
  /**
   * True if the rule is deprecated, false otherwise
   */
  deprecated?: boolean | DeprecatedInfo;
  /**
   * Documentation for the rule
   */
  docs?: PluginDocs & RuleMetaDataDocs;
  /**
   * The fixer category. Omit if there is no fixer
   */
  fixable?: 'code' | 'whitespace';
  /**
   * Specifies whether rules can return suggestions. Omit if there is no suggestions
   */
  hasSuggestions?: boolean;
  /**
   * Languages supported by this rule in the format `"plugin/language"`.
   * Use `"*"` for any language or `"plugin/*"` for any language from a specific plugin.
   * @example
   * ["js/js", "markdown/gfm", "json/jsonc", "css/css"]
   *
   * since ESLint 10.2.0
   */
  languages?: string[] | undefined;
  /**
   * A map of messages which the rule can report.
   * The key is the messageId, and the string is the parameterized error string.
   * See: https://eslint.org/docs/developer-guide/working-with-rules#messageids
   */
  messages: Record<MessageIds, string>;
  /**
   * The name of the rule this rule was replaced by, if it was deprecated.
   *
   * @deprecated since eslint 9.21.0, in favor of `RuleMetaData#deprecated.replacedBy`
   */
  replacedBy?: readonly string[];
  /**
   * The options schema. Supply an empty array if there are no options.
   */
  schema: JSONSchema4 | readonly JSONSchema4[];
  /**
   * The type of rule.
   * - `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve.
   * - `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn’t changed.
   * - `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts of the program that determine how the code looks rather than how it executes. These rules work on parts of the code that aren’t specified in the AST.
   */
  type: 'layout' | 'problem' | 'suggestion';

  /**
   * Specifies default options for the rule. If present, any user-provided options in their config will be merged on top of them recursively.
   * This merging will be applied directly to `context.options`.
   * If you want backwards-compatible support for earlier ESLint version, consider using the top-level `defaultOptions` instead.
   *
   * since ESLint 9.15.0
   */
  defaultOptions?: Options;
}

Properties

Name Type Optional Description
deprecated boolean \| DeprecatedInfo βœ“ not shown
docs PluginDocs & RuleMetaDataDocs βœ“ not shown
fixable 'code' \| 'whitespace' βœ“ not shown
hasSuggestions boolean βœ“ not shown
languages string[] \| undefined βœ“ not shown
messages Record<MessageIds, string> βœ— not shown
replacedBy readonly string[] βœ“ not shown
schema JSONSchema4 \| readonly JSONSchema4[] βœ— not shown
type 'layout' \| 'problem' \| 'suggestion' βœ— not shown
defaultOptions Options βœ“ not shown

RuleMetaDataWithDocs<MessageIds extends string, PluginDocs = unknown, Options extends readonly unknown[] = []>

Interface Code
export interface RuleMetaDataWithDocs<
  MessageIds extends string,
  PluginDocs = unknown,
  Options extends readonly unknown[] = [],
> extends RuleMetaData<MessageIds, PluginDocs, Options> {
  /**
   * Documentation for the rule
   */
  docs: PluginDocs & RuleMetaDataDocs;
}

Properties

Name Type Optional Description
docs PluginDocs & RuleMetaDataDocs βœ— not shown

RuleFix

Interface Code
export interface RuleFix {
  range: Readonly<AST.Range>;
  text: string;
}

Properties

Name Type Optional Description
range Readonly<AST.Range> βœ— not shown
text string βœ— not shown

RuleFixer

Interface Code
export interface RuleFixer {
  insertTextAfter(
    nodeOrToken: TSESTree.Node | TSESTree.Token,
    text: string,
  ): RuleFix;

  insertTextAfterRange(range: Readonly<AST.Range>, text: string): RuleFix;

  insertTextBefore(
    nodeOrToken: TSESTree.Node | TSESTree.Token,
    text: string,
  ): RuleFix;

  insertTextBeforeRange(range: Readonly<AST.Range>, text: string): RuleFix;

  remove(nodeOrToken: TSESTree.Node | TSESTree.Token): RuleFix;

  removeRange(range: Readonly<AST.Range>): RuleFix;

  replaceText(
    nodeOrToken: TSESTree.Node | TSESTree.Token,
    text: string,
  ): RuleFix;

  replaceTextRange(range: Readonly<AST.Range>, text: string): RuleFix;
}

SuggestionReportDescriptor<MessageIds extends string>

Interface Code
export interface SuggestionReportDescriptor<
  MessageIds extends string,
> extends Omit<ReportDescriptorBase<MessageIds>, 'fix'> {
  readonly fix: ReportFixFunction;
}

Properties

Name Type Optional Description
fix ReportFixFunction βœ— not shown

ReportDescriptorBase<MessageIds extends string>

Interface Code
interface ReportDescriptorBase<MessageIds extends string> {
  /**
   * The parameters for the message string associated with `messageId`.
   */
  readonly data?: ReportDescriptorMessageData;
  /**
   * The fixer function.
   */
  readonly fix?: ReportFixFunction | null;
  /**
   * The messageId which is being reported.
   */
  readonly messageId: MessageIds;

  // we disallow this because it's much better to use messageIds for reusable errors that are easily testable
  // readonly desc?: string;
}

Properties

Name Type Optional Description
data ReportDescriptorMessageData βœ“ not shown
fix ReportFixFunction \| null βœ“ not shown
messageId MessageIds βœ— not shown

ReportDescriptorWithSuggestion<MessageIds extends string>

Interface Code
interface ReportDescriptorWithSuggestion<
  MessageIds extends string,
> extends ReportDescriptorBase<MessageIds> {
  /**
   * 6.7's Suggestions API
   */
  readonly suggest?: Readonly<ReportSuggestionArray<MessageIds>> | null;
}

Properties

Name Type Optional Description
suggest Readonly<ReportSuggestionArray<MessageIds>> \| null βœ“ not shown

ReportDescriptorNodeOptionalLoc

Interface Code
interface ReportDescriptorNodeOptionalLoc {
  /**
   * An override of the location of the report
   */
  readonly loc?:
    Readonly<TSESTree.Position> | Readonly<TSESTree.SourceLocation>;
  /**
   * The Node or AST Token which the report is being attached to
   */
  readonly node: TSESTree.Node | TSESTree.Token;
}

Properties

Name Type Optional Description
loc Readonly<TSESTree.Position> \| Readonly<TSESTree.SourceLocation> βœ“ not shown
node TSESTree.Node \| TSESTree.Token βœ— not shown

ReportDescriptorLocOnly

Interface Code
interface ReportDescriptorLocOnly {
  /**
   * An override of the location of the report
   */
  loc: Readonly<TSESTree.Position> | Readonly<TSESTree.SourceLocation>;
}

Properties

Name Type Optional Description
loc Readonly<TSESTree.Position> \| Readonly<TSESTree.SourceLocation> βœ— not shown

SharedConfigurationSettings

Interface Code
export interface SharedConfigurationSettings {
  [name: string]: unknown;
}

RuleContext<MessageIds extends string, Options extends readonly unknown[]>

Interface Code
export interface RuleContext<
  MessageIds extends string,
  Options extends readonly unknown[],
> {
  /**
   * The rule ID.
   */
  id: string;
  /**
   * The language options configured for this run
   */
  languageOptions: FlatConfig.LanguageOptions & {
    parserOptions: FlatConfig.ParserOptions;
  };
  /**
   * An array of the configured options for this rule.
   * This array does not include the rule severity.
   */
  options: Options;
  /**
   * The parser options configured for this run
   * @deprecated This was deprecated in ESLint 9 and removed in ESLint 10.
   */
  parserOptions: Linter.ParserOptions;
  /**
   * The name of the parser from configuration, if in eslintrc (legacy) config.
   * @deprecated This was deprecated in ESLint 9 and removed in ESLint 10.
   */
  parserPath: string | undefined;
  /**
   * An object containing parser-provided services for rules
   *
   * @deprecated in favor of `SourceCode#parserServices`
   */
  parserServices?: ParserServices;
  /**
   * The shared settings from configuration.
   * We do not have any shared settings in this plugin.
   */
  settings: SharedConfigurationSettings;

  // Deprecated members

  /**
   * Returns an array of the ancestors of the currently-traversed node, starting at
   * the root of the AST and continuing through the direct parent of the current node.
   * This array does not include the currently-traversed node itself.
   *
   * @deprecated in favor of `SourceCode#getAncestors`
   */
  getAncestors(): TSESTree.Node[];

  /**
   * Returns a list of variables declared by the given node.
   * This information can be used to track references to variables.
   *
   * @deprecated in favor of `SourceCode#getDeclaredVariables`
   */
  getDeclaredVariables(node: TSESTree.Node): readonly Scope.Variable[];

  /**
   * Returns the current working directory passed to Linter.
   * It is a path to a directory that should be considered as the current working directory.
   * @deprecated in favor of `RuleContext#cwd`
   */
  getCwd(): string;

  /**
   * The current working directory passed to Linter.
   * It is a path to a directory that should be considered as the current working directory.
   */
  cwd: string;

  /**
   * Returns the filename associated with the source.
   *
   * @deprecated in favor of `RuleContext#filename`
   */
  getFilename(): string;

  /**
   * The filename associated with the source.
   */
  filename: string;

  /**
   * Returns the full path of the file on disk without any code block information (unlike `getFilename()`).
   * @deprecated in favor of `RuleContext#physicalFilename`
   */
  getPhysicalFilename(): string;

  /**
   * The full path of the file on disk without any code block information (unlike `filename`).
   */
  physicalFilename: string;

  /**
   * Returns the scope of the currently-traversed node.
   * This information can be used track references to variables.
   *
   * @deprecated in favor of `SourceCode#getScope`
   */
  getScope(): Scope.Scope;

  /**
   * Returns a SourceCode object that you can use to work with the source that
   * was passed to ESLint.
   *
   * @deprecated in favor of `RuleContext#sourceCode`
   */
  getSourceCode(): Readonly<SourceCode>;

  /**
   * A SourceCode object that you can use to work with the source that
   * was passed to ESLint.
   */
  sourceCode: Readonly<SourceCode>;

  /**
   * Marks a variable with the given name in the current scope as used.
   * This affects the no-unused-vars rule.
   *
   * @deprecated in favor of `SourceCode#markVariableAsUsed`
   */
  markVariableAsUsed(name: string): boolean;

  /**
   * Reports a problem in the code.
   */
  report(descriptor: ReportDescriptor<MessageIds>): void;
}

Properties

Name Type Optional Description
id string βœ— not shown
languageOptions FlatConfig.LanguageOptions & { parserOptions: FlatConfig.ParserOptions; } βœ— not shown
options Options βœ— not shown
parserOptions Linter.ParserOptions βœ— not shown
parserPath string \| undefined βœ— not shown
parserServices ParserServices βœ“ not shown
settings SharedConfigurationSettings βœ— not shown
cwd string βœ— not shown
filename string βœ— not shown
physicalFilename string βœ— not shown
sourceCode Readonly<SourceCode> βœ— not shown

CodePath

Interface Code
export interface CodePath {
  /** Code paths of functions this code path contains. */
  childCodePaths: CodePath[];

  /**
   * Segments of the current traversal position.
   *
   * @deprecated
   */
  currentSegments: CodePathSegment[];

  /** The final segments which includes both returned and thrown. */
  finalSegments: CodePathSegment[];

  /**
   * A unique string. Respective rules can use `id` to save additional
   * information for each code path.
   */
  id: string;

  initialSegment: CodePathSegment;

  /** The final segments which includes only returned. */
  returnedSegments: CodePathSegment[];

  /** The final segments which includes only thrown. */
  thrownSegments: CodePathSegment[];

  /** The code path of the upper function/global scope. */
  upper: CodePath | null;
}

Properties

Name Type Optional Description
childCodePaths CodePath[] βœ— not shown
currentSegments CodePathSegment[] βœ— not shown
finalSegments CodePathSegment[] βœ— not shown
id string βœ— not shown
initialSegment CodePathSegment βœ— not shown
returnedSegments CodePathSegment[] βœ— not shown
thrownSegments CodePathSegment[] βœ— not shown
upper CodePath \| null βœ— not shown

CodePathSegment

Interface Code
export interface CodePathSegment {
  /**
   * A unique string. Respective rules can use `id` to save additional
   * information for each segment.
   */
  id: string;

  /**
   * The next segments. If forking, there are two or more. If final, there is
   * nothing.
   */
  nextSegments: CodePathSegment[];

  /**
   * The previous segments. If merging, there are two or more. If initial, there
   * is nothing.
   */
  prevSegments: CodePathSegment[];

  /**
   * A flag which shows whether it is reachable. This becomes `false` when
   * preceded by `return`, `throw`, `break`, or `continue`.
   */
  reachable: boolean;
}

Properties

Name Type Optional Description
id string βœ— not shown
nextSegments CodePathSegment[] βœ— not shown
prevSegments CodePathSegment[] βœ— not shown
reachable boolean βœ— not shown

RuleListenerBaseSelectors

Interface Code
interface RuleListenerBaseSelectors {
  AccessorProperty?: RuleFunction<TSESTree.AccessorProperty>;
  ArrayExpression?: RuleFunction<TSESTree.ArrayExpression>;
  ArrayPattern?: RuleFunction<TSESTree.ArrayPattern>;
  ArrowFunctionExpression?: RuleFunction<TSESTree.ArrowFunctionExpression>;
  AssignmentExpression?: RuleFunction<TSESTree.AssignmentExpression>;
  AssignmentPattern?: RuleFunction<TSESTree.AssignmentPattern>;
  AwaitExpression?: RuleFunction<TSESTree.AwaitExpression>;
  BinaryExpression?: RuleFunction<TSESTree.BinaryExpression>;
  BlockStatement?: RuleFunction<TSESTree.BlockStatement>;
  BreakStatement?: RuleFunction<TSESTree.BreakStatement>;
  CallExpression?: RuleFunction<TSESTree.CallExpression>;
  CatchClause?: RuleFunction<TSESTree.CatchClause>;
  ChainExpression?: RuleFunction<TSESTree.ChainExpression>;
  ClassBody?: RuleFunction<TSESTree.ClassBody>;
  ClassDeclaration?: RuleFunction<TSESTree.ClassDeclaration>;
  ClassExpression?: RuleFunction<TSESTree.ClassExpression>;
  ConditionalExpression?: RuleFunction<TSESTree.ConditionalExpression>;
  ContinueStatement?: RuleFunction<TSESTree.ContinueStatement>;
  DebuggerStatement?: RuleFunction<TSESTree.DebuggerStatement>;
  Decorator?: RuleFunction<TSESTree.Decorator>;
  DoWhileStatement?: RuleFunction<TSESTree.DoWhileStatement>;
  EmptyStatement?: RuleFunction<TSESTree.EmptyStatement>;
  ExportAllDeclaration?: RuleFunction<TSESTree.ExportAllDeclaration>;
  ExportDefaultDeclaration?: RuleFunction<TSESTree.ExportDefaultDeclaration>;
  ExportNamedDeclaration?: RuleFunction<TSESTree.ExportNamedDeclaration>;
  ExportSpecifier?: RuleFunction<TSESTree.ExportSpecifier>;
  ExpressionStatement?: RuleFunction<TSESTree.ExpressionStatement>;
  ForInStatement?: RuleFunction<TSESTree.ForInStatement>;
  ForOfStatement?: RuleFunction<TSESTree.ForOfStatement>;
  ForStatement?: RuleFunction<TSESTree.ForStatement>;
  FunctionDeclaration?: RuleFunction<TSESTree.FunctionDeclaration>;
  FunctionExpression?: RuleFunction<TSESTree.FunctionExpression>;
  Identifier?: RuleFunction<TSESTree.Identifier>;
  IfStatement?: RuleFunction<TSESTree.IfStatement>;
  ImportAttribute?: RuleFunction<TSESTree.ImportAttribute>;
  ImportDeclaration?: RuleFunction<TSESTree.ImportDeclaration>;
  ImportDefaultSpecifier?: RuleFunction<TSESTree.ImportDefaultSpecifier>;
  ImportExpression?: RuleFunction<TSESTree.ImportExpression>;
  ImportNamespaceSpecifier?: RuleFunction<TSESTree.ImportNamespaceSpecifier>;
  ImportSpecifier?: RuleFunction<TSESTree.ImportSpecifier>;
  JSXAttribute?: RuleFunction<TSESTree.JSXAttribute>;
  JSXClosingElement?: RuleFunction<TSESTree.JSXClosingElement>;
  JSXClosingFragment?: RuleFunction<TSESTree.JSXClosingFragment>;
  JSXElement?: RuleFunction<TSESTree.JSXElement>;
  JSXEmptyExpression?: RuleFunction<TSESTree.JSXEmptyExpression>;
  JSXExpressionContainer?: RuleFunction<TSESTree.JSXExpressionContainer>;
  JSXFragment?: RuleFunction<TSESTree.JSXFragment>;
  JSXIdentifier?: RuleFunction<TSESTree.JSXIdentifier>;
  JSXMemberExpression?: RuleFunction<TSESTree.JSXMemberExpression>;
  JSXNamespacedName?: RuleFunction<TSESTree.JSXNamespacedName>;
  JSXOpeningElement?: RuleFunction<TSESTree.JSXOpeningElement>;
  JSXOpeningFragment?: RuleFunction<TSESTree.JSXOpeningFragment>;
  JSXSpreadAttribute?: RuleFunction<TSESTree.JSXSpreadAttribute>;
  JSXSpreadChild?: RuleFunction<TSESTree.JSXSpreadChild>;
  JSXText?: RuleFunction<TSESTree.JSXText>;
  LabeledStatement?: RuleFunction<TSESTree.LabeledStatement>;
  Literal?: RuleFunction<TSESTree.Literal>;
  LogicalExpression?: RuleFunction<TSESTree.LogicalExpression>;
  MemberExpression?: RuleFunction<TSESTree.MemberExpression>;
  MetaProperty?: RuleFunction<TSESTree.MetaProperty>;
  MethodDefinition?: RuleFunction<TSESTree.MethodDefinition>;
  NewExpression?: RuleFunction<TSESTree.NewExpression>;
  ObjectExpression?: RuleFunction<TSESTree.ObjectExpression>;
  ObjectPattern?: RuleFunction<TSESTree.ObjectPattern>;
  PrivateIdentifier?: RuleFunction<TSESTree.PrivateIdentifier>;
  Program?: RuleFunction<TSESTree.Program>;
  Property?: RuleFunction<TSESTree.Property>;
  PropertyDefinition?: RuleFunction<TSESTree.PropertyDefinition>;
  RestElement?: RuleFunction<TSESTree.RestElement>;
  ReturnStatement?: RuleFunction<TSESTree.ReturnStatement>;
  SequenceExpression?: RuleFunction<TSESTree.SequenceExpression>;
  SpreadElement?: RuleFunction<TSESTree.SpreadElement>;
  StaticBlock?: RuleFunction<TSESTree.StaticBlock>;
  Super?: RuleFunction<TSESTree.Super>;
  SwitchCase?: RuleFunction<TSESTree.SwitchCase>;
  SwitchStatement?: RuleFunction<TSESTree.SwitchStatement>;
  TaggedTemplateExpression?: RuleFunction<TSESTree.TaggedTemplateExpression>;
  TemplateElement?: RuleFunction<TSESTree.TemplateElement>;
  TemplateLiteral?: RuleFunction<TSESTree.TemplateLiteral>;
  ThisExpression?: RuleFunction<TSESTree.ThisExpression>;
  ThrowStatement?: RuleFunction<TSESTree.ThrowStatement>;
  TryStatement?: RuleFunction<TSESTree.TryStatement>;
  TSAbstractAccessorProperty?: RuleFunction<TSESTree.TSAbstractAccessorProperty>;
  TSAbstractKeyword?: RuleFunction<TSESTree.TSAbstractKeyword>;
  TSAbstractMethodDefinition?: RuleFunction<TSESTree.TSAbstractMethodDefinition>;
  TSAbstractPropertyDefinition?: RuleFunction<TSESTree.TSAbstractPropertyDefinition>;
  TSAnyKeyword?: RuleFunction<TSESTree.TSAnyKeyword>;
  TSArrayType?: RuleFunction<TSESTree.TSArrayType>;
  TSAsExpression?: RuleFunction<TSESTree.TSAsExpression>;
  TSAsyncKeyword?: RuleFunction<TSESTree.TSAsyncKeyword>;
  TSBigIntKeyword?: RuleFunction<TSESTree.TSBigIntKeyword>;
  TSBooleanKeyword?: RuleFunction<TSESTree.TSBooleanKeyword>;
  TSCallSignatureDeclaration?: RuleFunction<TSESTree.TSCallSignatureDeclaration>;
  TSClassImplements?: RuleFunction<TSESTree.TSClassImplements>;
  TSConditionalType?: RuleFunction<TSESTree.TSConditionalType>;
  TSConstructorType?: RuleFunction<TSESTree.TSConstructorType>;
  TSConstructSignatureDeclaration?: RuleFunction<TSESTree.TSConstructSignatureDeclaration>;
  TSDeclareFunction?: RuleFunction<TSESTree.TSDeclareFunction>;
  TSDeclareKeyword?: RuleFunction<TSESTree.TSDeclareKeyword>;
  TSEmptyBodyFunctionExpression?: RuleFunction<TSESTree.TSEmptyBodyFunctionExpression>;
  TSEnumBody?: RuleFunction<TSESTree.TSEnumBody>;
  TSEnumDeclaration?: RuleFunction<TSESTree.TSEnumDeclaration>;
  TSEnumMember?: RuleFunction<TSESTree.TSEnumMember>;
  TSExportAssignment?: RuleFunction<TSESTree.TSExportAssignment>;
  TSExportKeyword?: RuleFunction<TSESTree.TSExportKeyword>;
  TSExternalModuleReference?: RuleFunction<TSESTree.TSExternalModuleReference>;
  TSFunctionType?: RuleFunction<TSESTree.TSFunctionType>;
  TSImportEqualsDeclaration?: RuleFunction<TSESTree.TSImportEqualsDeclaration>;
  TSImportType?: RuleFunction<TSESTree.TSImportType>;
  TSIndexedAccessType?: RuleFunction<TSESTree.TSIndexedAccessType>;
  TSIndexSignature?: RuleFunction<TSESTree.TSIndexSignature>;
  TSInferType?: RuleFunction<TSESTree.TSInferType>;
  TSInstantiationExpression?: RuleFunction<TSESTree.TSInstantiationExpression>;
  TSInterfaceBody?: RuleFunction<TSESTree.TSInterfaceBody>;
  TSInterfaceDeclaration?: RuleFunction<TSESTree.TSInterfaceDeclaration>;
  TSInterfaceHeritage?: RuleFunction<TSESTree.TSInterfaceHeritage>;
  TSIntersectionType?: RuleFunction<TSESTree.TSIntersectionType>;
  TSIntrinsicKeyword?: RuleFunction<TSESTree.TSIntrinsicKeyword>;
  TSLiteralType?: RuleFunction<TSESTree.TSLiteralType>;
  TSMappedType?: RuleFunction<TSESTree.TSMappedType>;
  TSMethodSignature?: RuleFunction<TSESTree.TSMethodSignature>;
  TSModuleBlock?: RuleFunction<TSESTree.TSModuleBlock>;
  TSModuleDeclaration?: RuleFunction<TSESTree.TSModuleDeclaration>;
  TSNamedTupleMember?: RuleFunction<TSESTree.TSNamedTupleMember>;
  TSNamespaceExportDeclaration?: RuleFunction<TSESTree.TSNamespaceExportDeclaration>;
  TSNeverKeyword?: RuleFunction<TSESTree.TSNeverKeyword>;
  TSNonNullExpression?: RuleFunction<TSESTree.TSNonNullExpression>;
  TSNullKeyword?: RuleFunction<TSESTree.TSNullKeyword>;
  TSNumberKeyword?: RuleFunction<TSESTree.TSNumberKeyword>;
  TSObjectKeyword?: RuleFunction<TSESTree.TSObjectKeyword>;
  TSOptionalType?: RuleFunction<TSESTree.TSOptionalType>;
  TSParameterProperty?: RuleFunction<TSESTree.TSParameterProperty>;
  TSPrivateKeyword?: RuleFunction<TSESTree.TSPrivateKeyword>;
  TSPropertySignature?: RuleFunction<TSESTree.TSPropertySignature>;
  TSProtectedKeyword?: RuleFunction<TSESTree.TSProtectedKeyword>;
  TSPublicKeyword?: RuleFunction<TSESTree.TSPublicKeyword>;
  TSQualifiedName?: RuleFunction<TSESTree.TSQualifiedName>;
  TSReadonlyKeyword?: RuleFunction<TSESTree.TSReadonlyKeyword>;
  TSRestType?: RuleFunction<TSESTree.TSRestType>;
  TSSatisfiesExpression?: RuleFunction<TSESTree.TSSatisfiesExpression>;
  TSStaticKeyword?: RuleFunction<TSESTree.TSStaticKeyword>;
  TSStringKeyword?: RuleFunction<TSESTree.TSStringKeyword>;
  TSSymbolKeyword?: RuleFunction<TSESTree.TSSymbolKeyword>;
  TSTemplateLiteralType?: RuleFunction<TSESTree.TSTemplateLiteralType>;
  TSThisType?: RuleFunction<TSESTree.TSThisType>;
  TSTupleType?: RuleFunction<TSESTree.TSTupleType>;
  TSTypeAliasDeclaration?: RuleFunction<TSESTree.TSTypeAliasDeclaration>;
  TSTypeAnnotation?: RuleFunction<TSESTree.TSTypeAnnotation>;
  TSTypeAssertion?: RuleFunction<TSESTree.TSTypeAssertion>;
  TSTypeLiteral?: RuleFunction<TSESTree.TSTypeLiteral>;
  TSTypeOperator?: RuleFunction<TSESTree.TSTypeOperator>;
  TSTypeParameter?: RuleFunction<TSESTree.TSTypeParameter>;
  TSTypeParameterDeclaration?: RuleFunction<TSESTree.TSTypeParameterDeclaration>;
  TSTypeParameterInstantiation?: RuleFunction<TSESTree.TSTypeParameterInstantiation>;
  TSTypePredicate?: RuleFunction<TSESTree.TSTypePredicate>;
  TSTypeQuery?: RuleFunction<TSESTree.TSTypeQuery>;
  TSTypeReference?: RuleFunction<TSESTree.TSTypeReference>;
  TSUndefinedKeyword?: RuleFunction<TSESTree.TSUndefinedKeyword>;
  TSUnionType?: RuleFunction<TSESTree.TSUnionType>;
  TSUnknownKeyword?: RuleFunction<TSESTree.TSUnknownKeyword>;
  TSVoidKeyword?: RuleFunction<TSESTree.TSVoidKeyword>;
  UnaryExpression?: RuleFunction<TSESTree.UnaryExpression>;
  UpdateExpression?: RuleFunction<TSESTree.UpdateExpression>;
  VariableDeclaration?: RuleFunction<TSESTree.VariableDeclaration>;
  VariableDeclarator?: RuleFunction<TSESTree.VariableDeclarator>;
  WhileStatement?: RuleFunction<TSESTree.WhileStatement>;
  WithStatement?: RuleFunction<TSESTree.WithStatement>;
  YieldExpression?: RuleFunction<TSESTree.YieldExpression>;
}

Properties

Name Type Optional Description
AccessorProperty RuleFunction<TSESTree.AccessorProperty> βœ“ not shown
ArrayExpression RuleFunction<TSESTree.ArrayExpression> βœ“ not shown
ArrayPattern RuleFunction<TSESTree.ArrayPattern> βœ“ not shown
ArrowFunctionExpression RuleFunction<TSESTree.ArrowFunctionExpression> βœ“ not shown
AssignmentExpression RuleFunction<TSESTree.AssignmentExpression> βœ“ not shown
AssignmentPattern RuleFunction<TSESTree.AssignmentPattern> βœ“ not shown
AwaitExpression RuleFunction<TSESTree.AwaitExpression> βœ“ not shown
BinaryExpression RuleFunction<TSESTree.BinaryExpression> βœ“ not shown
BlockStatement RuleFunction<TSESTree.BlockStatement> βœ“ not shown
BreakStatement RuleFunction<TSESTree.BreakStatement> βœ“ not shown
CallExpression RuleFunction<TSESTree.CallExpression> βœ“ not shown
CatchClause RuleFunction<TSESTree.CatchClause> βœ“ not shown
ChainExpression RuleFunction<TSESTree.ChainExpression> βœ“ not shown
ClassBody RuleFunction<TSESTree.ClassBody> βœ“ not shown
ClassDeclaration RuleFunction<TSESTree.ClassDeclaration> βœ“ not shown
ClassExpression RuleFunction<TSESTree.ClassExpression> βœ“ not shown
ConditionalExpression RuleFunction<TSESTree.ConditionalExpression> βœ“ not shown
ContinueStatement RuleFunction<TSESTree.ContinueStatement> βœ“ not shown
DebuggerStatement RuleFunction<TSESTree.DebuggerStatement> βœ“ not shown
Decorator RuleFunction<TSESTree.Decorator> βœ“ not shown
DoWhileStatement RuleFunction<TSESTree.DoWhileStatement> βœ“ not shown
EmptyStatement RuleFunction<TSESTree.EmptyStatement> βœ“ not shown
ExportAllDeclaration RuleFunction<TSESTree.ExportAllDeclaration> βœ“ not shown
ExportDefaultDeclaration RuleFunction<TSESTree.ExportDefaultDeclaration> βœ“ not shown
ExportNamedDeclaration RuleFunction<TSESTree.ExportNamedDeclaration> βœ“ not shown
ExportSpecifier RuleFunction<TSESTree.ExportSpecifier> βœ“ not shown
ExpressionStatement RuleFunction<TSESTree.ExpressionStatement> βœ“ not shown
ForInStatement RuleFunction<TSESTree.ForInStatement> βœ“ not shown
ForOfStatement RuleFunction<TSESTree.ForOfStatement> βœ“ not shown
ForStatement RuleFunction<TSESTree.ForStatement> βœ“ not shown
FunctionDeclaration RuleFunction<TSESTree.FunctionDeclaration> βœ“ not shown
FunctionExpression RuleFunction<TSESTree.FunctionExpression> βœ“ not shown
Identifier RuleFunction<TSESTree.Identifier> βœ“ not shown
IfStatement RuleFunction<TSESTree.IfStatement> βœ“ not shown
ImportAttribute RuleFunction<TSESTree.ImportAttribute> βœ“ not shown
ImportDeclaration RuleFunction<TSESTree.ImportDeclaration> βœ“ not shown
ImportDefaultSpecifier RuleFunction<TSESTree.ImportDefaultSpecifier> βœ“ not shown
ImportExpression RuleFunction<TSESTree.ImportExpression> βœ“ not shown
ImportNamespaceSpecifier RuleFunction<TSESTree.ImportNamespaceSpecifier> βœ“ not shown
ImportSpecifier RuleFunction<TSESTree.ImportSpecifier> βœ“ not shown
JSXAttribute RuleFunction<TSESTree.JSXAttribute> βœ“ not shown
JSXClosingElement RuleFunction<TSESTree.JSXClosingElement> βœ“ not shown
JSXClosingFragment RuleFunction<TSESTree.JSXClosingFragment> βœ“ not shown
JSXElement RuleFunction<TSESTree.JSXElement> βœ“ not shown
JSXEmptyExpression RuleFunction<TSESTree.JSXEmptyExpression> βœ“ not shown
JSXExpressionContainer RuleFunction<TSESTree.JSXExpressionContainer> βœ“ not shown
JSXFragment RuleFunction<TSESTree.JSXFragment> βœ“ not shown
JSXIdentifier RuleFunction<TSESTree.JSXIdentifier> βœ“ not shown
JSXMemberExpression RuleFunction<TSESTree.JSXMemberExpression> βœ“ not shown
JSXNamespacedName RuleFunction<TSESTree.JSXNamespacedName> βœ“ not shown
JSXOpeningElement RuleFunction<TSESTree.JSXOpeningElement> βœ“ not shown
JSXOpeningFragment RuleFunction<TSESTree.JSXOpeningFragment> βœ“ not shown
JSXSpreadAttribute RuleFunction<TSESTree.JSXSpreadAttribute> βœ“ not shown
JSXSpreadChild RuleFunction<TSESTree.JSXSpreadChild> βœ“ not shown
JSXText RuleFunction<TSESTree.JSXText> βœ“ not shown
LabeledStatement RuleFunction<TSESTree.LabeledStatement> βœ“ not shown
Literal RuleFunction<TSESTree.Literal> βœ“ not shown
LogicalExpression RuleFunction<TSESTree.LogicalExpression> βœ“ not shown
MemberExpression RuleFunction<TSESTree.MemberExpression> βœ“ not shown
MetaProperty RuleFunction<TSESTree.MetaProperty> βœ“ not shown
MethodDefinition RuleFunction<TSESTree.MethodDefinition> βœ“ not shown
NewExpression RuleFunction<TSESTree.NewExpression> βœ“ not shown
ObjectExpression RuleFunction<TSESTree.ObjectExpression> βœ“ not shown
ObjectPattern RuleFunction<TSESTree.ObjectPattern> βœ“ not shown
PrivateIdentifier RuleFunction<TSESTree.PrivateIdentifier> βœ“ not shown
Program RuleFunction<TSESTree.Program> βœ“ not shown
Property RuleFunction<TSESTree.Property> βœ“ not shown
PropertyDefinition RuleFunction<TSESTree.PropertyDefinition> βœ“ not shown
RestElement RuleFunction<TSESTree.RestElement> βœ“ not shown
ReturnStatement RuleFunction<TSESTree.ReturnStatement> βœ“ not shown
SequenceExpression RuleFunction<TSESTree.SequenceExpression> βœ“ not shown
SpreadElement RuleFunction<TSESTree.SpreadElement> βœ“ not shown
StaticBlock RuleFunction<TSESTree.StaticBlock> βœ“ not shown
Super RuleFunction<TSESTree.Super> βœ“ not shown
SwitchCase RuleFunction<TSESTree.SwitchCase> βœ“ not shown
SwitchStatement RuleFunction<TSESTree.SwitchStatement> βœ“ not shown
TaggedTemplateExpression RuleFunction<TSESTree.TaggedTemplateExpression> βœ“ not shown
TemplateElement RuleFunction<TSESTree.TemplateElement> βœ“ not shown
TemplateLiteral RuleFunction<TSESTree.TemplateLiteral> βœ“ not shown
ThisExpression RuleFunction<TSESTree.ThisExpression> βœ“ not shown
ThrowStatement RuleFunction<TSESTree.ThrowStatement> βœ“ not shown
TryStatement RuleFunction<TSESTree.TryStatement> βœ“ not shown
TSAbstractAccessorProperty RuleFunction<TSESTree.TSAbstractAccessorProperty> βœ“ not shown
TSAbstractKeyword RuleFunction<TSESTree.TSAbstractKeyword> βœ“ not shown
TSAbstractMethodDefinition RuleFunction<TSESTree.TSAbstractMethodDefinition> βœ“ not shown
TSAbstractPropertyDefinition RuleFunction<TSESTree.TSAbstractPropertyDefinition> βœ“ not shown
TSAnyKeyword RuleFunction<TSESTree.TSAnyKeyword> βœ“ not shown
TSArrayType RuleFunction<TSESTree.TSArrayType> βœ“ not shown
TSAsExpression RuleFunction<TSESTree.TSAsExpression> βœ“ not shown
TSAsyncKeyword RuleFunction<TSESTree.TSAsyncKeyword> βœ“ not shown
TSBigIntKeyword RuleFunction<TSESTree.TSBigIntKeyword> βœ“ not shown
TSBooleanKeyword RuleFunction<TSESTree.TSBooleanKeyword> βœ“ not shown
TSCallSignatureDeclaration RuleFunction<TSESTree.TSCallSignatureDeclaration> βœ“ not shown
TSClassImplements RuleFunction<TSESTree.TSClassImplements> βœ“ not shown
TSConditionalType RuleFunction<TSESTree.TSConditionalType> βœ“ not shown
TSConstructorType RuleFunction<TSESTree.TSConstructorType> βœ“ not shown
TSConstructSignatureDeclaration RuleFunction<TSESTree.TSConstructSignatureDeclaration> βœ“ not shown
TSDeclareFunction RuleFunction<TSESTree.TSDeclareFunction> βœ“ not shown
TSDeclareKeyword RuleFunction<TSESTree.TSDeclareKeyword> βœ“ not shown
TSEmptyBodyFunctionExpression RuleFunction<TSESTree.TSEmptyBodyFunctionExpression> βœ“ not shown
TSEnumBody RuleFunction<TSESTree.TSEnumBody> βœ“ not shown
TSEnumDeclaration RuleFunction<TSESTree.TSEnumDeclaration> βœ“ not shown
TSEnumMember RuleFunction<TSESTree.TSEnumMember> βœ“ not shown
TSExportAssignment RuleFunction<TSESTree.TSExportAssignment> βœ“ not shown
TSExportKeyword RuleFunction<TSESTree.TSExportKeyword> βœ“ not shown
TSExternalModuleReference RuleFunction<TSESTree.TSExternalModuleReference> βœ“ not shown
TSFunctionType RuleFunction<TSESTree.TSFunctionType> βœ“ not shown
TSImportEqualsDeclaration RuleFunction<TSESTree.TSImportEqualsDeclaration> βœ“ not shown
TSImportType RuleFunction<TSESTree.TSImportType> βœ“ not shown
TSIndexedAccessType RuleFunction<TSESTree.TSIndexedAccessType> βœ“ not shown
TSIndexSignature RuleFunction<TSESTree.TSIndexSignature> βœ“ not shown
TSInferType RuleFunction<TSESTree.TSInferType> βœ“ not shown
TSInstantiationExpression RuleFunction<TSESTree.TSInstantiationExpression> βœ“ not shown
TSInterfaceBody RuleFunction<TSESTree.TSInterfaceBody> βœ“ not shown
TSInterfaceDeclaration RuleFunction<TSESTree.TSInterfaceDeclaration> βœ“ not shown
TSInterfaceHeritage RuleFunction<TSESTree.TSInterfaceHeritage> βœ“ not shown
TSIntersectionType RuleFunction<TSESTree.TSIntersectionType> βœ“ not shown
TSIntrinsicKeyword RuleFunction<TSESTree.TSIntrinsicKeyword> βœ“ not shown
TSLiteralType RuleFunction<TSESTree.TSLiteralType> βœ“ not shown
TSMappedType RuleFunction<TSESTree.TSMappedType> βœ“ not shown
TSMethodSignature RuleFunction<TSESTree.TSMethodSignature> βœ“ not shown
TSModuleBlock RuleFunction<TSESTree.TSModuleBlock> βœ“ not shown
TSModuleDeclaration RuleFunction<TSESTree.TSModuleDeclaration> βœ“ not shown
TSNamedTupleMember RuleFunction<TSESTree.TSNamedTupleMember> βœ“ not shown
TSNamespaceExportDeclaration RuleFunction<TSESTree.TSNamespaceExportDeclaration> βœ“ not shown
TSNeverKeyword RuleFunction<TSESTree.TSNeverKeyword> βœ“ not shown
TSNonNullExpression RuleFunction<TSESTree.TSNonNullExpression> βœ“ not shown
TSNullKeyword RuleFunction<TSESTree.TSNullKeyword> βœ“ not shown
TSNumberKeyword RuleFunction<TSESTree.TSNumberKeyword> βœ“ not shown
TSObjectKeyword RuleFunction<TSESTree.TSObjectKeyword> βœ“ not shown
TSOptionalType RuleFunction<TSESTree.TSOptionalType> βœ“ not shown
TSParameterProperty RuleFunction<TSESTree.TSParameterProperty> βœ“ not shown
TSPrivateKeyword RuleFunction<TSESTree.TSPrivateKeyword> βœ“ not shown
TSPropertySignature RuleFunction<TSESTree.TSPropertySignature> βœ“ not shown
TSProtectedKeyword RuleFunction<TSESTree.TSProtectedKeyword> βœ“ not shown
TSPublicKeyword RuleFunction<TSESTree.TSPublicKeyword> βœ“ not shown
TSQualifiedName RuleFunction<TSESTree.TSQualifiedName> βœ“ not shown
TSReadonlyKeyword RuleFunction<TSESTree.TSReadonlyKeyword> βœ“ not shown
TSRestType RuleFunction<TSESTree.TSRestType> βœ“ not shown
TSSatisfiesExpression RuleFunction<TSESTree.TSSatisfiesExpression> βœ“ not shown
TSStaticKeyword RuleFunction<TSESTree.TSStaticKeyword> βœ“ not shown
TSStringKeyword RuleFunction<TSESTree.TSStringKeyword> βœ“ not shown
TSSymbolKeyword RuleFunction<TSESTree.TSSymbolKeyword> βœ“ not shown
TSTemplateLiteralType RuleFunction<TSESTree.TSTemplateLiteralType> βœ“ not shown
TSThisType RuleFunction<TSESTree.TSThisType> βœ“ not shown
TSTupleType RuleFunction<TSESTree.TSTupleType> βœ“ not shown
TSTypeAliasDeclaration RuleFunction<TSESTree.TSTypeAliasDeclaration> βœ“ not shown
TSTypeAnnotation RuleFunction<TSESTree.TSTypeAnnotation> βœ“ not shown
TSTypeAssertion RuleFunction<TSESTree.TSTypeAssertion> βœ“ not shown
TSTypeLiteral RuleFunction<TSESTree.TSTypeLiteral> βœ“ not shown
TSTypeOperator RuleFunction<TSESTree.TSTypeOperator> βœ“ not shown
TSTypeParameter RuleFunction<TSESTree.TSTypeParameter> βœ“ not shown
TSTypeParameterDeclaration RuleFunction<TSESTree.TSTypeParameterDeclaration> βœ“ not shown
TSTypeParameterInstantiation RuleFunction<TSESTree.TSTypeParameterInstantiation> βœ“ not shown
TSTypePredicate RuleFunction<TSESTree.TSTypePredicate> βœ“ not shown
TSTypeQuery RuleFunction<TSESTree.TSTypeQuery> βœ“ not shown
TSTypeReference RuleFunction<TSESTree.TSTypeReference> βœ“ not shown
TSUndefinedKeyword RuleFunction<TSESTree.TSUndefinedKeyword> βœ“ not shown
TSUnionType RuleFunction<TSESTree.TSUnionType> βœ“ not shown
TSUnknownKeyword RuleFunction<TSESTree.TSUnknownKeyword> βœ“ not shown
TSVoidKeyword RuleFunction<TSESTree.TSVoidKeyword> βœ“ not shown
UnaryExpression RuleFunction<TSESTree.UnaryExpression> βœ“ not shown
UpdateExpression RuleFunction<TSESTree.UpdateExpression> βœ“ not shown
VariableDeclaration RuleFunction<TSESTree.VariableDeclaration> βœ“ not shown
VariableDeclarator RuleFunction<TSESTree.VariableDeclarator> βœ“ not shown
WhileStatement RuleFunction<TSESTree.WhileStatement> βœ“ not shown
WithStatement RuleFunction<TSESTree.WithStatement> βœ“ not shown
YieldExpression RuleFunction<TSESTree.YieldExpression> βœ“ not shown

RuleListenerExtension

Interface Code
export interface RuleListenerExtension {
  // The code path functions below were introduced in ESLint v8.7.0 but are
  // intentionally commented out because they cause unresolvable compiler
  // errors:
  // https://github.com/typescript-eslint/typescript-eslint/issues/6993
  // Note that plugin authors can copy-paste these functions into their own code
  // as selectors and they will still work as long as the second argument is
  // omitted.
  /*
  onCodePathStart?: (
    codePath: TSESLint.CodePath,
    node: TSESTree.Node,
  ) => void;
  */
  /*
  onCodePathEnd?: (
    codePath: TSESLint.CodePath,
    node: TSESTree.Node,
  ) => void;
  */
  /*
  onCodePathSegmentStart?: (
    segment: TSESLint.CodePathSegment,
    node: TSESTree.Node,
  ) => void;
  */
  /*
  onCodePathSegmentEnd?: (
    segment: TSESLint.CodePathSegment,
    node: TSESTree.Node,
  ) => void;
  */
  /*
  onCodePathSegmentLoop?: (
    fromSegment: TSESLint.CodePathSegment,
    toSegment: TSESLint.CodePathSegment,
    node: TSESTree.Node,
  ) => void;
  */
}

RuleModule<MessageIds extends string, Options extends readonly unknown[] = [], Docs = unknown, ExtendedRuleListener extends RuleListener = RuleListener>

Interface Code
export interface RuleModule<
  MessageIds extends string,
  Options extends readonly unknown[] = [],
  Docs = unknown,
  // for extending base rules
  ExtendedRuleListener extends RuleListener = RuleListener,
> {
  /**
   * Function which returns an object with methods that ESLint calls to β€œvisit”
   * nodes while traversing the abstract syntax tree.
   */
  create(
    context: Readonly<RuleContext<MessageIds, Options>>,
  ): ExtendedRuleListener;

  /**
   * @deprecated Use meta.defaultOptions instead
   * Default options the rule will be run with
   */
  defaultOptions?: Options;

  /**
   * Metadata about the rule
   */
  meta: RuleMetaData<MessageIds, Docs, Options>;

  /**
   * Rule name
   */
  name?: string;
}

Properties

Name Type Optional Description
defaultOptions Options βœ“ not shown
meta RuleMetaData<MessageIds, Docs, Options> βœ— not shown
name string βœ“ not shown

RuleModuleWithMetaDocs<MessageIds extends string, Options extends readonly unknown[] = [], Docs = unknown, ExtendedRuleListener extends RuleListener = RuleListener>

Interface Code
export interface RuleModuleWithMetaDocs<
  MessageIds extends string,
  Options extends readonly unknown[] = [],
  Docs = unknown,
  // for extending base rules
  ExtendedRuleListener extends RuleListener = RuleListener,
> extends RuleModule<MessageIds, Options, Docs, ExtendedRuleListener> {
  /**
   * Metadata about the rule
   */
  meta: RuleMetaDataWithDocs<MessageIds, Docs, Options>;
}

Properties

Name Type Optional Description
meta RuleMetaDataWithDocs<MessageIds, Docs, Options> βœ— not shown

Type Aliases

RuleRecommendation

type RuleRecommendation = 'recommended' | 'strict' | 'stylistic';

ReportFixFunction

type ReportFixFunction = (
  fixer: RuleFixer,
) => IterableIterator<RuleFix> | readonly RuleFix[] | RuleFix | null;

ReportSuggestionArray<MessageIds extends string>

type ReportSuggestionArray<MessageIds extends string> = SuggestionReportDescriptor<MessageIds>[];

ReportDescriptorMessageData

type ReportDescriptorMessageData = Readonly<Record<string, unknown>>;

ReportDescriptor<MessageIds extends string>

type ReportDescriptor<MessageIds extends string> = (
  ReportDescriptorLocOnly | ReportDescriptorNodeOptionalLoc
) &
  ReportDescriptorWithSuggestion<MessageIds>;

CodePathFunction

/* * Part of the code path analysis feature of ESLint: * https://eslint.org/docs/latest/extend/code-path-analysis * * This type is unused in the typescript-eslint codebase since putting it on * the nodeSelector for RuleListener would break the existing definition. * However, it is exported here for the purposes of manual type-assertion. * * @see https://github.com/typescript-eslint/typescript-eslint/issues/6993 /

type CodePathFunction = | ((codePath: CodePath, node: TSESTree.Node) => void)
  | ((
      fromSegment: CodePathSegment,
      toSegment: CodePathSegment,
      node: TSESTree.Node,
    ) => void)
  | ((segment: CodePathSegment, node: TSESTree.Node) => void);

RuleFunction<T extends TSESTree.NodeOrTokenData = never>

type RuleFunction<T extends TSESTree.NodeOrTokenData = never> = (
  node: T,
) => void;

RuleListenerExitSelectors

type RuleListenerExitSelectors = {
  [
    K in keyof RuleListenerBaseSelectors as `${K}:exit`
  ]: RuleListenerBaseSelectors[K];
};

RuleListenerCatchAllBaseCase

type RuleListenerCatchAllBaseCase = Record<string, RuleFunction | undefined>;

RuleListener

type RuleListener = RuleListenerBaseSelectors &
  RuleListenerCatchAllBaseCase &
  RuleListenerExitSelectors;

AnyRuleModule

type AnyRuleModule = RuleModule<string, readonly unknown[]>;

AnyRuleModuleWithMetaDocs

type AnyRuleModuleWithMetaDocs = RuleModuleWithMetaDocs<
  string,
  unknown[]
>;

LooseRuleDefinition

/* * A loose definition of the RuleModule type for use with configs. This type is * intended to relax validation of types so that we can have basic validation * without being overly strict about nitty gritty details matching. * * For example the plugin might be declared using an old version of our types or * they might use the DefinitelyTyped eslint types. Ultimately we don't need * super strict validation in a config - a loose shape match is "good enough" to * help validate the config is correct. * * @see {@link LooseParserModule}, {@link LooseProcessorModule} /

type LooseRuleDefinition = | LooseRuleCreateFunction
  | {
      create: LooseRuleCreateFunction;
      meta?: object | undefined;
    };

LooseRuleCreateFunction

type LooseRuleCreateFunction = (context: any) => Record<
  string,
  /*
  eslint-disable-next-line @typescript-eslint/no-unsafe-function-type --
  intentionally use Function here to give us the basic "is a function" validation
  without enforcing specific argument types so that different AST types can still
  be passed to configs
  */
  Function | undefined
>;

RuleCreateFunction<MessageIds extends string = never, Options extends readonly unknown[] = unknown[]>

type RuleCreateFunction<MessageIds extends string = never, Options extends readonly unknown[] = unknown[]> = (context: Readonly<RuleContext<MessageIds, Options>>) => RuleListener;

AnyRuleCreateFunction

type AnyRuleCreateFunction = RuleCreateFunction<
  string,
  readonly unknown[]
>;

Generated by Syntax Scribe