-
-
Notifications
You must be signed in to change notification settings - Fork 717
fix(linter): patch @typescript-eslint/scope manager
#15214
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
Open
lilnasy
wants to merge
2
commits into
oxc-project:main
Choose a base branch
from
lilnasy:fix/linter/patch-typescript-eslint-scope-manager
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+63
−3
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| diff --git a/dist/scope/ScopeBase.js b/dist/scope/ScopeBase.js | ||
| index 5e07a7c3fb4670b2ce4fa405798d2f27c0084fef..b773c16431a860580dd9408c6127b06256c41c3b 100644 | ||
| --- a/dist/scope/ScopeBase.js | ||
| +++ b/dist/scope/ScopeBase.js | ||
| @@ -8,6 +8,7 @@ const ID_1 = require("../ID"); | ||
| const Reference_1 = require("../referencer/Reference"); | ||
| const variable_1 = require("../variable"); | ||
| const ScopeType_1 = require("./ScopeType"); | ||
| +const ImplicitLibVariable_1 = require("../variable/ImplicitLibVariable"); | ||
| /** | ||
| * Test if scope is strict | ||
| */ | ||
| @@ -254,6 +255,10 @@ class ScopeBase { | ||
| return false; | ||
| } | ||
| // variable exists on the scope | ||
| + // implicit lib variables should always be resolved statically | ||
| + if (variable instanceof ImplicitLibVariable_1.ImplicitLibVariable) { | ||
| + return true; | ||
| + } | ||
| // in module mode, we can statically resolve everything, regardless of its decl type | ||
| if (scopeManager.isModule()) { | ||
| return true; | ||
| @@ -306,6 +311,11 @@ class ScopeBase { | ||
| set.set(name, variable); | ||
| variables.push(variable); | ||
| } | ||
| + else if (variable instanceof ImplicitLibVariable_1.ImplicitLibVariable && | ||
| + nameOrVariable instanceof ImplicitLibVariable_1.ImplicitLibVariable) { | ||
| + variable.isTypeVariable ||= nameOrVariable.isTypeVariable; | ||
| + variable.isValueVariable ||= nameOrVariable.isValueVariable; | ||
| + } | ||
| if (def) { | ||
| variable.defs.push(def); | ||
| this.addDeclaredVariablesOfNode(variable, def.node); | ||
| diff --git a/dist/variable/ImplicitLibVariable.d.ts b/dist/variable/ImplicitLibVariable.d.ts | ||
| index 6c967519e4bf1ce20c0fc5dd60e5bde2e3ae9ef2..2c4ef8ffb2aba72467d6e7679f042cffabdb03ab 100644 | ||
| --- a/dist/variable/ImplicitLibVariable.d.ts | ||
| +++ b/dist/variable/ImplicitLibVariable.d.ts | ||
| @@ -18,10 +18,10 @@ export declare class ImplicitLibVariable extends ESLintScopeVariable implements | ||
| /** | ||
| * `true` if the variable is valid in a type context, false otherwise | ||
| */ | ||
| - readonly isTypeVariable: boolean; | ||
| + isTypeVariable: boolean; | ||
| /** | ||
| * `true` if the variable is valid in a value context, false otherwise | ||
| */ | ||
| - readonly isValueVariable: boolean; | ||
| + isValueVariable: boolean; | ||
| constructor(scope: Scope, name: string, { eslintImplicitGlobalSetting, isTypeVariable, isValueVariable, writeable, }: ImplicitLibVariableOptions); | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.