eslint-config-prettier npm package compromised
Prettier doesn't format based on my eslint config
What eslint prettier config do u use?
Heres the tooling/linting/formatting guide I wrote for the company I work for...
https://signal-noise.github.io/rfcs/text/0002-tooling-linting-formatting
May be marginally out-of-date.
More on reddit.comMalware published in eslint-config-prettier and other packages
Videos
» npm install eslint-config-prettier
» npm install eslint-plugin-prettier
- Install eslint:
npm i --save-dev eslint - Init eslint:
For some options you need choose next:npx eslint --init- How would you like to use ESLint?
- To check syntax and find problems
- What format do you want your config file to be in?
- JavaScript
- Install prettier:
npm i --save-dev eslint-config-prettier eslint-plugin-prettier prettier - Create
.prettierrcconfig file:{ "printWidth": 80, "singleQuote": true, "trailingComma": "es5" }
At now you can check style with eslint and fix style with prettier from comand line.
For VSCode integration with eslint and prettier you need to install one of:
- esbenp.prettier-vscode.
- dbaeumer.vscode-eslint;
After that you need to set this extension as default formatter:
- Open command pallette
ctrl+shift+p; - Select
Format Document With...; - Select
Configure Document With...; - Select
Prettier - Code FormatterorESLintbased on your preferences.
Now, eslint will work as linter and prettier as formatter:
VSCode problem tab:

eslint output

If I save file all prettier problems will be fixed (Autoformat on save should be turned on)
Eslint plugin does not apply automatically changes in settings located in
.prettierrc. See issue on github. To fix this you can:
- move
.prettierrccontent in .eslint (not recommended because prettier plugins sometimes do not read this file);- run from command pallette in VSCode
ESLint: Restart ESLint serverafter edit .prettierrcfile.
in eslint config, change
extends: ["prettier"],
to
extends: ['plugin:prettier/recommended'],