Colin Wang
Colin Wang

Reputation: 6968

Eslint gives error: Configuration for rule "strict" is invalid: Value "error" is the wrong type

I tried to use Eslint with the following option:

{
  "rules": {
    "indent": [
      2,
      2,
      {
        "SwitchCase": 1
      }
    ],
    "space-before-function-paren": [
      2,
      {
        "anonymous": "always",
        "named": "never"
      }
    ],
    "no-use-before-define": [
      2,
      "nofunc"
    ],
    // TODO: turn on later
    "comma-dangle": [
      0
    ],
    "prefer-template": 0
  },
  "env": {
    "node": true,
    "mocha": true
  },
  "extends": [
    "eslint:recommended",
    "airbnb/base"
  ]
}

And I am getting the error:

Error: ... ... /node_modules/eslint-config-airbnb-base/index.js: Configuration for rule "strict" is invalid: Value "error" is the wrong type.

Referenced from: airbnb/base

I think that this value: 'error' is causing the error.

eslint-config-airbnb-base/rules/strict.js

module.exports = {
  rules: {
    // babel inserts `'use strict';` for us
    strict: ['error', 'never']
  }
};

How can I resolve this error?

Upvotes: 1

Views: 2725

Answers (2)

ton
ton

Reputation: 4577

If you don't have the eslint resource file .eslintrc.json in your project root with the "rules.semi" set, you can also have this problem.

This sample resource file can fix the error

$ cat .eslintrc.json 
{
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "module",
        "ecmaFeatures": {
            "jsx": true
        }
    },
    "rules": {
        "semi": "error"
    }
}

Upvotes: 0

cartant
cartant

Reputation: 58400

Severity configuration strings ("off", "warn" and "error") were introduced in version 2.3.0 of ESLint. Upgrading to that - or a later - version should fix your problem.

Upvotes: 1

Related Questions