How do I create a Vue 2 project that uses ESLint + StandardJS + Prettier?
StandardJS's rules should naturally take precedence over Prettier's.
vue create only provides the following options:
I tried 2 things:
I'm of course looking to set this up at the project config level and not at the IDE level.
Can you try this repo I've just created? Looks like it's working great from what I've tested.
https://github.com/kissu/so-eslint-standard-prettier-config
standard
one into the Prettier
one, the changes can be seen in this commit@vue/eslint-config-standard
is throwing an error (Environment key "es2021" is unknown
) because it requires ESlint 7 to work, as shown in this changelog7.29.0
, fixed the issuenpx eslint --version
I've tried to remove @vue/prettier
from
extends: ['plugin:vue/essential', 'eslint:recommended', '@vue/standard', '@vue/prettier']
and see if it's successfully removes any ;
and it does!
The errors are indeed coming from ESlint (if we do remove @vue/prettier
), and they're fixed by ESlint only upon save (after an ESlint server + VScode restart)!
Putting Prettier
back works fine of course.
Luckly, I had a new PC, hence had the opportunity to try a whole fresh config with VScode.
I had to install ESlint only and have those settings into my settings.json
{
"editor.codeActionsOnSave": {
"source.organizeImports": false,
"source.fixAll": true,
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
}
}
The formatting works perfectly and nothing more is required.