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 tries to add space around union type separator #202

Closed
simPod opened this issue Sep 10, 2021 · 3 comments
Closed

Prettier tries to add space around union type separator #202

simPod opened this issue Sep 10, 2021 · 3 comments

Comments

@simPod
Copy link

simPod commented Sep 10, 2021

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
Copy link
Member

lydell commented Sep 10, 2021

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
Copy link
Author

simPod commented Sep 10, 2021

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
Copy link
Member

lydell commented Sep 10, 2021

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!

@simPod simPod closed this as completed Sep 10, 2021
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

2 participants