feat: replace fix with suggestions in no-duplicate-imports#445
feat: replace fix with suggestions in no-duplicate-imports#445Tanujkanti4441 wants to merge 4 commits into
no-duplicate-imports#445Conversation
There was a problem hiding this comment.
The syntax of @import also allows specifying a layer and a supports condition (so not everything after is a condition).
Or should this be handled in a follow-up?
There was a problem hiding this comment.
This PR already includes the layer and supports conditions. I have added tests regarding this also. So, I think we can just update the word condition to something more appropriate? like modifier?
There was a problem hiding this comment.
Sorry for the delay. I did not see those tests when writing this comment.
I agree to that changing the function name to getImportModifiers (I cannot think of something better than modifier).
There was a problem hiding this comment.
Have changed word condition to modifier everywhere.
There was a problem hiding this comment.
We could make imports an array now instead of converting it from a set to an array for Array#some/find.
Prerequisites checklist
AI acknowledgment
What is the purpose of this pull request?
To remove the fix for duplicate imports that have conditions and apply suggestions to them.
What changes did you make? (Give an overview)
Applied suggestions to the duplicate imports instead of fix.
Now, for this code rule will propose two suggestions to remove anyone the duplicates with following messages:
For first one:
Remove duplicate @import rule with condition(s) - print.For second one:
Remove duplicate @import rule without conditions.Same for this code:
For first one:
Remove duplicate @import rule with condition(s) - print.For second one:
Remove duplicate @import rule with condition(s) - print, screen.If both duplicates have the same conditions, then the rule will apply autofix and will remove the second one. For now, the autofix only works if the conditions in both then imports are in the same order.
Should we apply the autofix if imports have same conditions but in different order as well?
Related Issues
fixes #441
Is there anything you'd like reviewers to focus on?