You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before You File a Bug Report Please Confirm You Have Done The Following...
I'm using eslint-plugin-svelte. (*.svelte file linting does not work with the parser alone. You should also use eslint-plugin-svelte with it.)
I'm sure the problem is a parser problem. (If you are not sure, search for the issue in eslint-plugin-svelte repo and open the issue in eslint-plugin-svelte repo if there is no solution.
I have tried restarting my IDE and the issue persists.
I have updated to the latest version of the packages.
What version of ESLint are you using?
8.34.0
What version of eslint-plugin-svelte and svelte-eslint-parser are you using?
When writing an ESLint rule I expect to get a module scope for visitors with selectors ImportDeclaration or VariableDeclaration or any other top-level statement.
What actually happened?
context.getScope returns the global scope and not the expected module scope.
Link to GitHub Repo with Minimal Reproducible Example
The default scope manager and other custom parser / scope manager return a module scope.
They only return the global scope for Program (which for svelte would be the SvelteScriptElement).
I am willing to provide a PR to fix this.
The text was updated successfully, but these errors were encountered:
DMartens
changed the title
Scope Manager:
Scope Manager: Return module scope for top level statements
Feb 17, 2023
DMartens
changed the title
Scope Manager: Return module scope for top level statements
Scope Manager should return module scope for top level statements
Feb 17, 2023
Before You File a Bug Report Please Confirm You Have Done The Following...
*.svelte
file linting does not work with the parser alone. You should also use eslint-plugin-svelte with it.)What version of ESLint are you using?
8.34.0
What version of
eslint-plugin-svelte
andsvelte-eslint-parser
are you using?What did you do?
Configuration
What did you expect to happen?
When writing an ESLint rule I expect to get a module scope for visitors with selectors
ImportDeclaration
orVariableDeclaration
or any other top-level statement.What actually happened?
context.getScope
returns the global scope and not the expected module scope.Link to GitHub Repo with Minimal Reproducible Example
https://github.com/DMartens/svelte-eslint-parser-scope-bug
The test is in the
scope.js
fileAdditional comments
The default scope manager and other custom parser / scope manager return a module scope.
They only return the global scope for
Program
(which for svelte would be theSvelteScriptElement
).I am willing to provide a PR to fix this.
The text was updated successfully, but these errors were encountered: