question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autofix for no-duplicate-imports

See original GitHub issue

What 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:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
bmishcommented, Aug 19, 2021

In favor of adding a fixer and we might be able to borrow autofixing code from the third-party rule import/no-duplicates.

1reaction
ljharbcommented, Oct 5, 2021
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found