prettier / eslint-config-prettier

Turns off all rules that are unnecessary or might conflict with Prettier.
MIT License
5.39k stars 255 forks source link

Prettier tries to add space around union type separator #202

Closed simPod closed 2 years ago

simPod commented 2 years ago

In #164 the @typescript-eslint/space-infix-ops rule was disabled. But prettier still tries to add spaces around union separator in my ts types:

interface I {
-  a: string|number;
+  b: string | number;
}

Is that a bug or intended behaviour and is there a way to disable it?

lydell commented 2 years ago

Hi! Prettier works the way it does and generally cannot be configured. This config turns off all ESLint rules that disagree with Prettier’s formatting, letting Prettier decide (since it cannot be configured). So this is working as intended from the point of view of eslint-config-prettier.

If you really care about those spaces not being there, you could try prettier-eslint, though I wouldn’t recommend it.

simPod commented 2 years ago

Thank you for response. So the rule is disabled and the behaviour is then hardcoded in prettier -> resulting in spaces being added?

And why wouldn't you recommend it?

lydell commented 2 years ago

So the rule is disabled and the behaviour is then hardcoded in prettier -> resulting in spaces being added?

Correct!

And why wouldn't you recommend it?

Because it’s slower and used to be a bit undermaintained. But feel free to try it!