eslint-config-standard: Error while running ESLint

screen shot 2561-03-08 at 23 42 19

So I’ve been using create-react-app and decided to install eslint-config-standard by:

yarn add eslint-config-standard eslint-plugin-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-node --dev

And here is my .eslintrc

{
  "extends": "standard"
}

Any help?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 16 (3 by maintainers)

Most upvoted comments

You need to update ESLint to the latest version.

npm install eslint@latest

@MarkLunney I would double check that you aren’t running a globally-installed eslint by accident, and that if you do run a global version, that it’s also updated:

npm install eslint@latest -g

FYI, I got a similar error when trying to add "allowSeparatedGroups": true option to sort-imports:

Error: .eslintrc.json:
	Configuration for rule "sort-imports" is invalid:
	Value {"allowSeparatedGroups":true,"ignoreCase":true,"ignoreDeclarationSort":false,"ignoreMemberSort":false} should NOT have additional properties.

Turned out that it was only added recently in version 7.5.0 and I was still on 6.8.0.

If you run into a similar error, check your ESLint version and when certain options may have been added.

Hi,

I’m still receiving this error after updating all of my dependencies. Anything I might’ve missed?

[Error - 16:36:40] /Users/mark.lunney/Documents/react-component-library/node_modules/eslint-config-standard/index.js: Configuration for rule “indent” is invalid: Value “[object Object]” should NOT have additional properties. Referenced from: /Users/mark.lunney/Documents/react-component-library/.eslintrc

package.json:

    "eslint": "^4.18.2",
    "eslint-config-standard": "^11.0.0",
    "eslint-config-standard-react": "^6.0.0",
    "eslint-plugin-import": "^2.9.0",
    "eslint-plugin-node": "^6.0.1",
    "eslint-plugin-promise": "^3.7.0",
    "eslint-plugin-react": "^7.7.0",
    "eslint-plugin-standard": "^3.0.1",

eslintrc:

{
  "parser": "babel-eslint",
  "extends": [
    "standard",
    "standard-react"
  ],
  "env": {
    "es6": true,
    "jest": true
  },
  "plugins": [
    "react"
  ],
  "parserOptions": {
    "sourceType": "module",
    "allowImportExportEverywhere": true
  },
  "rules": {
    "no-case-declarations" : 1,
    "react/jsx-no-bind": [1, {}],
    "space-before-function-paren": 0,
    "react/jsx-boolean-value": 0,
    "import/first": 0
  }
}

Would be nice for the documentation to indicate when options were added (if added later than the rule). Only saying when the rule was added surely leads to lots of head scratching and extra time searching through release notes or Git history.

Hahaha sorry about that

IT WORKS 😃 THANK YOU!!!

I really appreciate your help.

Best,

Harry

~With create-react-app 1.x, if you npm i eslint@latest you run into this https://github.com/standard/eslint-config-standard-react/issues/48~

~Reverting https://github.com/standard/eslint-config-standard/commit/5ad91a8ffa5ae064c52e78c06cef4c2fda5a8cba fixes it.~

~Alternatively, npm i -D eslint-config-standard@10.2.1 will fix it.~


~All this to say, if you want Standard + CRA, then you need to downgrade that indent rule until CRA supports eslint@5+.~


https://github.com/standard/eslint-config-standard-react/issues/48 is fixed in https://github.com/standard/eslint-config-standard-react/pull/49 so yarn add eslint@5 should work. 👍

If you’re using CRA + react-app-rewired (rewire-ESLint), then you’ll have 2 versions of ESLint (4 from CRA and the 5 you manually installed). Fix this with Yarn resolutions or you’ll get random weird linting errors.

Example rewired package.json with a ton of Standard stuff:

{
  "name": "foo",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.4.2",
    "react-dom": "^16.4.2",
    "react-scripts": "1.1.5"
  },
  "scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test --env=jsdom",
    "eject": "react-app-rewired eject"
  },
  "devDependencies": {
    "eslint-config-tonz-of-standard-and-react-stuff": "^1.0.0", // not a real config
    "react-app-rewire-eslint": "^0.2.3",
    "react-app-rewired": "^1.5.2"
  },
  "resolutions": {
    "eslint": "*" // this will always use the latest installed eslint instead of CRA's crappy eslint@4.
  },
  "eslintConfig": {
    "extends": "tonz-of-standard-and-react-stuff"
  }
}

FYI, I just released ESLint 5 versions of all the standard packages just now. So you can go all in on ESLint 5 if you wish to, or stay locked to the ESLint 4 versions, up to you.