How I can get a warning instead of an error while using ESLint?
I use ESLint 6.7.2
version with a plugin for babel and react.
This is my actual .eslintrc.json
:
{
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
},
"settings": {
"react" : {
"version": "16.7.0"
}
},
"parser": "babel-eslint"
}
I've found the answer:
It enough to add a rule for no-unused-vars
:
"rules": {
"no-unused-vars": "warn"
},
You can use warn
, error
or off
to disable warnings.
Also, restart the server.