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

📎 All caps ENUM in GraphQL #4033

Open
eMerzh opened this issue Sep 21, 2024 · 4 comments
Open

📎 All caps ENUM in GraphQL #4033

eMerzh opened this issue Sep 21, 2024 · 4 comments
Assignees
Labels
A-Linter Area: linter L-GraphQL Language GraphQL S-Feature Status: new feature to implement

Comments

@eMerzh
Copy link
Contributor

eMerzh commented Sep 21, 2024

Description

it's well a convention (not a requirement) in GQL to have ALL CAPS enums,

a few eslint based linter have it like

https://github.com/joshuaNathaniel/eslint-plugin-graphql-schema/blob/master/docs/rules/enum-values-all-caps.md
or
https://github.com/cjoudrey/graphql-schema-linter

it might be a good new lint for biome :)

@eMerzh
Copy link
Contributor Author

eMerzh commented Sep 21, 2024

as a noob, i'd like to try my hand at that :)

i did created #4031

eMerzh added a commit to eMerzh/biome that referenced this issue Sep 21, 2024
eMerzh added a commit to eMerzh/biome that referenced this issue Sep 21, 2024
@minht11
Copy link
Contributor

minht11 commented Sep 22, 2024

After doing quick search for enum graphql there are a lot of different casing examples, so this rule is likely too restrictive.
I think this functionality would be better served by useNamingConvention for graphql.
#4031 (comment)

@dyc3 dyc3 added L-GraphQL Language GraphQL A-Linter Area: linter S-Feature Status: new feature to implement labels Sep 22, 2024
@Conaclos
Copy link
Member

I think this functionality would be better served by useNamingConvention for graphql.

It is a good point.
However, I think that our current infra and way of configuring rules doesn't allow a rule on several languages with a config shape different for every language.
@ematipico any input regarding this aspect?

@ematipico
Copy link
Member

Configuring multiple rules shouldn't be difficult.

Here's what I thought:

  • have an analyze crate where we move shared options and logic
  • adjust the code to take the new crate into account
  • consume those options from multiple rules
  • be good at documenting the options. If there's overlap among languages, that's fine, but if an option is added for one language, the doc comments should say so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-GraphQL Language GraphQL S-Feature Status: new feature to implement
Projects
None yet
Development

No branches or pull requests

5 participants