standard / ts-standard

Typescript style guide, linter, and formatter using StandardJS
https://www.npmjs.com/package/ts-standard
MIT License
464 stars 36 forks source link

Spacing around intersections and unions #118

Closed simonseyock closed 3 years ago

simonseyock commented 3 years ago

What version of this package are you using? 10.0.0

What problem do you want to solve? I would like to have consistent spacing around the intersection and union operators of typescript. At the moment all these things are allowed:

type a = string|boolean
type b = string |boolean
type c = string | boolean
type d =
  string
  |boolean
  | number
type e = MyClass&string

What do you think is the correct solution to this problem? I would say the most readable would be to always enforce spaces around the | and &. Especially with the & it gets really messy if there are no spaces.

Are you willing to submit a pull request to implement this change? Not at the moment

theoludwig commented 3 years ago

Thanks for your report! @simonseyock I agree that, we should have consistent spacing around the intersection and union operators of TypeScript. Do you know an eslint rule to do that ?

The rules are defined in this repo : https://github.com/standard/eslint-config-standard-with-typescript So this issue is not related to ts-standard, you should instead post the issue in eslint-config-standard-with-typescript, thanks! :smile: