Skip to content

GraphQL: Add support for union types#2014

Merged
vjeux merged 1 commit intoprettier:masterfrom
alexandrebodin:graphql-union-types
Jun 7, 2017
Merged

GraphQL: Add support for union types#2014
vjeux merged 1 commit intoprettier:masterfrom
alexandrebodin:graphql-union-types

Conversation

@alexandrebodin
Copy link
Copy Markdown
Contributor

@alexandrebodin alexandrebodin commented Jun 6, 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 :)

@vjeux
Copy link
Copy Markdown
Contributor

vjeux commented Jun 6, 2017

Could you steal the implementation of flow union types?

@alexandrebodin
Copy link
Copy Markdown
Contributor Author

Ho yes of course !

I'look tomorrow (Paris timezone :))

@vjeux
Copy link
Copy Markdown
Contributor

vjeux commented Jun 7, 2017

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 vjeux mentioned this pull request Jun 7, 2017
@alexandrebodin
Copy link
Copy Markdown
Contributor Author

@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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't graphql support leading |?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't yet. I opened a PR on graphql to see if this can land :)

| I
| J
| K
| L
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there be a ; at the end?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semicolons are not supported.

Comment thread src/printer-graphql.js Outdated
}

case "UnionTypeDefinition": {
const code = concat([
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please just inline this, you don't really need a local variable :)

@vjeux
Copy link
Copy Markdown
Contributor

vjeux commented Jun 7, 2017

Thanks! Just asked a few questions, but it looks good :)

@alexandrebodin
Copy link
Copy Markdown
Contributor Author

@vjeux Should be good now ;)

Is there a place to discuss prettier javascript formatting without opening an issue ? discord / slack ?

@vjeux
Copy link
Copy Markdown
Contributor

vjeux commented Jun 7, 2017

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

@vjeux vjeux merged commit 8ec1b40 into prettier:master Jun 7, 2017
blowery added a commit to Automattic/wp-prettier that referenced this pull request Jun 21, 2017
* 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)
  ...
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 20, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants