Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(utils): define SourceCode#getScope and deprecate Context#getScope #7810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/utils/src/ts-eslint/Rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 6 additions & 0 deletions packages/utils/src/ts-eslint/SourceCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down