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

[space-infix-ops] prevent adding a space to union types #3590

Closed
3 tasks done
simPod opened this issue Jun 28, 2021 · 3 comments
Closed
3 tasks done

[space-infix-ops] prevent adding a space to union types #3590

simPod opened this issue Jun 28, 2021 · 3 comments
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin question Questions! (i.e. not a bug / enhancment / documentation)

Comments

@simPod
Copy link

simPod commented Jun 28, 2021

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

How can I disable this rule from adding a space to my union types? There seems to be no config for it. Introduced here #3360

Repro

{
  "rules": {
    "@typescript-eslint/space-infix-ops": "error"
  }
}
(a: Date|null = null) {}

Expected Result

Code should be fine

Actual Result

Operator '|' must be spaced @typescript-eslint/space-infix-ops

Additional Info

How can I disable this rule from modifying my types? I want only space around | when it's not type definition.

Versions

package version
@typescript-eslint/eslint-plugin 4.28.0
@typescript-eslint/parser 4.28.0
TypeScript 4.3.4
ESLint 7.29.0
node 16
@simPod simPod added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jun 28, 2021
@bradzacher
Copy link
Member

Don't use our version then and just use the original ESLint version.

@bradzacher bradzacher added question Questions! (i.e. not a bug / enhancment / documentation) and removed triage Waiting for maintainers to take a look labels Jun 28, 2021
@simPod
Copy link
Author

simPod commented Jun 28, 2021

Why not make it configurable?

@bradzacher
Copy link
Member

It's as configurable as the base rule

https://eslint.org/docs/rules/space-infix-ops

Which is to say not at all.
Everyone has a preference and it's not worth the time and effort adding preferences to minutely configure every single stylistic lint rule.

https://eslint.org/blog/2020/05/changes-to-rules-policies

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin question Questions! (i.e. not a bug / enhancment / documentation)
Projects
None yet
Development

No branches or pull requests

2 participants