MichalLytek / MichalLytek/type-graphql
TypeGraphQL ESLint plugin
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 672
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I am working as the lead in a team of software developers that have been working on a microservices solution backed by TypeGraphQL for almost two years now. Over time, I have come to find that a small number of errors related to TypeGraphQL decorators repeatedly keep popping up within our codebase. Two very common examples:
- A develop forgets to add `{ nullable: true }` inside a TypeGraphQL decorator for a variable or query that is typed as nullable. The opposite case is just as common.
- A developer creates a `number`, supposed to contain an integer, but does not add a type function to the TypeGraphQL decorator, essentially making it a float over the GraphQL connection.
An additional problem with these types of errors is that they might not cause crashes or trouble right away, but months down the line when the written code is already in production and only vaguely remembered.
**Describe the solution you'd like**
I have been working on [an ESLint plugin for type-graphql decorators](https://github.com/borremosch/eslint-plugin-type-graphql). At the moment we have integrated this plugin in our 15 or so microservices that are using TypeGraphQL, and have been able to find around 20 cases where a mistake similar to the ones described above was made. These are errors that we have not been able to spot by eye before, despite having experienced engineers and peer-reviewed code.
I am hoping that more people are willing to try out this plugin, and report any bugs and suggestions they have so it can be further improved. Once the maturity level of the plugin is stable enough, I believe it can have a contribution to the adoption of TypeGraphQL. It might lower the learning curve, as some of the errors are non-obvious to developers that are new to TypeGraphQL.
For an overview of the currently supported linter rules, please see the documentation on [the package page on the NPM website](https://www.npmjs.com/package/eslint-plugin-type-graphql).
I am just dropping this here as a feature request as I did not find a more proper location to file this. Thoughts and suggestions are very welcome.
Contributor guide
Research direction
Start with the linked eslint-plugin-type-graphql repository and its NPM package documentation to review the currently supported rules and how they relate to TypeGraphQL decorators. The issue does not define a specific change, integration point, or acceptance criteria, so the desired outcome would need to be clarified before work begins.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, graphql, typescript
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100