Lately i was using Eslint w/o Prettier. Now i find it a bit inconvenient, because ESLint alone can't reformat max line length.
Now i'm back to ESLint/Prettier and Stylelint config.
"[vue]":{
"editor.defaultFormatter":"esbenp.prettier-vscode",
"editor.formatOnSave":true
},
"[javascript]":{
"editor.defaultFormatter":"esbenp.prettier-vscode",
"editor.formatOnSave":true
},
"[typescript]":{
"editor.defaultFormatter":"esbenp.prettier-vscode",
"editor.formatOnSave":true
}
Formatting Vue, JS, TS files with ESLint + Prettier.
"editor.codeActionsOnSave":{
"source.organizeImports":false,
"source.fixAll.eslint":true,
"source.fixAll.stylelint":true
}
Automatic code fixes with the help of ESLint + Stylelint.
"scss.validate": false,
"css.validate": false,
"less.validate": false,
Turning off default CSS formatting and various preprocessors (now its handled by Stylelint).
"stylelint.validate": [
"css",
"less",
"postcss",
"scss",
"vue"
]
npm i -D prettier eslint-config-prettier
Then in your .eslintrc or .eslintrc.cjs:
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'prettier'
],
.prettierrc contents:
{
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
Short answer: use eslint-config-prettier Here's the long answer: on StackOverflow