-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown directive "client" #209
Comments
I'm also having the similar issue, I believe the PR is currently being reviewed here 👍 |
#117 hasn't had any movement for almost a year. This is a pretty significant issue to using the lint plugin within the apollo ecosystem. |
I experienced this problem as well and fixed it by upgrading the apollo CLI tooling to the latest version (currently 2.22.0). |
I can confirm after updating But the linter still fails on annotated fields that don't exist in the schema. So while the directive is recognised, the field still throws an error. |
I am seeing the same issue. Here's the query: const GET_CHECKOUT_STEP = gql`
query getCheckoutStep {
# The current checkout step, stored locally for persistence.
checkoutStep @client
}
`; and here's the lint error:
|
It's super annoying to not have full linter support for something so seemingly popular. A workaround is to add something like this to your local schema definitions (https://graphql-code-generator.com/docs/integrations/apollo-local-state)
I prevents the linting error, but obviously doesn't give us complete confidence that it's being used appropriately. Putting |
A bit hacky but something like this in const schema = require('./schema.json');
schema.__schema.directives.push({
name: 'client',
locations: ['FIELD'],
args: [],
});
module.exports = {
rules: {
'graphql/template-strings': [
'warn',
{
env: 'apollo',
schemaJson: schema,
},
],
},
plugins: ['graphql'],
}; |
Using Apollo Client with gql
Consider the following query
The @client is not recognised by the plugin. Am I doing something wrong here?
eslint settings
The text was updated successfully, but these errors were encountered: