prettier-eslint doesn't respect prettier default
See original GitHub issuefrom inferring prettierOptions via eslintConfig:
Defaults if you have all of the relevant ESLint rules disabled (or have ESLint disabled entirely via /* eslint-disable */ then prettier options will fall back to the prettier defaults:
{
trailingComma: 'none',
}
Prettier Trailing Commas:
Default value changed from none to es5 in v2.0.0 “es5” - Trailing commas where valid in ES5 (objects, arrays, etc.)
As a result, When I save my file, prettier-eslint removes a trailing commas, and when I git commit my code, the pre-commit prettier hook fails and re-add the trailing comma.
Fixed by adding .prettierrc
:
trailingComma: "es5"
It took me a while to figure out, just because I assumed the plugin respected prettier’s default.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Prettier doesn't format based on my eslint config - Stack Overflow
1 Answer 1 · Open command pallette ctrl+shift+p ; · Select Format Document With... ; · Select Configure Document With... ; · Select...
Read more >Integrating with Linters - Prettier
Linters usually contain not only code quality rules, but also stylistic rules. Most stylistic rules are unnecessary when using Prettier, but worse –...
Read more >How to use Prettier with ESLint - Robin Wieruch
In this brief setup guide, I want to show you how to combine Prettier with ESLint without wasting any tear.
Read more >How to make ESLint work with Prettier avoiding conflicts and ...
ESLint is a JavaScript linting utility which performs static analysis in order to find problematic patterns or code that doesn't adhere to ...
Read more >How to use Prettier with ESLint and TypeScript in VSCode
Prettier can be configured to format your code (makes it look prettier ) after you save a file or manually tell it to,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To explain: it did and we fully intend on doing so again.
Prettier changed the defaults and we just never updated it here.
Should be a very simple PR!
close in favor of #334