Autofix for no-duplicate-imports
See original GitHub issueWhat rule do you want to change?
no-duplicate-imports
Does this change cause the rule to produce more or fewer warnings? Fewer after autofixing
How will the change be implemented? (New option, new default behavior, etc.)? New default behavior
Please provide some example code that this change will affect:
import { Route } from 'react-router-dom'
import { Link as RouterLink, Switch, withRouter } from 'react-router-dom'
What does the rule currently do for this code? Raise a linting issue when an import is duplicated
What will the rule do after it’s changed? Automatically merge duplicated imports, when possible (the example I gave looks feasible)
Are you willing to submit a pull request to implement this change? Not at the moment as I don’t yet know how to code ESLint rules and autofixes.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:10 (6 by maintainers)
Top Results From Across the Web
no-duplicate-imports | typescript-eslint
Disallow duplicate imports. This rule has been deprecated in favour of the import/no-duplicates rule.
Read more >no-duplicate-imports - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >eslint --fix breaks code when no-duplicate-imports happens
The issue has been resolved, it was a bug with eslint itself and the latest version (8.11.0) has applied a fix.
Read more >Is there anyway to automatically remove duplicate imports?
Organize imports ( Shift + Alt + O ) should fix it. You can also configure it to run on save with the...
Read more >no-duplicate-imports - Rule
Rule: no-duplicate-imports. Disallows multiple import statements from the same module. Rationale. Using a single import statement per module will make the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In favor of adding a fixer and we might be able to borrow autofixing code from the third-party rule import/no-duplicates.
@samuel-beslogic the only one i know of is https://github.com/import-js/eslint-plugin-import