question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

prettier-eslint doesn't respect prettier default

See original GitHub issue

from 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:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kylemhcommented, Nov 11, 2020

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!

0reactions
JounQincommented, Aug 15, 2022

close in favor of #334

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found