Skip to content

Commit e22af8c

Browse files
authored
refactor: use CustomRuleDefinitionType in JSRuleDefinition (#19949)
1 parent 1245000 commit e22af8c

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

lib/types/index.d.ts

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@
2727

2828
import * as ESTree from "estree";
2929
import type {
30-
RuleVisitor,
31-
TextSourceCode,
30+
CustomRuleDefinitionType,
31+
CustomRuleTypeDefinitions,
32+
DeprecatedInfo,
3233
Language,
33-
SourceRange,
34-
TraversalStep,
3534
LanguageOptions as GenericLanguageOptions,
36-
RuleDefinition,
3735
RuleContext as CoreRuleContext,
38-
DeprecatedInfo,
36+
RuleDefinition,
37+
RuleVisitor,
38+
SourceRange,
39+
TextSourceCode,
40+
TraversalStep,
3941
} from "@eslint/core";
4042
import { JSONSchema4 } from "json-schema";
4143
import { LegacyESLint } from "./use-at-your-own-risk.js";
@@ -1250,27 +1252,18 @@ export namespace Rule {
12501252
}
12511253
}
12521254

1253-
export type JSRuleDefinitionTypeOptions = {
1254-
RuleOptions: unknown[];
1255-
MessageIds: string;
1256-
ExtRuleDocs: Record<string, unknown>;
1257-
};
1255+
export type JSRuleDefinitionTypeOptions = CustomRuleTypeDefinitions;
12581256

12591257
export type JSRuleDefinition<
12601258
Options extends Partial<JSRuleDefinitionTypeOptions> = {},
1261-
> = RuleDefinition<
1262-
// Language specific type options (non-configurable)
1259+
> = CustomRuleDefinitionType<
12631260
{
12641261
LangOptions: Linter.LanguageOptions;
12651262
Code: SourceCode;
12661263
Visitor: Rule.NodeListener;
12671264
Node: JSSyntaxElement;
1268-
} & Required<
1269-
// Rule specific type options (custom)
1270-
Options &
1271-
// Rule specific type options (defaults)
1272-
Omit<JSRuleDefinitionTypeOptions, keyof Options>
1273-
>
1265+
},
1266+
Options
12741267
>;
12751268

12761269
// #region Linter

0 commit comments

Comments
 (0)