apollographql / eslint-plugin-graphql

:vertical_traffic_light: Check your GraphQL query strings against a schema.
https://www.npmjs.com/package/eslint-plugin-graphql
1.21k stars 103 forks source link

Unknown directive "connection" #202

Open jeongsd opened 5 years ago

jeongsd commented 5 years ago

Hi i'm using @connection directive but graphql/template-strings rule throws an error like the below

error  Unknown directive "connection"

Query

const QUERY = gql`
  query Community($offset: Int, $limit: Int!) {
    posts(input: { offset: $offset, limit: $limit }) @connection(key: "CommunityPosts") {
      id
      content
      title
      createdAt
    }
  }
`

.eslintrc

{
  "parser": "babel-eslint",
  "extends": "airbnb",
  "plugins": [
    "react",
    "flowtype",
    "jsx-a11y",
    "import",
    "graphql"
  ],
  "rules": {
    ...
    "graphql/template-strings": ["error", { "env": "fraql" }]
  },
  ...
}

How can I use with @connection directive ?

Erid commented 5 years ago

What I did for now, is that I added the directive to the generated schema. In the script that I have to generate the schema I append to the directives a custom one called connection with 2 arguments: key and filter.