Skip to content

Conversation

canac
Copy link
Contributor

@canac canac commented Aug 22, 2025

Description

I was trying to use the newish satisfies TypeScript operator on another PR and noticed that it messed up prettier. It appears to be because prettier wasn't new enough. This PR simply upgrades to prettier 3 and removes the trailingComma configuration because it defaults to all now. It seems that the main breaking change is how it formats nested ternaries.

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels. (Add the label "On Staging" to get the branch automatically merged into staging.)
  • I have requested a review from another person on the project

@canac canac requested a review from dr-bizz August 22, 2025 21:32
@canac canac self-assigned this Aug 22, 2025
@canac canac added the Preview Environment Add this label to create an Amplify Preview label Aug 22, 2025
Copy link
Contributor

Preview branch generated at https://upgrade-prettier.d3dytjb8adxkk5.amplifyapp.com

Copy link
Contributor

Bundle sizes [mpdx-react]

Compared against ccd5ff7

No significant changes found

Copy link
Contributor

@dr-bizz dr-bizz left a comment

Choose a reason for hiding this comment

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

The code looks good. I have a question with updating the tests, but will approve as it's not blocking.

<GqlMockedProvider<{
Contacts: ContactsQuery;
Appeal: AppealQuery;
ContactFilters: ContactFiltersQuery;
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this is related to the work being done on staging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Upgrading prettier changed how it was formatting the GraphQL operations. The gql query definitions in the generated files like this one:

export const ContactFiltersDocument = gql`
  query ContactFilters($accountListId: ID!) {
    accountList(id: $accountListId) {
      id
      contactFilterGroups {
        ...FilterPanelGroup
      }
      partnerGivingAnalysisFilterGroups {
        ...FilterPanelGroup
      }
    }
    userOptions {
      ...UserOption
    }
  }
  ${FilterPanelGroupFragmentDoc}
  ${UserOptionFragmentDoc}
`;

I believe that our GraphQL mocking library seeds the random number generator with a hash of the GraphQL operation. So even if just whitespace changes, it will generate different values for fields not explicitly mocked. A few tests were dependent on those random values and broke when they changed.

@canac canac merged commit 9aa4279 into main Aug 26, 2025
27 of 31 checks passed
@canac canac deleted the upgrade-prettier branch August 26, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Preview Environment Add this label to create an Amplify Preview
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants