ESLint parser, plugin and set rules for GraphQL (for schema and operations). Easily customizable with custom rules. Integrates with IDEs and modern GraphQL tools.
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
Issue workflow progress
Progress of the issue based on the Contributor Workflow
[ ] 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox
[ ] 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.
To Reproduce Steps to reproduce the behavior:
my configuration file like:
When lint
packages/front-lib/schema/schema.grapql
, the error will be reported. But I have another project config, like: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:
@graphql-eslint/eslint-plugin
: 3.20.1Additional context