How to extend airbnb eslint but with warnings instead of errors?

Vic picture Vic · Oct 2, 2017 · Viewed 7.3k times · Source

I'm using airbnb's eslint with webpack like this:

.eslintrc:

{
  "extends": "airbnb"
}

webpack.config.js:

...
module: {
  rules: [
    {
      test: /\.js$/,
      use: ['babel-loader', 'eslint-loader'],
      include: path.join(__dirname, 'src')
    },
    ...
  ]
}
...

This works, but all the eslint rules show up as errors, eg:

1:28   error  Missing semicolon                             semi
2:45   error  Missing semicolon                             semi
5:7    error  Unexpected space before function parentheses  space-before-function-paren

How can I set it up so that all the rules from airbnb's eslint are warnings instead of errors?

Answer

Oles Savluk picture Oles Savluk · Oct 2, 2017

Approach #1 adjust specific rules in .eslintrc:

{
  "extends": "airbnb"
  "rules": {
    "camelcase": "warn",
    ...
  }
} 

see Configuring Rules

Approach #2 adjust eslint-loader to emit warnings instead of errors for all rules:

{
  ...
  loader: "eslint-loader",
  options: {
    emitWarning: true,
  }
}

see Errors and Warning