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 plugin issue when using yarn (but works w/ NPM)

See original GitHub issue

Tell us about your environment

  • ESLint Version: 3.19.0
  • Node Version: 6.6.0
  • npm Version: 3.10.3
  • yarn Version: 0.23.4

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

The package.json has these modules (which support eslint) in devDependencies:

"eslint": "^3.19.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-config-react-app": "^0.6.2",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.10.3",
"react-scripts": "0.9.5"

My .eslintrc:

{
  "extends": [
    "react-app",
    "airbnb-base",
    "plugin:jsx-a11y/recommended"
  ],
  "rules": {
    "comma-dangle": 0,
    "no-console": 0, // allow console.log statements
    "no-underscore-dangle": ["error", { "allow": ["_id"] }], // because mongo
    "no-unused-vars": [ "error", { "args": "none" } ], // don't check function arguments
    "no-plusplus": ["error", { "allowForLoopAfterthoughts": true }], // allow ++ in for loop expression
    "import/no-extraneous-dependencies": ["error", {"devDependencies": ["src/helpers/*.js"]}] // don't check helpers for extraneous deps
  }
}

What did you do? Please include the actual source code causing the issue.

Ran eslint after using yarn to install my project (instead of npm): node_modules/.bin/eslint src/*

What did you expect to happen?

No linter errors.

What actually happened? Please include the actual, raw output from ESLint.

Many files (maybe all js files?) had an error like this:

/Users/cmoesel/dev/my_project/src/App.js
  2:1  error  Definition for rule 'import/no-named-default' was not found  import/no-named-default

In addition, one file had the error above plus some other errors that I thought were disabled by the config:

/Users/cmoesel/dev/my_project/src/helpers/test_helpers.js
  1:1  error  Definition for rule 'import/no-named-default' was not found                                      import/no-named-default
  2:1  error  'react-dnd-test-backend' should be listed in the project's dependencies, not devDependencies     import/no-extraneous-dependencies
  4:1  error  'enzyme' should be listed in the project's dependencies, not devDependencies                     import/no-extraneous-dependencies
  5:1  error  'react-router-test-context' should be listed in the project's dependencies, not devDependencies  import/no-extraneous-dependencies

This works if I npm install my project instead of yarn install. I’m not sure what’s going on, but it’s worth noting that:

  • The missing rule ('import/no-named-default') was introduced in eslint-plugin-import v2.2.0
  • react-scripts specifies "eslint-plugin-import" : "2.0.1" as a dependency
  • eslint-config-airbnb specifies "eslint-plugin-import" : "^2.2.0" as a peerDependency
  • My project specifies "eslint-plugin-import" : "^2.2.0" as a devDependency to satisfy that peerDependency.

If there’s something wrong with the way we have this configured, please let me know! I’ve also submitted an issue to yarn in case it is a bug in yarn (yarnpkg/yarn/issues/3332).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:24 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
bestandercommented, May 31, 2017

The fix is ready and will be released in Yarn 0.26 and a patch of 0.25. This issue can be closed now

2reactions
bestandercommented, May 30, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-plugin-react | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
ESLint with Prettier issues on Yarn global install - Stack Overflow
It appears to be an issue with the newest version of eslint, mine was 4.2.0. To fix this I: run: Yarn remove eslint...
Read more >
eslint-plugin-prettier - npm
Runs Prettier as an ESLint rule and reports differences as individual ESLint issues. If your desired formatting does not match Prettier's output ...
Read more >
Working with Plugins - 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 >
User Guide | eslint-plugin-vue
Official ESLint plugin for Vue.js. ... Via yarn: bash yarn add -D eslint ... If you have issues with these, please also refer...
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