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
779 stars 102 forks source link

Ability to sort nodes last in group #2235

Open deathemperor opened 3 months ago

deathemperor commented 3 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 3 months ago

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

deathemperor commented 3 weeks 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.