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.

[naming-convention] Add Query-specific option

See original GitHub issue

I think there could be a new option that targets the queries because the naming convention could be different from a field definition on a normal type.

For example, I may want to forbid the queries to have get prefixes because queries are always “GET” but still allows other object type definitions, then I can add the following rule to eslint config:

"@graphql-eslint/naming-convention": [
  "error",
  {
    "QueryFieldDefinition": { "format": "camelCase", "forbiddenPrefixes": ["get"] },
    "FieldDefinition": { "format": "camelCase" },
  }
]
type Query {
  getUser: User # Error
  user: User # OK
}

type User {
  getter: User # OK
}

If it makes sense I can try creating a PR for this 😃

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dotansimhacommented, Feb 2, 2021

Available in @graphql-eslint/eslint-plugin@0.8.0

1reaction
eddeee888commented, Jan 5, 2021

@dotansimha I have created a PR for this: https://github.com/dotansimha/graphql-eslint/pull/256 Please have a look when you have a chance, thanks! 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Learn SQL: Naming Conventions - SQLShack
A naming convention is a set of unwritten rules you should use if you want to increase the readability of the whole data...
Read more >
Table field naming convention and SQL statements
For queries that aren't ad-hoc, you should always prefix every field with either the table name or table alias, even if the field...
Read more >
Option naming convention - Wikipedia
In financial markets, an option naming convention is a method of identifying which of many possible options is being quoted or traded.
Read more >
Define your naming convention - Cloud Adoption Framework
In this article. An effective naming convention consists of resource names from important information about each resource. A good name helps ...
Read more >
Naming conventions | Cloud APIs
Rather, choose specific names that accurately describe the API concept. This is particularly important for names that define first-order API elements, ...
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