Error: /Users/framerate/code/project/server/node_modules/eslint-config-airbnb-base/rules/es6.js: Configuration for rule "prefer-arrow-callback" is invalid: Value "2,[object Object]" has more items than allowed.
Are you guys seeing this, as well?
Apparently there is a minor update to eslint that npm-check must not be catching. Upgrading made it go away.
Meh, it worked for a minute and now:
> ./node_modules/eslint/bin/eslint.js -c ./.eslintrc --ext .jsx --ext .js ./index.js ./lib/
Cannot read property 'value' of undefined
TypeError: Cannot read property 'value' of undefined
at isEnclosedInParens (/Users/framerate/code/project/server/node_modules/eslint/lib/rules/no-return-assign.js:23:21)
Never had this bad luck with this package before! Just documenting here in case anyone else has the same issues.
Are you running eslint.js directly, as opposed to the binary in node_modules/.bin?
@ljharb I run it like this:
./node_modules/eslint/bin/eslint.js -c ./.eslintrc --ext .jsx --ext .js ./index.js ./lib/
Apparently Eslint 2.10.0 has some major issues. See here
@framerate you shouldn't. run it like ./node_modules/.bin/eslint --ext .jsx --ext .js ./index.js ./lib/, or better, in an npm run-script so you can use eslint without the node_modules path.
I use 'npm run lint' script. Is the .bin folder accessible or something that way?
@framerate in that case, you should just be doing eslint --ext .jsx --ext .js ./index.js. You should basically never have to write node_modules anywhere.
Well, lean something new every day :). The local binary will overwrite if it's installed globally too?
yep, npm run sets up the $PATH for you.
@ljharb thanks man. There's a bunch of little things like that I always felt weren't clear as I "grew up" with node/npm :)
This fixed it for me (I think, as I tried SO MANY THINGS!):
npm install [email protected] babel-eslint@6 --save-dev (as prescribed in https://github.com/babel/babel-eslint#install)
I tried the npm install that @lucalanca noted and I'm still receiving the error when running 'npm test'
╰─➤ npm test 1 ↵
> [email protected] test /Users/poloka/dev/orion_mpage_component
> launcher -t
/Users/poloka/dev/orion_mpage_component/node_modules/launcher/node_modules/eslint/lib/config/config-file.js:332
throw e;
^
Error: /Users/poloka/dev/orion_mpage_component/node_modules/eslint-config-airbnb-base/rules/es6.js:
Configuration for rule "prefer-arrow-callback" is invalid:
Value "2,[object Object]" has more items than allowed.
Referenced from: airbnb-base
Referenced from: /Users/poloka/dev/orion_mpage_component/.eslintrc.json
at validateRuleOptions (/Users/poloka/dev/orion_mpage_component/node_modules/launcher/node_modules/eslint/lib/config/config-validator.js:102:15)
at /Users/poloka/dev/orion_mpage_component/node_modules/launcher/node_modules/eslint/lib/config/config-validator.js:148:13
at Array.forEach (native)
at Object.validate (/Users/poloka/dev/orion_mpage_component/node_modules/launcher/node_modules/eslint/lib/config/config-validator.js:147:35)
My dev dependencies are noted as:
"devDependencies": {
"babel-core": "^6.4.0",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.1",
"babel-preset-es2015": "^6.3.13",
"commander": "^2.9.0",
"csslint": "^0.10.0",
"eslint": "^2.11.1",
"eslint-config-airbnb": "^9.0.1",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.8.1",
"eslint-plugin-jsx-a11y": "^1.3.0",
"eslint-plugin-react": "^5.1.1",
"jshint": "^2.9.1",
"less": "^2.6.1",
"less-loader": "^2.2.3",
"less-plugin-clean-css": "^1.5.1",
"matchdep": "^1.0.0",
"prettyjson": "^1.1.3",
"uglify-js": "^2.6.2",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1"
}
What is launcher? Any chance it's running a global eslint binary? If you do npm uninstall -g eslint, and then run the tests, what happens?
launcher is an internally written unit testing framework. I've actually realized that the dependency its pulling for eslint is 1.10.3
├── [email protected]
└─┬ [email protected]
└── [email protected]
So looks like my problem.
So my takeaway from this thread is that ESLint-ing in Sublime Text is broken unless I'm using ESLint>=2.x? Because if so that is bonkers and a huge disappointment. I'm getting the same errors as @poloka above.
Error: /usr/local/lib/node_modules/eslint-config-airbnb/node_modules/eslint-config-airbnb-base/rules/es6.js:
Configuration for rule "prefer-arrow-callback" is invalid:
Value "2,[object Object]" has more items than allowed.
Referenced from: /usr/local/lib/node_modules/eslint-config-airbnb/node_modules/eslint-config-airbnb-base/index.js
Referenced from: airbnb/base
Referenced from: topgolf
Referenced from: /Users/PierceMoore/Code/lager/.eslintrc
at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:102:15)
at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:148:13
at Array.forEach (native)
at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:147:35)
at load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:390:19)
at /usr/local/lib/node_modules/eslint/lib/config/config-file.js:326:36
at Array.reduceRight (native)
at applyExtends (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:309:28)
at load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:395:22)
at /usr/local/lib/node_modules/eslint/lib/config/config-file.js:326:36
λ which eslint
/usr/local/bin/eslint
λ eslint -v
v1.10.3
@rex no, but you shouldn't be running the global eslint. run your local one. Also, eslint v1 is ancient, and the latest version of this config requires eslint v3.
@ljharb Yeah... You're right. I just looked at how long it's been, my team and I are way behind in terms of ESLint version. 1.x really _is_ that far behind. I will hopefully be able to use this as a stimulus in the direction of upgrading. We rely extremely heavily on the work that you Airbnb guys do on this config, like so many others, and I appreciate it :)