Is there an ESLint rule for TypeScript that allows enforcing using space in the following situation?
// good
let a: string | number = 4;
// bad
let a: string|number = 4;
The only stuff that might be helpful are type-annotation-spacing
and space-infix-ops
rules but they do not seem to work with union types.
Seems the rule @typescript-eslint/space-infix-ops
has been recently (May 2021) updated to handle this.
https://github.com/typescript-eslint/typescript-eslint/issues/51 (Not sure why the issue is still open)
Maybe not what you want, but won't eslint-plugin-prettier
do this for you?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With