prettier/prettier-eslint

prettier-eslint doesn't respect prettier default

AdrienLemaire opened this issue · 6 comments

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.

Stale issue

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!

Stale issue

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.... 😕

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