Reputation: 490
I see 2 options to set Eslint as my default formatted and I'm not sure on the difference between these options:
"editor.defaultFormatter": "esbenp.prettier-vscode"
or"eslint.format.enable": true
What is the difference between these 2 settings?
Upvotes: 11
Views: 25532
Reputation: 5408
Also don't forget to comment out prettier.configPath:
// Comment out or remove this line
// "prettier.configPath": ".prettierrc.json",
"prettier.enable": false,
Upvotes: 0
Reputation: 688
You can put this into .vscode/settings.json
:
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll": "never"
},
"eslint.format.enable": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"prettier.enable": false
}
What this config does:
source.fixall
Upvotes: 7
Reputation: 1549
"eslint.format.enable": true
basically tells VSCode to use ESlint as a formatter for files that are validated by ESLint and to make sure it always uses your default favourite Prettier formatter, you use "editor.defaultFormatter": "esbenp.prettier-vscode"
as there can be multiple formatters installed.
Upvotes: 8