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.

eslint: dependency wrongly mark as unused

See original GitHub issue

This is likely introduced by https://github.com/depcheck/depcheck/issues/476 and https://github.com/depcheck/depcheck/pull/477

Back in this previous issue, the contributor (@sveyret) wrote:

when analyzing eslint configuration dependencies, it does not look at this dependencies’ dependencies.

It should not, seems to me this is defeating the general behavior of depcheck. Any dependency that is explicitly used or imported in the project should be declared in package.json, even if it’s already made available by another dependency. I just spent some time troubleshooting this in a project.

I had the following eslint config:

extends:
  - standard-jsx
  - standard-react

And the following lines in package.json:

    "eslint-config-standard": "^12.0.0",
    "eslint-config-standard-jsx": "^8.1.0",
    "eslint-config-standard-react": "^9.0.0",

And depcheck was outputing:

Unused devDependencies
* eslint-config-standard-jsx

Because eslint-config-standard-jsx is a dependency of eslint-config-standard-react, it’s marked as ‘unused’. I don’t think that’s right.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
sveyretcommented, Jan 8, 2020

Hi @znarf, I made a pull request (#506) which should correct your issue. Would you please have time to check it?

1reaction
sveyretcommented, Jan 7, 2020

For information, I’ll take the point tomorrow if I can find time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-unused-vars - ESLint - Pluggable JavaScript Linter
This rule is aimed at eliminating unused variables, functions, and function parameters. ... Examples of incorrect code for this rule:.
Read more >
Incorrect unused dependencies in react-ace #414 - GitHub
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity...
Read more >
ESLint with React gives `no-unused-vars` errors
When I run ESLint, the linter returns no-unused-vars errors for each React component. I'm assuming it's not recognizing that I'm using JSX or ......
Read more >
How to Remove Unused Dependencies in React - Pluralsight
This displays a vivid analysis of your packages on the command line and highlights unused packages by marking them as NOTUSED . 1......
Read more >
12 essential ESLint rules for React - LogRocket Blog
Introduction. ESLint has a comprehensive set of rules for JavaScript code that cover stylistic choices and prevent common bugs.
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