Skip to content

Commit 28cc7ab

Browse files
authored
fix: Remove incorrect RuleContext types (#19910)
fixes #19903
1 parent a6a6325 commit 28cc7ab

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

lib/types/index.d.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,25 +1186,7 @@ export namespace Rule {
11861186
RuleOptions: any[];
11871187
Node: JSSyntaxElement;
11881188
MessageIds: string;
1189-
}> {
1190-
/*
1191-
* Need to extend the `RuleContext` interface to include the
1192-
* deprecated methods that have not yet been removed.
1193-
* TODO: Remove in v10.0.0.
1194-
*/
1195-
1196-
/** @deprecated Use `sourceCode.getAncestors()` instead */
1197-
getAncestors(): ESTree.Node[];
1198-
1199-
/** @deprecated Use `sourceCode.getDeclaredVariables()` instead */
1200-
getDeclaredVariables(node: ESTree.Node): Scope.Variable[];
1201-
1202-
/** @deprecated Use `sourceCode.getScope()` instead */
1203-
getScope(): Scope.Scope;
1204-
1205-
/** @deprecated Use `sourceCode.markVariableAsUsed()` instead */
1206-
markVariableAsUsed(name: string): boolean;
1207-
}
1189+
}> {}
12081190

12091191
type ReportFixer = (
12101192
fixer: RuleFixer,

tests/lib/types/types.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,6 @@ rule = {
625625

626626
rule = {
627627
create(context: Rule.RuleContext) {
628-
context.getAncestors();
629-
630-
context.getDeclaredVariables(AST);
631-
632628
context.filename;
633629

634630
context.getFilename();
@@ -653,16 +649,12 @@ rule = {
653649
context.getSourceCode();
654650
context.getSourceCode().getLocFromIndex(42);
655651

656-
context.getScope();
657-
658652
if (typeof context.parserPath === "string") {
659653
context.parserPath;
660654
} else {
661655
context.languageOptions?.parser;
662656
}
663657

664-
context.markVariableAsUsed("foo");
665-
666658
// @ts-expect-error wrong `node` type
667659
context.report({ message: "foo", node: {} });
668660

0 commit comments

Comments
 (0)