diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 172ee4b2dfcc..deb52c786abc 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -256,6 +256,7 @@ interface RuleContext< /** * Returns the scope of the currently-traversed node. * This information can be used track references to variables. + * @deprecated in favor of `context.getSourceCode().getScope(node)` */ getScope(): Scope.Scope; diff --git a/packages/utils/src/ts-eslint/SourceCode.ts b/packages/utils/src/ts-eslint/SourceCode.ts index 03b9c9dd2896..7c12a120031e 100644 --- a/packages/utils/src/ts-eslint/SourceCode.ts +++ b/packages/utils/src/ts-eslint/SourceCode.ts @@ -299,6 +299,12 @@ declare class SourceCodeBase extends TokenStore { * @deprecated in favor of isSpaceBetween */ isSpaceBetweenTokens(first: TSESTree.Token, second: TSESTree.Token): boolean; + /** + * Returns the scope of the given node. + * This information can be used track references to variables. + * @since 8.37.0 + */ + getScope(node: TSESTree.Node): Scope.Scope; /** * The source code split into lines according to ECMA-262 specification. * This is done to avoid each rule needing to do so separately.