From ae21170656ae621f304102a446cebfa88f9300c4 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Tue, 8 Jul 2025 14:46:57 +0530 Subject: [PATCH 1/6] feat: remove deprecated RuleContext types --- packages/utils/src/ts-eslint/Rule.ts | 90 ---------------------------- 1 file changed, 90 deletions(-) diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 3b40254b0a6e..068c47f11842 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -292,96 +292,6 @@ export interface RuleContext< * 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; - - /** - * A SourceCode object that you can use to work with the source that - * was passed to ESLint. - */ - sourceCode: Readonly; - - /** - * 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): void; } /** From 268002db2d829b12c3003534c802412edfd6a1d1 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Tue, 8 Jul 2025 14:53:29 +0530 Subject: [PATCH 2/6] revert: sourceCode --- packages/utils/src/ts-eslint/Rule.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 068c47f11842..4d58f12c2915 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -292,6 +292,14 @@ export interface RuleContext< * We do not have any shared settings in this plugin. */ settings: SharedConfigurationSettings; + + // Deprecated members + + /** + * A SourceCode object that you can use to work with the source that + * was passed to ESLint. + */ + sourceCode: Readonly; } /** From ba5d2e9cc41f35f2d1c3c2be5a63674299b45961 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Tue, 8 Jul 2025 14:59:05 +0530 Subject: [PATCH 3/6] revert: report --- packages/utils/src/ts-eslint/Rule.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 4d58f12c2915..67f621db1a8a 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -300,6 +300,11 @@ export interface RuleContext< * was passed to ESLint. */ sourceCode: Readonly; + + /** + * Reports a problem in the code. + */ + report(descriptor: ReportDescriptor): void; } /** From 2e959facdd9c392e1d8801ea9b08699a34681fa9 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Tue, 8 Jul 2025 15:09:08 +0530 Subject: [PATCH 4/6] revert: filename, physicalFilename --- packages/utils/src/ts-eslint/Rule.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 67f621db1a8a..551e1d9dac34 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -295,6 +295,16 @@ export interface RuleContext< // Deprecated members + /** + * The filename associated with the source. + */ + filename: string; + + /** + * The full path of the file on disk without any code block information (unlike `filename`). + */ + physicalFilename: string; + /** * A SourceCode object that you can use to work with the source that * was passed to ESLint. From 4d913a0cf1eb66f51c31075dfc11e4b9df1d847c Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Tue, 8 Jul 2025 15:24:07 +0530 Subject: [PATCH 5/6] lint: remove unused import --- packages/utils/src/ts-eslint/Rule.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 551e1d9dac34..c1d75db7dc49 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -3,7 +3,6 @@ import type { ParserServices, TSESTree } from '../ts-estree'; import type { AST } from './AST'; import type { FlatConfig } from './Config'; import type { Linter } from './Linter'; -import type { Scope } from './Scope'; import type { SourceCode } from './SourceCode'; export type RuleRecommendation = 'recommended' | 'strict' | 'stylistic'; From c047df6b32cdb6972b1e82993a78ee403f116f86 Mon Sep 17 00:00:00 2001 From: Abhijeet Singh Date: Wed, 9 Jul 2025 13:09:47 +0530 Subject: [PATCH 6/6] revert: properties not removed in eslint --- packages/utils/src/ts-eslint/Rule.ts | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index c1d75db7dc49..28de0455f96e 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -294,16 +294,50 @@ export interface RuleContext< // Deprecated members + /** + * 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 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; + /** * A SourceCode object that you can use to work with the source that * was passed to ESLint.