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.

ES6 'no-unused-vars' ignore unused import declarations

See original GitHub issue

Would like to add an option to the ‘no-unused-vars’ rule to ignore unused imports.

For instance:

import plugin from 'plugin'; // defined as a UMD object with a jquery dependency and exports jQuery.fn.plugin 
import $ from 'jquery';

$(ele).plugin();

I see this as useful as there are many libraries that add to global objects that are required before the original global object is imported.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
michaelficarracommented, May 19, 2015

👎. Use import 'plugin'.

2reactions
pixeldrewcommented, May 20, 2015

ah, good to know. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I remove unused imports/declarations from the entire ...
If rules contains no-unused-vars , eslint will "fix" the unused import by removing them (along with other auto fixes).
Read more >
no-unused-vars - ESLint - Pluggable JavaScript Linter
Rule Details​​ This rule is aimed at eliminating unused variables, functions, and function parameters. A variable foo is considered to be used if...
Read more >
eslint-plugin-unused-imports - npm
Find and remove unused es6 module imports. It works by splitting up the no-unused-vars rule depending on it being an import statement in...
Read more >
Automatically Remove Unused Imports From Your JS Projects
For this reason, I prefer to set ignoreDeclarationSort to true . It is for the best anyway because this rule provides minimal customization...
Read more >
eslint-plugin-unused-imports - npm package - Snyk
Find and remove unused es6 module imports. It works by splitting up the no-unused-vars rule depending on it being an import statement in...
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