ESLint plugin issue when using yarn (but works w/ NPM)
See original GitHub issueTell 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 dependencyeslint-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:
- Created 6 years ago
- Reactions:4
- Comments:24 (7 by maintainers)
Top GitHub Comments
The fix is ready and will be released in Yarn 0.26 and a patch of 0.25. This issue can be closed now
Raised https://github.com/yarnpkg/yarn/issues/3535