GraphQL: Add support for union types#2014
Conversation
|
Could you steal the implementation of flow union types? |
|
Ho yes of course ! I'look tomorrow (Paris timezone :)) |
|
By the way, we try to use 80 column rule instead of some arbitrary things like: if more than 2 then break. It usually works a lot better for the majority of use cases |
|
@vjeux Ok so I remove the arbitrary breaks and inspired heavily on flow type annotation but it's much simpler :) |
| union myUnion = ATypeName | ASecondTypeName | ||
|
|
||
| union tooLongNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee = | ||
| A |
There was a problem hiding this comment.
doesn't graphql support leading |?
There was a problem hiding this comment.
It doesn't yet. I opened a PR on graphql to see if this can land :)
| | I | ||
| | J | ||
| | K | ||
| | L |
There was a problem hiding this comment.
should there be a ; at the end?
There was a problem hiding this comment.
Semicolons are not supported.
| } | ||
|
|
||
| case "UnionTypeDefinition": { | ||
| const code = concat([ |
There was a problem hiding this comment.
please just inline this, you don't really need a local variable :)
|
Thanks! Just asked a few questions, but it looks good :) |
787ae04 to
921f82d
Compare
|
@vjeux Should be good now ;) Is there a place to discuss prettier javascript formatting without opening an issue ? discord / slack ? |
|
There's gitter right now, but I don't like it a lot. Would be nice to use discord instead. https://gitter.im/jlongster/prettier |
* tag '1.4.4': (421 commits) 1.4.4 1.4.3 Clean up build script, add Babel for docs js bundles (prettier#1970) Check if the next group has comments (prettier#2040) Include typeAnnotation inside of node location (prettier#2039) Fix decorator comments for export class (prettier#2038) Add group around TSMethodSignature (prettier#2037) Do not throw for unprinted comments inside of JSX (prettier#2036) Break decorator before content (prettier#2032) Fix less &:extends when parsed with scss (prettier#2034) Fix parenthesis for call expression inside of member expression inside of new (prettier#2035) Break if string | null (prettier#2028) Only prevent lone `set` if there's no type annotations (prettier#2026) Add semi for functions without body (prettier#2025) Update commands.md Update commands.md Pretty printer commands.js GraphQL: Add support for union types (prettier#2014) Update README for emacs integration link (prettier#2024) Add alias and null value (prettier#2017) ...
Hey !
Just opinionated union type formatting (line break if more than 2 types)
I'm not too familiar with the API so don't hesitate to tell me if I'm doing things wrong :)