1
votes

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?

2

2 Answers

1
votes

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.

0
votes

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"
    }
}