Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2291] Support the '...' group for alphabetizing fragment spreads #2293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yoavsion
Copy link

@yoavsion yoavsion commented May 9, 2024

Description

Adds a group type to the groups property of the alphabetize rule indicating where fragment spreads should be in a selection set.

Similarly to the '*' group, which stands for "everything else," the '...' stands for "all fragment spreads."

Fixes #2291

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Added the following unit tests, ran yarn test and verified that the error messages match the expected ones:

  • should sort selections by group when ... is at the start
  • should sort selections by group when ... is between
  • should sort selections by group when ... is at the end

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests and linter rules pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

When working on this change, the display name for a fragment spread was showing undefined <fragment name>, which was because there was no name mapping for that Kind — so I went ahead and added display names for all Kind values, and sorted the map.

Copy link

changeset-bot bot commented May 9, 2024

🦋 Changeset detected

Latest commit: b3d0b6f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-eslint/eslint-plugin Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

[Kind.OBJECT_TYPE_EXTENSION]: 'type',
[Kind.INTERFACE_TYPE_DEFINITION]: 'interface',
[Kind.INTERFACE_TYPE_EXTENSION]: 'interface',
const DisplayNodeNameMap: Record<Kind, string> = {
Copy link
Author

Choose a reason for hiding this comment

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

Added display name for all Kind enum values, and sorted the list

@yoavsion yoavsion marked this pull request as ready for review May 17, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support the fragment spread group when defining alphabetize rule's groups
1 participant