Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive: eslint-config-prettier #330

Closed
tinymachine opened this issue Mar 13, 2019 · 2 comments · Fixed by #464
Closed

False positive: eslint-config-prettier #330

tinymachine opened this issue Mar 13, 2019 · 2 comments · Fixed by #464

Comments

@tinymachine
Copy link

Bug Description

This might be too much to expect depcheck to handle, but eslint-config-prettier is used by eslint-plugin-prettier when the ESLint config includes{ "extends": ["plugin:prettier/recommended"] }, even though eslint-plugin-prettier's package.json only includes eslint-config-prettier as a dev dependency. (See Prettier's documentation on integrating with ESLint.) When running depcheck --specials=eslint, though, eslint-config-prettier is listed as an unused dev dependency, though it is actually a dev dependency.

(This seems different than #316 where the issue was eslintConfig not being honored in the package.json.)

Code snippets

Where the dependency is used:

// .eslintrc.js
module.exports = {
  "extends": [
    "eslint:recommended",
    "plugin:prettier/recommended"
  ],
  "plugins": [
    "prettier"
  ],
  "env": {
    "browser": true,
    "node": true
  }
}

Where the dependency is listed in package.json:

"devDependencies": {
    "@babel/core": "^7.3.4",
    "@babel/preset-env": "^7.3.4",
    "autoprefixer": "^6.7.7",
    "eslint": "^5.14.1",
    "eslint-config-prettier": "^4.1.0",
    "eslint-plugin-prettier": "^3.0.1",
    "grunt": "^1.0.3",
    "grunt-babel": "^8.0.0",
    "grunt-contrib-nodeunit": "~0.4.1",
    "grunt-contrib-uglify": "^4.0.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-reload": "^0.2.0",
    "prettier": "^1.16.4"
}

Versions

  • node -v: v8.12.0
  • npm -v: 6.4.1
  • depcheck --version: 0.7.2

Extra info

Here's the output of depcheck --json --specials=eslint (with the "using" paths obscured):

{"dependencies":[],"devDependencies":["@babel/preset-env","autoprefixer","eslint-config-prettier","grunt-contrib-nodeunit","grunt-reload"],"missing":{},"using":{"eslint-plugin-prettier":[".../.eslintrc.js"],"eslint":[".../.eslintrc.js"],"prettier":[".../.eslintrc.js"],"grunt-babel":[".../gruntfile.js"],"grunt-contrib-watch":[".../gruntfile.js"],"grunt-contrib-uglify":[".../gruntfile.js"],"@babel/core":[".../gruntfile.js"],"grunt":[".../gruntfile.js"]},"invalidFiles":{},"invalidDirs":{}}

Thanks for any help you can provide, and for your work on this package.

@stale
Copy link

stale bot commented Nov 2, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 2, 2019
@VincentLanglet
Copy link
Contributor

This is still a bug @rumpl, I can't add prettier because of it (#463)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants