eslint
for code quality.prettier
for code formatting.editorconfig
for sharing editor configuration among team.Order of override:
editorconfig
>prettier
>eslint
eslint
npm install -g eslint
prettier
npm install --save-dev prettier
eslint
rules that might conflict with prettier
npm install eslint-config-prettier --save-dev
prettier
command with eslint
npm install eslint-plugin-prettier --save-dev
npm install --save-dev eslint-plugin-vue
eslint
.eslintrc.js
module.exports = exports = {
"extends": [
"plugin:vue/recommended",
"eslint:recommended",
"prettier",
"prettier/vue"
],
"env": {
"es6": true,
"node": true,
"browser": true,
"jquery": true
},
"rules": {
"prettier/prettier": "error"
},
"plugins": ["prettier"]
};
prettier
configuration will override/disable any prior configuration in the extends array.prettier
in plugins arrayextends
order matters, last overrides previous..prettierrc
.prettier
.prettierrc
{
"semi": true,
"singleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false
}
editorconfig
.editorconfig
[*]
end_of_line = lf
charset = utf-8
indent_style = tab
tab_width = 2
max_line_length = 80
editorconfig
overwrites certain attributes in prettier
"endOfLine"
"useTabs"
"tabWidth"
"printWidth"