From 909645893d41f2ccf618b2c74fb7671ddab538b9 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Thu, 1 Aug 2024 00:45:43 +0200 Subject: [PATCH] add `meta` object with `name` and `version` to `parser` and `processor` to be compatible with ESLint 9 (#2458) * fix lint * aa * aa * more * more * more * more * more * more * format * fix examples test * fix website * fix * aa * try * okk * nowww --- .changeset/lovely-laws-hide.md | 6 +++++ examples/code-file/eslint.config.js | 8 +++---- examples/code-file/package.json | 2 +- examples/graphql-config/eslint.config.js | 6 ++--- examples/graphql-config/package.json | 2 +- examples/monorepo/eslint.config.js | 12 +++++----- examples/monorepo/package.json | 2 +- .../package.json | 2 +- examples/prettier/eslint.config.js | 10 ++++---- examples/prettier/package.json | 2 +- examples/programmatic/eslint.config.js | 6 ++--- examples/programmatic/package.json | 2 +- examples/svelte-code-file/package.json | 2 +- examples/vue-code-file/package.json | 2 +- package.json | 2 +- packages/plugin/__tests__/examples.spec.ts | 13 +++++++++- packages/plugin/__tests__/rules.spec.ts | 4 ++-- packages/plugin/src/flat-configs.ts | 6 ++--- packages/plugin/src/index.browser.ts | 4 +--- packages/plugin/src/index.ts | 2 +- packages/plugin/src/meta.ts | 3 +++ packages/plugin/src/parser.ts | 9 +++++++ packages/plugin/src/processor.ts | 5 ++++ packages/plugin/tsconfig.json | 2 +- packages/plugin/tsup.config.ts | 1 + pnpm-lock.yaml | 24 +++++++++---------- website/next.config.js | 3 --- website/src/components/graphql-editor.tsx | 4 ++-- website/src/components/play-page.tsx | 5 ++-- 29 files changed, 89 insertions(+), 62 deletions(-) create mode 100644 .changeset/lovely-laws-hide.md create mode 100644 packages/plugin/src/meta.ts diff --git a/.changeset/lovely-laws-hide.md b/.changeset/lovely-laws-hide.md new file mode 100644 index 00000000000..946fab85d1f --- /dev/null +++ b/.changeset/lovely-laws-hide.md @@ -0,0 +1,6 @@ +--- +'@graphql-eslint/eslint-plugin': patch +--- + +add `meta` object with `name` and `version` to `parser` and `processor` to be compatible with ESLint +9 diff --git a/examples/code-file/eslint.config.js b/examples/code-file/eslint.config.js index ae477e8051e..5d891c7aa2c 100644 --- a/examples/code-file/eslint.config.js +++ b/examples/code-file/eslint.config.js @@ -1,10 +1,10 @@ import js from '@eslint/js'; -import * as graphqlESLint from '@graphql-eslint/eslint-plugin'; +import * as graphql from '@graphql-eslint/eslint-plugin'; export default [ { files: ['**/*.js'], - processor: graphqlESLint.processors.graphql, + processor: graphql.processors.graphql, rules: { ...js.configs.recommended.rules, 'no-console': 'error', @@ -13,10 +13,10 @@ export default [ { files: ['**/*.graphql'], plugins: { - '@graphql-eslint': graphqlESLint, + '@graphql-eslint': { rules: graphql.rules }, }, languageOptions: { - parser: graphqlESLint, + parser: graphql.parser, }, rules: { '@graphql-eslint/no-anonymous-operations': 'error', diff --git a/examples/code-file/package.json b/examples/code-file/package.json index 1db887b0114..1b76a7127eb 100644 --- a/examples/code-file/package.json +++ b/examples/code-file/package.json @@ -6,7 +6,7 @@ "author": "Dotan Simha ", "private": true, "scripts": { - "lint": "eslint ." + "lint": "eslint --cache ." }, "dependencies": { "graphql": "16.9.0" diff --git a/examples/graphql-config/eslint.config.js b/examples/graphql-config/eslint.config.js index cff1685cd5c..7408693ba90 100644 --- a/examples/graphql-config/eslint.config.js +++ b/examples/graphql-config/eslint.config.js @@ -1,5 +1,5 @@ import js from '@eslint/js'; -import * as graphqlESLint from '@graphql-eslint/eslint-plugin'; +import * as graphql from '@graphql-eslint/eslint-plugin'; export default [ { @@ -9,10 +9,10 @@ export default [ { files: ['**/*.graphql'], plugins: { - '@graphql-eslint': graphqlESLint, + '@graphql-eslint': { rules: graphql.rules }, }, languageOptions: { - parser: graphqlESLint, + parser: graphql.parser, }, rules: { '@graphql-eslint/no-anonymous-operations': 'error', diff --git a/examples/graphql-config/package.json b/examples/graphql-config/package.json index 24aedb6f263..694cb9d7df5 100644 --- a/examples/graphql-config/package.json +++ b/examples/graphql-config/package.json @@ -6,7 +6,7 @@ "author": "Dotan Simha ", "private": true, "scripts": { - "lint": "eslint ." + "lint": "eslint --cache ." }, "dependencies": { "graphql": "16.9.0" diff --git a/examples/monorepo/eslint.config.js b/examples/monorepo/eslint.config.js index 6e0b83795af..1f935982bc6 100644 --- a/examples/monorepo/eslint.config.js +++ b/examples/monorepo/eslint.config.js @@ -1,5 +1,5 @@ import js from '@eslint/js'; -import * as graphqlESLint from '@graphql-eslint/eslint-plugin'; +import * as graphql from '@graphql-eslint/eslint-plugin'; const SCHEMA_PATH = 'server/**/*.gql'; @@ -11,7 +11,7 @@ export default [ { files: ['client/**/*.tsx'], // Setup processor for operations/fragments definitions on code-files - processor: graphqlESLint.processors.graphql, + processor: graphql.processors.graphql, languageOptions: { parserOptions: { sourceType: 'module', @@ -25,20 +25,20 @@ export default [ // Setup GraphQL Parser files: ['**/*.{graphql,gql}'], plugins: { - '@graphql-eslint': graphqlESLint, + '@graphql-eslint': { rules: graphql.rules }, }, languageOptions: { - parser: graphqlESLint, + parser: graphql.parser, }, }, { // Setup recommended config for schema files files: [SCHEMA_PATH], - ...graphqlESLint.flatConfigs['schema-recommended'], + ...graphql.flatConfigs['schema-recommended'], }, { // Setup recommended config for operations files files: ['client/**/*.{graphql,gql}'], - ...graphqlESLint.flatConfigs['operations-recommended'], + ...graphql.flatConfigs['operations-recommended'], }, ]; diff --git a/examples/monorepo/package.json b/examples/monorepo/package.json index 89477b6adff..1d43f4e3498 100644 --- a/examples/monorepo/package.json +++ b/examples/monorepo/package.json @@ -5,7 +5,7 @@ "author": "Dimitri POSTOLOV", "private": true, "scripts": { - "lint": "eslint ." + "lint": "eslint --cache ." }, "dependencies": { "graphql": "16.9.0" diff --git a/examples/multiple-projects-graphql-config/package.json b/examples/multiple-projects-graphql-config/package.json index 57f1fc900f4..0e7560074e4 100644 --- a/examples/multiple-projects-graphql-config/package.json +++ b/examples/multiple-projects-graphql-config/package.json @@ -4,7 +4,7 @@ "author": "Dimitri POSTOLOV", "private": true, "scripts": { - "lint": "ESLINT_USE_FLAT_CONFIG=false eslint ." + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --cache ." }, "dependencies": { "graphql": "16.9.0" diff --git a/examples/prettier/eslint.config.js b/examples/prettier/eslint.config.js index a41a843639e..18b65ce9e26 100644 --- a/examples/prettier/eslint.config.js +++ b/examples/prettier/eslint.config.js @@ -1,17 +1,17 @@ import prettierConfig from 'eslint-config-prettier'; import prettierPlugin from 'eslint-plugin-prettier'; import js from '@eslint/js'; -import * as graphqlESLint from '@graphql-eslint/eslint-plugin'; +import * as graphql from '@graphql-eslint/eslint-plugin'; export default [ { plugins: { - prettier: prettierPlugin, + prettier: { rules: prettierPlugin.rules }, }, }, { files: ['**/*.js'], - processor: graphqlESLint.processors.graphql, + processor: graphql.processors.graphql, rules: { ...js.configs.recommended.rules, ...prettierConfig.rules, @@ -21,10 +21,10 @@ export default [ { files: ['**/*.graphql'], languageOptions: { - parser: graphqlESLint, + parser: graphql.parser, }, plugins: { - '@graphql-eslint': graphqlESLint, + '@graphql-eslint': { rules: graphql.rules }, }, rules: { 'prettier/prettier': 'error', diff --git a/examples/prettier/package.json b/examples/prettier/package.json index 40cce9ee14d..a17a7765f80 100644 --- a/examples/prettier/package.json +++ b/examples/prettier/package.json @@ -6,7 +6,7 @@ "author": "JounQin ", "private": true, "scripts": { - "lint": "eslint ." + "lint": "eslint --cache ." }, "dependencies": { "graphql": "16.9.0" diff --git a/examples/programmatic/eslint.config.js b/examples/programmatic/eslint.config.js index bc72b3c697e..a45bde26b94 100644 --- a/examples/programmatic/eslint.config.js +++ b/examples/programmatic/eslint.config.js @@ -1,5 +1,5 @@ import js from '@eslint/js'; -import * as graphqlESLint from '@graphql-eslint/eslint-plugin'; +import * as graphql from '@graphql-eslint/eslint-plugin'; export default [ { @@ -9,10 +9,10 @@ export default [ { files: ['**/*.graphql'], plugins: { - '@graphql-eslint': graphqlESLint, + '@graphql-eslint': { rules: graphql.rules }, }, languageOptions: { - parser: graphqlESLint, + parser: graphql.parser, parserOptions: { graphQLConfig: { schema: 'schema.graphql', diff --git a/examples/programmatic/package.json b/examples/programmatic/package.json index 3dc72a188cc..6d8656d2420 100644 --- a/examples/programmatic/package.json +++ b/examples/programmatic/package.json @@ -6,7 +6,7 @@ "author": "Dotan Simha ", "private": true, "scripts": { - "lint": "eslint ." + "lint": "eslint --cache ." }, "dependencies": { "graphql": "16.9.0" diff --git a/examples/svelte-code-file/package.json b/examples/svelte-code-file/package.json index 7c014a3b819..f131bf08847 100644 --- a/examples/svelte-code-file/package.json +++ b/examples/svelte-code-file/package.json @@ -5,7 +5,7 @@ "author": "Dimitri POSTOLOV", "private": true, "scripts": { - "lint": "ESLINT_USE_FLAT_CONFIG=false eslint ." + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --cache ." }, "dependencies": { "graphql": "16.9.0" diff --git a/examples/vue-code-file/package.json b/examples/vue-code-file/package.json index be491d60f41..f695c1b93d2 100644 --- a/examples/vue-code-file/package.json +++ b/examples/vue-code-file/package.json @@ -5,7 +5,7 @@ "author": "Dimitri POSTOLOV", "private": true, "scripts": { - "lint": "ESLINT_USE_FLAT_CONFIG=false eslint ." + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --cache ." }, "dependencies": { "graphql": "16.9.0" diff --git a/package.json b/package.json index 41431b71edd..a0d30ce9089 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@changesets/cli": "2.27.7", "@graphql-tools/utils": "10.3.2", "@theguild/eslint-config": "0.11.10", - "@theguild/prettier-config": "2.0.6", + "@theguild/prettier-config": "2.0.7", "@types/dedent": "0.7.2", "@types/node": "20.14.13", "bob-the-bundler": "7.0.1", diff --git a/packages/plugin/__tests__/examples.spec.ts b/packages/plugin/__tests__/examples.spec.ts index 0d59e7ba08b..e5296aa1b22 100644 --- a/packages/plugin/__tests__/examples.spec.ts +++ b/packages/plugin/__tests__/examples.spec.ts @@ -19,7 +19,18 @@ ${results.map(result => result.messages.map(m => m.message)).join('\n\n')} function getESLintOutput(cwd: string): ESLint.LintResult[] { const { stdout, stderr } = spawnSync('eslint', ['.', '--format', 'json'], { cwd }); - const errorOutput = stderr.toString(); + const errorOutput = stderr + .toString() + .replace( + /\(node:\d{4,5}\) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time/, + '', + ) + .replace( + /\(node:\d{4}\) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js./, + '', + ) + .replace('(Use `node --trace-warnings ...` to show where the warning was created)', '') + .trimEnd(); if (errorOutput) { throw new Error(errorOutput); } diff --git a/packages/plugin/__tests__/rules.spec.ts b/packages/plugin/__tests__/rules.spec.ts index 09dca6106b5..0e9084b8bb4 100644 --- a/packages/plugin/__tests__/rules.spec.ts +++ b/packages/plugin/__tests__/rules.spec.ts @@ -1,5 +1,5 @@ import { FlatESLint } from 'eslint/use-at-your-own-risk'; -import { configs, parseForESLint, rules } from '@graphql-eslint/eslint-plugin'; +import { configs, parser, rules } from '@graphql-eslint/eslint-plugin'; import { ParserOptionsForTests } from './test-utils.js'; export function getESLintWithConfig( @@ -12,7 +12,7 @@ export function getESLintWithConfig( { files: ['*.graphql'], languageOptions: { - parser: { parseForESLint }, + parser, parserOptions: { graphQLConfig: { schema: 'type Query { foo: Int }', diff --git a/packages/plugin/src/flat-configs.ts b/packages/plugin/src/flat-configs.ts index 29395c940f5..f10494cfc24 100644 --- a/packages/plugin/src/flat-configs.ts +++ b/packages/plugin/src/flat-configs.ts @@ -1,10 +1,8 @@ import { configs } from './configs/index.js'; -import { parseForESLint } from './parser.js'; +import { parser } from './parser.js'; import { ConfigName } from './types.js'; -const languageOptions = { - parser: { parseForESLint }, -}; +const languageOptions = { parser }; export const flatConfigs = { 'operations-all': { diff --git a/packages/plugin/src/index.browser.ts b/packages/plugin/src/index.browser.ts index f8e43ac9661..cb4cd0320ff 100644 --- a/packages/plugin/src/index.browser.ts +++ b/packages/plugin/src/index.browser.ts @@ -1,8 +1,6 @@ // rewrite exports because we don't need `processors` export that has fs related dependencies -export { parseForESLint } from './parser.js'; +export { parser } from './parser.js'; export { rules } from './rules/index.js'; export * from './types.js'; -export { requireGraphQLSchemaFromContext, requireSiblingsOperations } from './utils.js'; -export { configs } from './configs/index.js'; export { flatConfigs } from './flat-configs.js'; diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index 48f0fcea3b1..e4dc5eb7eff 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -1,6 +1,6 @@ import { processor } from './processor.js'; -export { parseForESLint } from './parser.js'; +export { parser, parseForESLint } from './parser.js'; export { rules } from './rules/index.js'; export * from './types.js'; export { requireGraphQLSchemaFromContext, requireSiblingsOperations } from './utils.js'; diff --git a/packages/plugin/src/meta.ts b/packages/plugin/src/meta.ts new file mode 100644 index 00000000000..d89df8b34f3 --- /dev/null +++ b/packages/plugin/src/meta.ts @@ -0,0 +1,3 @@ +import packageJson from '../package.json' assert { type: 'json' }; + +export const { name, version } = packageJson; diff --git a/packages/plugin/src/parser.ts b/packages/plugin/src/parser.ts index 0b0649cf102..a08fe51e32b 100644 --- a/packages/plugin/src/parser.ts +++ b/packages/plugin/src/parser.ts @@ -5,6 +5,7 @@ import { parseGraphQLSDL, Source } from '@graphql-tools/utils'; import { getDocuments } from './documents.js'; import { convertToESTree, extractComments, extractTokens } from './estree-converter/index.js'; import { loadGraphQLConfig } from './graphql-config.js'; +import { version } from './meta.js'; import { getSchema } from './schema.js'; import { getSiblings } from './siblings.js'; import { GraphQLESLintParseResult, ParserOptions, Schema } from './types.js'; @@ -110,3 +111,11 @@ export function parseForESLint(code: string, options: ParserOptions): GraphQLESL throw error; } } + +export const parser = { + parseForESLint, + meta: { + name: '@graphql-eslint/parser', + version, + }, +}; diff --git a/packages/plugin/src/processor.ts b/packages/plugin/src/processor.ts index e6153b3f121..21ff05faa4e 100644 --- a/packages/plugin/src/processor.ts +++ b/packages/plugin/src/processor.ts @@ -7,6 +7,7 @@ import { } from '@graphql-tools/graphql-tag-pluck'; import { asArray } from '@graphql-tools/utils'; import { loadOnDiskGraphQLConfig } from './graphql-config.js'; +import { version } from './meta.js'; import { CWD, REPORT_ON_FIRST_CHARACTER, truthy } from './utils.js'; export type Block = Linter.ProcessorFile & { @@ -22,6 +23,10 @@ let onDiskConfigLoaded = false; const RELEVANT_KEYWORDS = ['gql', 'graphql', 'GraphQL'] as const; export const processor = { + meta: { + name: '@graphql-eslint/processor', + version, + }, supportsAutofix: true, preprocess(code, filePath) { if (!onDiskConfigLoaded) { diff --git a/packages/plugin/tsconfig.json b/packages/plugin/tsconfig.json index 0ca6e3f629c..3cbe672f218 100644 --- a/packages/plugin/tsconfig.json +++ b/packages/plugin/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "es2022", - "module": "Node16", + "module": "nodenext", "moduleResolution": "node16", "declaration": false, "noEmit": true, diff --git a/packages/plugin/tsup.config.ts b/packages/plugin/tsup.config.ts index 733a2a95c17..d8c8e06479d 100644 --- a/packages/plugin/tsup.config.ts +++ b/packages/plugin/tsup.config.ts @@ -24,6 +24,7 @@ export default defineConfig([ { ...opts, outDir: 'dist/esm', + target: 'esnext', }, { ...opts, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 29ecaa4cd99..3bc68c6b904 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,8 +29,8 @@ importers: specifier: 0.11.10 version: 0.11.10(eslint@9.8.0(patch_hash=cqyibohmktxazhgy2cj3pxovf4))(typescript@5.5.4) '@theguild/prettier-config': - specifier: 2.0.6 - version: 2.0.6(@vue/compiler-sfc@3.4.35)(prettier@3.3.3) + specifier: 2.0.7 + version: 2.0.7(@vue/compiler-sfc@3.4.35)(prettier@3.3.3) '@types/dedent': specifier: 0.7.2 version: 0.7.2 @@ -72,7 +72,7 @@ importers: version: 3.3.3 prettier-plugin-tailwindcss: specifier: 0.6.5 - version: 0.6.5(@ianvs/prettier-plugin-sort-imports@4.2.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3))(prettier@3.3.3) + version: 0.6.5(@ianvs/prettier-plugin-sort-imports@4.3.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3))(prettier@3.3.3) rimraf: specifier: 6.0.1 version: 6.0.1 @@ -1021,8 +1021,8 @@ packages: resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==} engines: {node: '>=18.18'} - '@ianvs/prettier-plugin-sort-imports@4.2.1': - resolution: {integrity: sha512-NKN1LVFWUDGDGr3vt+6Ey3qPeN/163uR1pOPAlkWpgvAqgxQ6kSdUf1F0it8aHUtKRUzEGcK38Wxd07O61d7+Q==} + '@ianvs/prettier-plugin-sort-imports@4.3.1': + resolution: {integrity: sha512-ZHwbyjkANZOjaBm3ZosADD2OUYGFzQGxfy67HmGZU94mHqe7g1LCMA7YYKB1Cq+UTPCBqlAYapY0KXAjKEw8Sg==} peerDependencies: '@vue/compiler-sfc': 2.7.x || 3.x prettier: 2 || 3 @@ -1660,8 +1660,8 @@ packages: eslint: ^8 typescript: ^5 - '@theguild/prettier-config@2.0.6': - resolution: {integrity: sha512-aEWJ422Ro9IIC+2FGEO8kgJdq6DiwafgCOLVjW6b0mgWKHgdH6VReGck6Jv+9jsa4CBh/rpRuu40uIf0KGDtEg==} + '@theguild/prettier-config@2.0.7': + resolution: {integrity: sha512-FqpgGAaAFbYHFQmkWEZjIhqmk+Oow82/t+0k408qoBd9RsB4QTwSQSDDbNSgFa/K7c8Dcwau5z3XbHUR/ksKqw==} peerDependencies: prettier: ^3 @@ -7058,7 +7058,7 @@ snapshots: '@humanwhocodes/retry@0.3.0': {} - '@ianvs/prettier-plugin-sort-imports@4.2.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3)': + '@ianvs/prettier-plugin-sort-imports@4.3.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3)': dependencies: '@babel/core': 7.24.9 '@babel/generator': 7.25.0 @@ -7677,9 +7677,9 @@ snapshots: - eslint-import-resolver-webpack - supports-color - '@theguild/prettier-config@2.0.6(@vue/compiler-sfc@3.4.35)(prettier@3.3.3)': + '@theguild/prettier-config@2.0.7(@vue/compiler-sfc@3.4.35)(prettier@3.3.3)': dependencies: - '@ianvs/prettier-plugin-sort-imports': 4.2.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3) + '@ianvs/prettier-plugin-sort-imports': 4.3.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3) prettier: 3.3.3 prettier-plugin-pkg: 0.18.1(prettier@3.3.3) prettier-plugin-sh: 0.14.0(prettier@3.3.3) @@ -11918,11 +11918,11 @@ snapshots: prettier: 3.3.3 sh-syntax: 0.4.2 - prettier-plugin-tailwindcss@0.6.5(@ianvs/prettier-plugin-sort-imports@4.2.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3))(prettier@3.3.3): + prettier-plugin-tailwindcss@0.6.5(@ianvs/prettier-plugin-sort-imports@4.3.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3))(prettier@3.3.3): dependencies: prettier: 3.3.3 optionalDependencies: - '@ianvs/prettier-plugin-sort-imports': 4.2.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3) + '@ianvs/prettier-plugin-sort-imports': 4.3.1(@vue/compiler-sfc@3.4.35)(prettier@3.3.3) prettier@2.8.8: {} diff --git a/website/next.config.js b/website/next.config.js index 871836d0048..4b7ce614357 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -22,9 +22,6 @@ export default withGuildDocs({ esquery: require.resolve('esquery'), // fixes for @eslint/eslintrc TypeError: __webpack_require__(...).pathToFileURL is not a function eslint: require.resolve('eslint').replace('lib/api.js', 'lib/linter/index.js'), - '@graphql-eslint/eslint-plugin/package.json': require.resolve( - '@graphql-eslint/eslint-plugin/package.json', - ), '@graphql-eslint/eslint-plugin': require .resolve('@graphql-eslint/eslint-plugin') .replace('cjs/index.js', 'index.browser.js'), diff --git a/website/src/components/graphql-editor.tsx b/website/src/components/graphql-editor.tsx index edca66bfd33..6fc322567fc 100644 --- a/website/src/components/graphql-editor.tsx +++ b/website/src/components/graphql-editor.tsx @@ -2,7 +2,7 @@ import { ReactElement, useEffect, useRef, useState } from 'react'; import { clsx } from 'clsx'; import { Linter } from 'eslint'; import uniqWith from 'lodash.uniqwith'; -import { parseForESLint, rules } from '@graphql-eslint/eslint-plugin'; +import { parser, rules } from '@graphql-eslint/eslint-plugin'; import Editor, { OnMount } from '@monaco-editor/react'; import { Anchor, Callout, InformationCircleIcon, useTheme } from '@theguild/components'; @@ -44,7 +44,7 @@ export function GraphQLEditor({ '@graphql-eslint': { rules }, }, languageOptions: { - parser: { parseForESLint }, + parser, parserOptions: { graphQLConfig: { schema, documents }, }, diff --git a/website/src/components/play-page.tsx b/website/src/components/play-page.tsx index 9b8406255ff..f1e079a0dd0 100644 --- a/website/src/components/play-page.tsx +++ b/website/src/components/play-page.tsx @@ -3,8 +3,7 @@ import { clsx } from 'clsx'; import { Linter } from 'eslint'; import debounce from 'lodash.debounce'; import { StringParam, useQueryParam, withDefault } from 'use-query-params'; -import { ConfigName, flatConfigs, rules } from '@graphql-eslint/eslint-plugin'; -import graphqlESLintPkgJson from '@graphql-eslint/eslint-plugin/package.json'; +import { ConfigName, flatConfigs, parser, rules } from '@graphql-eslint/eslint-plugin'; import { asArray } from '@graphql-tools/utils'; import { GraphQLEditor } from './graphql-editor'; import { Select } from './select'; @@ -114,7 +113,7 @@ export function PlayPage(): ReactElement { GraphQL-ESLint - {graphqlESLintPkgJson.version} + {parser.meta.version}