Skip to content

Commit

Permalink
Prettier: preserve quotes in object props
Browse files Browse the repository at this point in the history
In the latest release of Prettier, number keys are "unquoted" by
default. This is all fine and well, but Flow reacts poorly to number
literals as keys. The most diplomatic solution seems to be setting
"quoteProps" to "preserve":
	https://prettier.io/docs/en/options.html#quote-props

However, this precipitated an interesting error in jest, where it was
unhappy about the reaction and review state props being unquoted, both
in the flow type notation and the object literal itself. I recommend
reading the PR that implemented this change for more discussion:
prettier/prettier#8508

test plan: `yarn unit`, `yarn flow`, `yarn check-pretty`
  • Loading branch information
topocount committed Sep 10, 2020
1 parent b5c8918 commit dabffc3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .prettierrc.json
@@ -1,5 +1,6 @@
{
"trailingComma": "es5",
"bracketSpacing": false,
"arrowParens": "always"
"arrowParens": "always",
"quoteProps": "preserve"
}
52 changes: 26 additions & 26 deletions src/plugins/github/graphqlTypes.js
Expand Up @@ -120,17 +120,17 @@ export type PullRequestReviewState =
| "PENDING";

export const PullRequestReviewState$Values: {|
+APPROVED: "APPROVED",
+CHANGES_REQUESTED: "CHANGES_REQUESTED",
+COMMENTED: "COMMENTED",
+DISMISSED: "DISMISSED",
+PENDING: "PENDING",
+"APPROVED": "APPROVED",
+"CHANGES_REQUESTED": "CHANGES_REQUESTED",
+"COMMENTED": "COMMENTED",
+"DISMISSED": "DISMISSED",
+"PENDING": "PENDING",
|} = deepFreeze({
APPROVED: "APPROVED",
CHANGES_REQUESTED: "CHANGES_REQUESTED",
COMMENTED: "COMMENTED",
DISMISSED: "DISMISSED",
PENDING: "PENDING",
"APPROVED": "APPROVED",
"CHANGES_REQUESTED": "CHANGES_REQUESTED",
"COMMENTED": "COMMENTED",
"DISMISSED": "DISMISSED",
"PENDING": "PENDING",
});

export type Reaction = {|
Expand All @@ -152,23 +152,23 @@ export type ReactionContent =
| "THUMBS_UP";

export const ReactionContent$Values: {|
+CONFUSED: "CONFUSED",
+EYES: "EYES",
+HEART: "HEART",
+HOORAY: "HOORAY",
+LAUGH: "LAUGH",
+ROCKET: "ROCKET",
+THUMBS_DOWN: "THUMBS_DOWN",
+THUMBS_UP: "THUMBS_UP",
+"CONFUSED": "CONFUSED",
+"EYES": "EYES",
+"HEART": "HEART",
+"HOORAY": "HOORAY",
+"LAUGH": "LAUGH",
+"ROCKET": "ROCKET",
+"THUMBS_DOWN": "THUMBS_DOWN",
+"THUMBS_UP": "THUMBS_UP",
|} = deepFreeze({
CONFUSED: "CONFUSED",
EYES: "EYES",
HEART: "HEART",
HOORAY: "HOORAY",
LAUGH: "LAUGH",
ROCKET: "ROCKET",
THUMBS_DOWN: "THUMBS_DOWN",
THUMBS_UP: "THUMBS_UP",
"CONFUSED": "CONFUSED",
"EYES": "EYES",
"HEART": "HEART",
"HOORAY": "HOORAY",
"LAUGH": "LAUGH",
"ROCKET": "ROCKET",
"THUMBS_DOWN": "THUMBS_DOWN",
"THUMBS_UP": "THUMBS_UP",
});

export type Ref = {|
Expand Down

0 comments on commit dabffc3

Please sign in to comment.