Open azz opened 3 years ago
Hey, @kassens, sorry to ping direct, but any chance of getting this shipped?
Would be great to see a feature like this. We have a codebase where we have a lot of id
fields which we need to query but are not used directly in the components. It would be nice to just ignore linting for id
fields.
@acconrad @kassens any update here?
in case anyone want to use this feature before this PR got merged. yarn patch eslint-plugin-relay
just google yarn patch
Sorry about the late replies!
id
fields are automatically selected in all queries. Are you sure you need to select them? Check the generated file (FooQuery.graphql.js
or what-have-you) for the query text, it should include id
everywhere.Let me know what you think! I'm not opposed to merging something like this, but IMO we should try to fix whatever issue we have with Relay, as it should be pretty rare that you need to select fields you don't use. (Or that eslint isn't smart enough to figure out that you're using.)
Relay resolvers are great but they are still experimental even in last Relay version. We have a similar issue in our codebase with edges and node, this could be great if this option can be used.
This PR https://github.com/relayjs/eslint-plugin-relay/pull/95 seems related to same the issue.
👋 Hey team.
Context
In our codebase, we use connections pretty extensively with
graphql-ruby
. Because there's a lot of nullability in our graph, we have a library function to extract all the nodes from a connection. For example:As you can imagine, this yields a bunch of
unused-field
warnings on the genericedges
andnode
fields across a whole bunch of files.Solution
I'm proposing an option to
unused-fields
that allows us to suppress warnings for these common fields, like so:I've raised a PR with specs and docs. Hope you're happy to 🚢 !