===================
Install ESLint either locally or globally.
$ npm install eslint --save-devIf you installed ESLint, Otherwise, install it locally.
$ npm install eslint-config-anb --save-devUse to get reasonable defaults:
module.exports = {
"extends": "anb",
"rules": {
},
"env": {
}
} module.exports = {
"extends": "anb/react",
"rules": {
},
"env": {
}
} module.exports = {
"extends": "anb/vue",
"rules": {
},
"env": {
}
}Why Use babel-eslint
You only need to use babel-eslint if you are using types (Flow) or experimental features not supported in ESLint itself yet. Otherwise try the default parser (you don't have to use it just because you are using Babel).
use anb/vue What is the "Use the latest vue-eslint-parser" error? eslint-plugin-vue
The most rules of eslint-plugin-vue require vue-eslint-parser to check ASTs.
Make sure you have one of the following settings in your .eslintrc*:
"extends": ["plugin:vue/recommended"]
"extends": ["plugin:vue/base"]
If you already use other parser (e.g. "parser": "babel-eslint"), please move it into parserOptions, so it doesn't collide with the vue-eslint-parser used by this plugin's configuration:
- "parser": "babel-eslint"
VSCode targets only JavaScript or HTML files by default. You have to add {"autoFix": true, "language": "vue"} into eslint.validate entry. This works for me after I install the Vetur extension which adds the vue language mode and adding this to the settings.
"eslint.validate": [
"javascript",
"javascriptreact",
"vue",
{
"language": "vue",
"autoFix": true
}
]