-
Notifications
You must be signed in to change notification settings - Fork 15
Change to handle variables listed in exported directive as unknown usage
#234
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
Conversation
|
Good work @ota-meshi! Apart from my above comment, I don't have much to say about this PR. Merge this anytime you think it's ready. |
RunDevelopment
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two nits
| /** | ||
| * Find function node | ||
| */ | ||
| function findFunction( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should probably be placed and exported in the same file as findVariable.
| ObjectPattern, | ||
| Pattern, | ||
| } from "estree" | ||
| import { findVariable, getParent } from "." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a circular dependency and I really don't like those.
I suggest moving the code (without the export ... from "..."s) in ast-util/index.ts into its own file ast-util/something.ts. By simply doing an export * from "./something" in ast-util/index.ts and changing the import here to ./something, we can get rid of the circular dependency.
|
Thank you for checking! I changed this PR. |
no-unused-capturing-grouprule, theno-useless-flagrule, and the rules usinggetUsageOfPattern, have been changed to handle theexporteddirective.no-unused-capturing-grouprule, theno-useless-flagrule, and thegetUsageOfPatternfunction. In this PR, variable tracking is shared with theextractExpressionReferencesfunction, and it has been changed to use this function.no-unused-capturing-grouprule has improved iteration tracking.no-unused-capturing-grouprule was handling has been separated by theextractPropertyReferencesfunction. This can also be used to detect thedflag, which is probably unused.close #227