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

'npm run eslint' fails: eslint package and plugins needs revision #649

Closed
1000miles opened this issue Aug 24, 2017 · 4 comments
Closed

'npm run eslint' fails: eslint package and plugins needs revision #649

1000miles opened this issue Aug 24, 2017 · 4 comments

Comments

@1000miles
Copy link
Collaborator

1000miles commented Aug 24, 2017

The script 'eslint app/assets/javascripts' needs a revision. A couple of deprecated warnings and errors (e.g. Error: Cannot find module 'xyz') are happening at the moment.

EXAMPLE:

After adding

// app/assets/javascripts/NewNodeWidget/reducers/__tests__/widget.js

import { Map, List } from 'immutable';
import expect from 'expect';
import expectImmutable from 'expect-immutable';

which fixed the original issue mentioned here we now get following error:

➜  /vagrant git:(fix/npm-expect-immutable-error) npm run eslint

> wheelmap@1.0.0 eslint /vagrant
> eslint app/assets/javascripts

Cannot find module 'doctrine'
Referenced from: /vagrant/node_modules/eslint-config-blogfoster/react.js
Referenced from: /vagrant/.eslintrc
Error: Cannot find module 'doctrine'
Referenced from: /vagrant/node_modules/eslint-config-blogfoster/react.js
Referenced from: /vagrant/.eslintrc
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/eslint-plugin-react/lib/util/Components.js:9:18)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wheelmap@1.0.0 eslint: `eslint app/assets/javascripts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wheelmap@1.0.0 eslint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
//  `~/.eslintrc`

{
  "extends": "blogfoster/react",
  "env": {
    "jest": true,
    "jasmine": true,
    "jquery": true
  },
  "globals": {
    "Routes": true,
    "I18n": true
  },
  "rules": {
    "no-constant-condition": [
      "error", { "checkLoops": false }
    ],
    "arrow-parens": ["error", "as-needed"],
    "arrow-body-style": ["error"],
    "no-useless-rename": ["error"],
    "import/order": [
      "error", { "newlines-between": "always" }
    ],
    "import/newline-after-import": [
      "error"
    ],
    "react/jsx-filename-extension": "off"
  }
}

Maybe related:

@1000miles 1000miles added the bug label Aug 24, 2017
@ghost ghost added this to the August 2017 Sprint 2 of 2 milestone Aug 28, 2017
@1000miles
Copy link
Collaborator Author

Update, 2017-08-28

We seem to face a few breaking changes, probably related to eslint/eslint plugins and their recent release updates. To reproduce the same error as the last Travis build we installed the same npm (v3.8.6) and node (v5.12.0) versions and this our local error output:

# ➜  /vagrant git:(fix/npm-expect-immutable-error) ✗ npm run eslint

> wheelmap@1.0.0 eslint /vagrant
> eslint app/assets/javascripts

/vagrant/node_modules/eslint-config-blogfoster/node_modules/eslint-config-airbnb/rules/react-a11y.js:
	Configuration for rule "jsx-a11y/anchor-has-content" is invalid:
	Value "[object Object]" no (or more than one) schemas match.

Referenced from: eslint-config-airbnb
Referenced from: blogfoster/react
Referenced from: /vagrant/.eslintrc
Error: /vagrant/node_modules/eslint-config-blogfoster/node_modules/eslint-config-airbnb/rules/react-a11y.js:
	Configuration for rule "jsx-a11y/anchor-has-content" is invalid:
	Value "[object Object]" no (or more than one) schemas match.

Referenced from: eslint-config-airbnb
Referenced from: blogfoster/react
Referenced from: /vagrant/.eslintrc
    at validateRuleOptions (/vagrant/node_modules/eslint/lib/config/config-validator.js:109:15)
    at /vagrant/node_modules/eslint/lib/config/config-validator.js:156:13
    at Array.forEach (native)
    at Object.validate (/vagrant/node_modules/eslint/lib/config/config-validator.js:155:35)
    at load (/vagrant/node_modules/eslint/lib/config/config-file.js:559:19)
    at /vagrant/node_modules/eslint/lib/config/config-file.js:424:36
    at Array.reduceRight (native)
    at applyExtends (/vagrant/node_modules/eslint/lib/config/config-file.js:408:28)
    at load (/vagrant/node_modules/eslint/lib/config/config-file.js:566:22)
    at /vagrant/node_modules/eslint/lib/config/config-file.js:424:36

npm ERR! Linux 4.4.0-92-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "eslint"
npm ERR! node v5.12.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! wheelmap@1.0.0 eslint: `eslint app/assets/javascripts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wheelmap@1.0.0 eslint script 'eslint app/assets/javascripts'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the wheelmap package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     eslint app/assets/javascripts
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs wheelmap
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls wheelmap
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /vagrant/npm-debug.log

According to our package.json file we are currently using:

 "devDependencies": {
    "babel-jest": "^12.1.0",
    "eslint": "^3.3.1",
    "eslint-config-blogfoster": "^1.3.2",
    "eslint-plugin-import": "^1.9.2",
    "eslint-plugin-jsx-a11y": "^2.1.0",
    ...
  }

Probably these packages need a revision and need to be pinned?

  • eslint-config-blogfoster
    • babel-eslint
    • eslint-config-airbnb
    • eslint-plugin-import
    • eslint-plugin-jsx-a11y
    • eslint-plugin-react
# ➜  /vagrant git:(fix/npm-expect-immutable-error) ✗ npm outdated

Package                  Current  Wanted      Latest  Location

eslint                    3.19.0  3.19.0       4.5.0  wheelmap
eslint-config-airbnb      14.1.0  14.1.0      15.1.0  wheelmap
eslint-plugin-import      1.16.0  1.16.0       2.7.0  wheelmap
eslint-plugin-jsx-a11y     2.2.3   2.2.3       6.0.2  wheelmap
...

@opyh Can you help here? :) cc @holgerd @anngreenberg

@holgerd
Copy link
Member

holgerd commented Aug 28, 2017

@emig can you help here?

@opyh
Copy link
Member

opyh commented Aug 28, 2017

That's a typical problem with the ESLint AirBnB configuration because the ESLint configuration format changed several times in the past.

It happens when the used AirBnB ESLint configuration is not compatible with the used ESLint config format version. To solve,

  • remove the packages from package.json
  • reinstall them with this multiline shell command:
    (
    export PKG=eslint-config-airbnb;
    npm info "$PKG@latest" peerDependencies --json | command sed 's/[{},]//g ; s/: /@/g' | xargs
    npm install --save-dev "$PKG@latest"
    )

This should update ESLint/airbnb and solve the problem. It might be that this process creates new linter errors in the JS code that you have to fix afterwards.

@1000miles
Copy link
Collaborator Author

Fixed with PR #650.

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

No branches or pull requests

3 participants