brodycj / prettierx

a less opinionated fork of Prettier code formatter
MIT License
209 stars 22 forks source link

Fix spacing for TS trick in TSX to define generics #107

Open havenchyk opened 4 years ago

havenchyk commented 4 years ago

There is a trick how to force parser to think it's a generic and not TSX code in .tsx file https://github.com/typescript-eslint/typescript-eslint/issues/1457

prettierx removes space after comma at <T,>: const MyComponent = <T, >({x, y, z}: Props<T>) => {…}, eslint standard config on the other hand expects this space.

Probably it can be an issue at prettier-standard instead, but I don't see an option to configure having this space only for generics

brodycj commented 4 years ago

Thanks. I think this should also be tracked on prettier-standard.

According to https://github.com/microsoft/TypeScript/issues/15713#issuecomment-353646045, that trick should not be needed on Babylon (Babel) or Flow parsers. I am actually planning to switch prettierx to use Babel's parser for TypeScript by default (see #54) once they are finished with prettier/prettier#6400.

havenchyk commented 4 years ago

this one is done actually prettier/prettier#6400