Skip to content
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

TypeError: [graphql-eslint] Error while preprocessing "packages/front-lib/schema/schema.graphql" file #1932

Open
4 tasks
charleslai2000 opened this issue Oct 14, 2023 · 1 comment

Comments

@charleslai2000
Copy link

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox

    For example, you can start off by editng the
    'basic' example on Stackblitz.

    Please make sure the graphql-eslint version under package.json matches yours.

  • 2. A failing test has been provided

  • 3. A local solution has been provided

  • 4. A pull request is pending review


Describe the bug

Eslint report this error in a functional graphql-config configuraiton.


TypeError: [graphql-eslint] Error while preprocessing "packages/front-lib/schema/schema.graphql" file

Provided file type must be one of .js, .mjs, .cjs, .jsx, .ts, .mts, .cts, .tsx, .flow, .flow.js, .flow.jsx, .vue, .svelte 
    at extractExtension (file:///home/charles/Workspaces/fx-front-dev/node_modules/.pnpm/@graphql-tools+graphql-tag-pluck@7.5.2_@babel+core@7.23.0_graphql@16.8.1/node_modules/@graphql-tools/graphql-tag-pluck/esm/index.js:98:19)
    at gqlPluckFromCodeStringSync (file:///home/charles/Workspaces/fx-front-dev/node_modules/.pnpm/@graphql-tools+graphql-tag-pluck@7.5.2_@babel+core@7.23.0_graphql@16.8.1/node_modules/@graphql-tools/graphql-tag-pluck/esm/index.js:70:21)
    at preprocess (file:///home/charles/Workspaces/fx-front-dev/node_modules/.pnpm/@graphql-eslint+eslint-plugin@3.20.1_@babel+core@7.23.0_@types+node@20.7.1_graphql@16.8.1/node_modules/@graphql-eslint/eslint-plugin/esm/processor.js:42:23)
    at Linter._verifyWithFlatConfigArrayAndProcessor (/home/charles/Workspaces/fx-front-dev/node_modules/.pnpm/eslint@8.50.0/node_modules/eslint/lib/linter/linter.js:1494:22)
    at Linter._verifyWithFlatConfigArray (/home/charles/Workspaces/fx-front-dev/node_modules/.pnpm/eslint@8.50.0/node_modules/eslint/lib/linter/linter.js:1863:25)
    at Linter.verify (/home/charles/Workspaces/fx-front-dev/node_modules/.pnpm/eslint@8.50.0/node_modules/eslint/lib/linter/linter.js:1448:65)
    at Linter.verifyAndFix (/home/charles/Workspaces/fx-front-dev/node_modules/.pnpm/eslint@8.50.0/node_modules/eslint/lib/linter/linter.js:2083:29)
    at verifyText (/home/charles/Workspaces/fx-front-dev/node_modules/.pnpm/eslint@8.50.0/node_modules/eslint/lib/eslint/flat-eslint.js:475:48)
    at FlatESLint.lintText (/home/charles/Workspaces/fx-front-dev/node_modules/.pnpm/eslint@8.50.0/node_modules/eslint/lib/eslint/flat-eslint.js:954:26)
    at async /home/charles/.vscode-server/extensions/dbaeumer.vscode-eslint-2.4.2/server/out/eslintServer.js:1:24852

To Reproduce Steps to reproduce the behavior:

my configuration file like:

      "schemaPath": [
        "packages/data-api/schema/universe.schema.graphql",
        "packages/data-api/schema/platform.schema.graphql"
      ],
      "includes": [
        "packages/front-lib/src/**/*.{ts,tsx,js,jsx}",
        "packages/front-lib/schema/*.graphql"
      ],

When lint packages/front-lib/schema/schema.grapql, the error will be reported. But I have another project config, like:

 "schemaPath": [
        "packages/data-api/schema/universe.schema.graphql"
      ],
      "includes": [
        "packages/data-api/src/**/*.{ts,tsx,js,jsx}",
        "packages/data-api/schema/*.graphql"
      ],

when I edit and save all graphql file in packages/data-api/schema/ directory, there is no error reported. This is weird.

Expected behavior

Treat this file as graphql and lint it.

Environment:

  • OS: Ubuntu 20.04
  • @graphql-eslint/eslint-plugin: 3.20.1
  • Node.js: 20

Additional context

@charleslai2000
Copy link
Author

I found some hint, can not include *.graphql in graphql-config's includes entry. But this is not consistency with document provided by graphql-config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant