eslint-plugin-graphql icon indicating copy to clipboard operation
eslint-plugin-graphql copied to clipboard

Query definition is not executable

Open AdrienLemaire opened this issue 5 years ago • 3 comments
trafficstars

Maybe related to #227

Do you know how to resolve this issue?

Using eslint-plugin-graphql 3.1.1 and Apollo client 3. The app seems to behave correctly with this implementation, so I expect no eslint error here.

.eslintrc.yml

---
env:
  browser: true
  es6: true
  jest: true
extends:
  - plugin:react-hooks/recommended
  - airbnb-typescript
  - airbnb/hooks
  - plugin:@typescript-eslint/eslint-recommended
  - plugin:@typescript-eslint/recommended
  - plugin:@typescript-eslint/recommended-requiring-type-checking
  # - plugin:jest/recommended
  - prettier  # disable rules that prettier auto-formats
  - prettier/react
  - prettier/@typescript-eslint
globals:
  Atomics: readonly
  SharedArrayBuffer: readonly
parser: '@typescript-eslint/parser'
parserOptions:
  ecmaFeatures:
    jsx: true
  ecmaVersion: 2018
  sourceType: module
  project: ./tsconfig.json
plugins:
  - react
  - '@typescript-eslint'
  - graphql
rules:
  # prop-types generated by babel-plugin-typescript-to-proptypes with webpack
  react/prop-types: 0
  graphql/template-strings:
    - error
    #- env: literal # determine from .graphqlconfig
    - env: apollo
      tagName: gql
      schemaJsonFilepath: ./schema.json
  "@typescript-eslint/no-use-before-define": 0
  # https://github.com/iamturns/eslint-config-airbnb-typescript/issues/98
  "@typescript-eslint/indent": ["error", 2, {}]

AdrienLemaire avatar May 29 '20 08:05 AdrienLemaire

Ping on this issue @abernix @staylor @kamilkisiela (calling the most recent contributors).

AdrienLemaire avatar Sep 02 '20 08:09 AdrienLemaire

I haven't used this plugin in years, but looking at your screenshot, I can't tell if you have any actual fields defined on that Query extension type or not.

abernix avatar Sep 04 '20 13:09 abernix

For everyone passing by and looking for a 5-sec hack: I renamed my schema from schema.graphql to schema.gql so that the linter does not look at it (config eslint --ext .ts,.tsx,.graphql with env: 'literal'). Don't forget to update your .eslintconfig with the new schema path ;)

AmauryLiet avatar Nov 06 '20 16:11 AmauryLiet