question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@graphql-eslint/naming-convention: query should or should not start with a verb

See original GitHub issue

For example if

eslint @graphql-eslint/naming-convention: [“error”, {“QueryDefinition”: [“camelCase”, “shouldStartWithVerb”]}]

correct:

type Query {
    getUser(id: String): User
}

incorrect:

type Query {
    user(id: String): User
}

type Query {
    GetUser(id: String): User
}

Let me know if you would be open to this contribution (if this does not exist yet) and if yes what the correct rule configuration format should look like.

I was thinking of letting QueryDefinition take an array of values that can include shouldStartWithVerb and shouldNotStartWithVerb

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
DianaSuvorovacommented, Jul 6, 2021

@B2o5T Beautiful! Just tried it – works exactly as I need. Apologies for the confusion here. Thank you so much!

1reaction
B2o5Tcommented, Jun 20, 2021

What I think is a bad practice in GraphQL to name queries with get prefix But, @DianaSuvorova with graphql-eslint you still can force to name your queries with no matter what prefix.

For query like

type Query {
  user(id: ID!): User
}

and with options

# eslint @graphql-eslint/naming-convention: ['error', { QueryDefinition: { style: 'camelCase', prefix: 'get' } }]

It’s will report an error Query name "user" should have "get" prefix according to your needs

Read more comments on GitHub >

github_iconTop Results From Across the Web

graphql-eslint/naming-convention: query should or ...
I do understand that operations should not start with a verb according to GraphQL best practice. But I still think that consistency is...
Read more >
Boolean query | Elasticsearch Guide [8.5]
The bool query takes a more-matches-is-better approach, so the score from each matching must or should clause will be added together to provide...
Read more >
How to Query Elasticsearch With Boolean Queries
Boolean queries in Elasticsearch match documents by using the clauses: filter, must, must_not, & should. Read on for examples of bool queries.
Read more >
elasticsearch bool query combine must with OR
I finally managed to create a query that does exactly what i wanted to have: A filtered nested boolean query. I am not...
Read more >
Elasticsearch Bool Query - Filter, Must, Should & ...
There are 4 types of Elasticsearch boolean clauses: filter, must, should & must_not. A single bool query can contain a mix of them....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found