Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prettier-eslint doesn't respect prettier default #349

Closed
AdrienLemaire opened this issue May 28, 2020 · 6 comments
Closed

prettier-eslint doesn't respect prettier default #349

AdrienLemaire opened this issue May 28, 2020 · 6 comments

Comments

@AdrienLemaire
Copy link

AdrienLemaire commented May 28, 2020

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.

@github-actions
Copy link
Contributor

Stale issue

@kylemh
Copy link
Collaborator

kylemh commented Jul 31, 2020

Definitely worth a fix, since the default value changed in v2.

Obviously, not a huge priority cuz you can just create a .prettierrc to get what you want!

@github-actions
Copy link
Contributor

Stale issue

@lougreenwood
Copy link

I just hit this problem too, but only after upgrading to Prettier V2. Because es5 trailing commas is now default in prettier, I removed it from my .prettierrc and later noticed that trailing commas were being removed.

It was quite annoying to notice that trailing commas were sneaking back into the codebase and took a while to figure out that the problem is that this plugin is the cause.

Generally, it seems very strange that prettier-eslint doesn't use prettier defaults.... 😕

@kylemh
Copy link
Collaborator

kylemh commented 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!

@JounQin
Copy link
Member

JounQin commented Aug 15, 2022

close in favor of #334

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants