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.
Enhance
import-style
rule with auto-fix capability #2528New 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
base: main
Are you sure you want to change the base?
Enhance
import-style
rule with auto-fix capability #2528Changes from all commits
4a9bc16
98598d5
2fc70ec
0abcc93
49b7cd7
e4a832b
e74db1f
9536269
c632b34
53b9d13
9ef18bd
c9e24ee
8c5fdc5
7588a95
36f1a03
6c152fa
3374c91
db3699d
a2239f3
51c0ddf
82d41e3
1268fd8
f2af0eb
87a1ad7
a8fd20e
c7b350c
6b1e679
cfe9cc8
43ff202
3dba112
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I think we can focus on
import
s, leaverequire()
alone, ESM should be preferred.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.
Yes, we no longer plan to handle anything CommonJS.
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.
Please help me understand this. Since you turn the
VariableDeclarator
into an identifier, so theRestElement
just removed?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 part should use
sourceCode.getDeclaredVariables()
to get variable from theImportDeclaration
and then we have all the references. Including child scopes.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.
consistent-assert
has similar logic, you can take a look. https://github.com/sindresorhus/eslint-plugin-unicorn/pull/2535/filesThere 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 is not the current fix.
will fix to
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.
You can use the existing
renameVariable
utility.Check warning on line 326 in rules/import-style.js
Check warning on line 326 in rules/import-style.js