David Lin
David Lin

Reputation: 13353

Eslint default rules

I have empty rules in my .eslintrc file but I am still getting some error messages like "max-len exceeding 120 characters."

{
  "env": {
    "es6": true,
    "browser": true,
    "node": true
  },
  "rules": {

  },
  "parser": "babel-eslint",
  "plugins": [
    "react"
  ],
  "ecmaFeatures": {
    "jsx": true
  }
}

The documentation says that all rules are disabled by default. I wonder why I am still getting eslint errors without my defining any rules.

  1. I am using eslint version v1.10.3
  2. I can get rid of the errors by explicitly disable the rule "max-len": 0
  3. This is the ONLY configuration file I have in my project folder and I even searched to make sure there isn't even one single word of max-len in my project.

Are all rules disabled by default ? Where did I get the rules (e.g. max-len) from ?

Upvotes: 2

Views: 1290

Answers (1)

Ilya Volodin
Ilya Volodin

Reputation: 11266

ESLint configurations cascade. So given a path to lint, ESLint will go up the directory structure to find config files until it either hits config with root:true or root directory. All the config files that will be found are going to to be merged together. There's a chance that you might have another config file somewhere in your path. In order to test that, you can run ESLint with the --debug flag, which will list all of the config files that are currently being used.

Upvotes: 4

Related Questions