Skip to content
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

add vars to scope manager declaredVariables #84

Merged
merged 1 commit into from Apr 10, 2024

Conversation

patricklx
Copy link
Collaborator

@patricklx patricklx commented Mar 28, 2024

This makes eslint sourceCode getDeclaredVariables work which is required for some rules to work.

@patricklx
Copy link
Collaborator Author

patricklx commented Mar 28, 2024

So, they validate if the parent is a function...
We could fix it by either adding a fake node or change the node type.
Both do not sound great. Or we provide our own copy of no-unused-var

https://github.com/eslint/eslint/blob/9b7bd3be066ac1f72fa35c4d31a1b178c7e2b683/lib/rules/no-unused-vars.js#L657

@NullVoxPopuli
Copy link
Member

I think typescript also has their own copy of no-unused-var -- wouldn't be unheard of, I guess

This makes eslint sourceCode getDeclaredVariables work which is required for some rules to work
@patricklx patricklx force-pushed the add-vars-to-scope-manager-declaredVariables branch from 7e55d06 to 094967f Compare April 10, 2024 12:29
@patricklx
Copy link
Collaborator Author

this does not fix the issue we had, but i think its still good to have it

@@ -508,12 +508,17 @@ module.exports.convertAst = function convertAst(result, preprocessedResult, visi
const scope = result.isTypescript
? new TypescriptScope.BlockScope(result.scopeManager, upperScope, node)
: new Scope(result.scopeManager, 'block', upperScope, node);
const declaredVariables =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used somewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 514

@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Apr 10, 2024
@NullVoxPopuli NullVoxPopuli merged commit 1922eda into main Apr 10, 2024
11 checks passed
@NullVoxPopuli NullVoxPopuli deleted the add-vars-to-scope-manager-declaredVariables branch April 10, 2024 12:37
@github-actions github-actions bot mentioned this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants