RFC: ESLint preset
JoviDeCroock opened this issue · comments
Summary
We would do good in helping people see GraphQL best practices like, fragment co-location, ... This isn't just something we can do with documentation, it should be a continuous effort which we can achieve with some type of linting.
The linting should be fuse-specific so we can see what's being done on the server and how that can be improved or how it can be more fuse-like
. What's being done on the client and how we can set folks up for better re-use, when we see a component using data from a query we could encourage folks to create a fragment so that when they use that component next time it declares its own data-requirements making it easier to iterate on it.
Initial set of things to lint for
- Fragment co-location
- Fragment naming conventions
- Setting up limits (i.e. pagination limit can't exceed 100)
- Queried fields that aren't being used
- ...
Would love to know what others think is worth highlighting here both on client and/or server.
The new features within GraphQLSP already introduce a few of these linting options like:
- warning for unused-fields
- warning for missing fragment imports
Both of the above are meant to encourage folks into fragment co-location, additional lint rules could be fragment naming conventions but I think as we aren't currently using those as a heuristic I think it's good.