dimaMachina / graphql-eslint

ESLint parser, plugin and set rules for GraphQL (for schema and operations). Easily customizable with custom rules. Integrates with IDEs and modern GraphQL tools.
https://the-guild.dev/graphql/eslint
MIT License
800 stars 104 forks source link

Ability to sort nodes last in group #2235

Open deathemperor opened 7 months ago

deathemperor commented 7 months ago

In large queries with many fields and sub fields, I prefer to put sub query nodes last. As with big queries, finding fields last under other nodes is a pain

For example:

current situation

query books {
    id
    title
    author {
        id
        addresses {
            id
            street_name
        }
        name
    }
    series {
        id
        title
    }
    created_at
    updated_at
}

Desire sort:

query books {
    id
    title
    created_at
    updated_at
    author {
        id
        name
        addresses {
            id
            street_name
        }
    }
    series {
        id
        title
    }
}
dimaMachina commented 7 months ago

I like this idea, pr welcome (via the new option for existing rule)

deathemperor commented 4 months ago

@dimaMachina added the PR https://github.com/dimaMachina/graphql-eslint/pull/2385, I chose relationships_last as the config name, please suggest a better name.