-
Notifications
You must be signed in to change notification settings - Fork 45
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
Support custom directives #66
Comments
Please share your .gqlconfig file. |
my .gqlconfig file // .gqlconfig (with query)
{
schema: {
files: 'src/**/*.gql',
},
query: {
files: [
// query gql files
{
match: 'src/**/*.gql',
parser: 'QueryParser',
},
// [Embedded queries] relay files
{
match: { include: 'src/**/*.js', ignore: '**/tests/**/*.js' },
parser: [ 'EmbeddedQueryParser', { startTag: 'Relay\\.QL`', endTag: '`' } ],
isRelay: true,
},
// [Embedded queries] gql tag files
{
match: { include: 'src/**/*.js', ignore: '**/tests/**/*.js' },
parser: [ 'EmbeddedQueryParser', { startTag: 'gql`', endTag: '`' } ],
},
// [Embedded queries] some other tags
{
match: 'src/**/*.xyz',
parser: [ 'EmbeddedQueryParser', { startTag: '"""', endTag: '"""' } ],
},
// [Embedded queries] some other tags and modify validation rules
{
match: 'src/**/*.xyz',
parser: [ 'EmbeddedQueryParser', { startTag: '"""', endTag: '"""' } ],
validate: {
extends: 'gql-rules-query',
rules: {
LoneAnonymousOperation: 'off',
NoUnusedVariables: 'warn',
},
}
},
]
}
} I tried to change the file for following json and it stoped to show me the error. // .gqlconfig (with query)
{
schema: {
files: 'src/**/*.gql',
}
} what is the problem with the previous file? Thanks |
The previous file is an example file - meant to show how to configure your project. The errors have stopped because the linting has stopped. You need to specify the For example, to enable linting, etc for *.gql and *.js files, write this:
|
{
schema: {
files: 'src/**/*.gql',
}
} The above .gqlconfig file is fine if you are using plugin for schema files only but if you want to support queries (using apollo, relay or other any other client) than you need to add 'query' in .gqlconfig.
It stopped showing error as currently in schema directive validation is not done (I have created an issue But with other config its showing error because you put schema files in query also and the error is coming from query validation rules. Note In graphql schema and query files are different and you should not put schema files in query files config they should be separate. {
schema: {
files: 'src/**/*.gql',
},
query: {
files: [{
- match: 'src/**/*.gql'
+ match: 'src/path_to_query_files_not_schema_files',
}]
}
}
directive @myDirective on FIELD
type Query{
getData:String! @myDirective
} In above code the @myDirective type definition is wrong. If you want to use directive on type definition fields than you should define your directive as below. - directive @myDirective on FIELD
+ directive @myDirective on FIELD_DEFINITION |
I believe this has been resolved @kabytaa? |
Yes, it solved, Thanks to @Mayank1791989. |
Hi,
I am not sure if there is a support for custom directives or i'm doing something wrong.
I have this code:
And i get this error:
How i can fix it?
BTW: Awesome extension.
Thanks
The text was updated successfully, but these errors were encountered: