happylinks / gqlint

GraphQL (Schema) Linter
MIT License
41 stars 4 forks source link

Add ability to sort types and properties alphabetically #2

Open gajus opened 7 years ago

gajus commented 7 years ago

Working with large schemas it is easy to get lost in the file. Being able to sort type declarations and their properties alphabetically would be incredibly useful.

happylinks commented 7 years ago

Could you explain a bit more about your workflow? Which tools do you use to make the schema? Currently gqlint doesn't change the graphql file, it only shows error in it. I could make a linting-rule that shows when it's not in alphabetical order, but I'm not sure if that would help you a lot.

gajus commented 7 years ago

Yeah, this is not a minor milestone.

I was thinking of releasing gqlint myself. My plan was to effectively use ESLint project bones to create GraphQL linter with ability to write plugins that can both report and fix issues.

I am not aware of any other tools in the ecosystem that provide similar/ equivalent functionality.

happylinks commented 7 years ago

Ahh cool, we can think of our own --fix parameter like eslint has. But it really depends on the tools that create the schema. For example, in our project the schema is created by running a script that creates the schema based on the graphene library. Fixing the gql wouldn't mean that it's also fixed in the python code. But if people have other usecases for this I'm open for suggestions.

gajus commented 7 years ago

But it really depends on the tools that create the schema.

Oh, the schema is all handcrafted.

happylinks commented 7 years ago

Ah yeah that makes more sense. So something (or exactly) like this right: http://graphql.org/graphql-js/?

I think it's a cool idea and I'll probably checkout how eslint did the --fix flag when I have some more time. If you want to collaborate on this you are also more than welcome to make a PR, or tell me how you would do it :)

Also, I didn't make this tool like eslint yet regarding the "plugins as a npm module" part. Because I only have a small list of rules at the moment it would be more complicated to have to publish them all to their own npm lib. Maybe in the future this will make more sense and I'll change it. Op zo 10 sep. 2017 om 09:02 schreef Gajus Kuizinas <notifications@github.com

But it really depends on the tools that create the schema.

Oh, the schema is all handcrafted.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/happylinks/gqlint/issues/2#issuecomment-328324255, or mute the thread https://github.com/notifications/unsubscribe-auth/AALRxoloRp6Eh6RhKW3pAWOZp9gZm8z0ks5sg4l0gaJpZM4PR_Ic .