diff --git a/.changeset/itchy-ads-compete.md b/.changeset/itchy-ads-compete.md new file mode 100644 index 00000000000..4eb1a723dd7 --- /dev/null +++ b/.changeset/itchy-ads-compete.md @@ -0,0 +1,16 @@ +--- +'@graphql-eslint/eslint-plugin': major +--- + +- remove `parserOptions.schema` +- remove `parserOptions.documents` +- remove `parserOptions.extensions` +- remove `parserOptions.include` +- remove `parserOptions.exclude` +- remove `parserOptions.projects` +- remove `parserOptions.schemaOptions` +- remove `parserOptions.graphQLParserOptions` +- remove `parserOptions.skipGraphQLConfig` +- remove `parserOptions.operations` + +- add `parserOptions.graphQLConfig?: IGraphQLConfig` for programmatic usage diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0f5b702df41..da1b0e323bf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -62,10 +62,9 @@ jobs: - name: Test run: pnpm test - env: - CI: true -# - name: Lint ESLint -# run: pnpm lint + + - name: Type Check + run: pnpm typecheck # # - name: Lint Prettier # run: pnpm lint:prettier diff --git a/.gitignore b/.gitignore index 8abd0e3c784..d47c8c7b7d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,111 +1,22 @@ -# Logs -logs *.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release # Dependency directories node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ # TypeScript cache *.tsbuildinfo -# Optional npm cache directory -.npm - # Optional eslint cache .eslintcache -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - # dotenv environment variables file .env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - +.next/ +dist/ .bob/ .idea/ out/ website/public/_redirects website/public/sitemap.xml website/public/robots.txt +.turbo/ diff --git a/examples/code-file/eslint.config.js b/examples/code-file/eslint.config.js index 0e1c866bb7e..fdcf443bddb 100644 --- a/examples/code-file/eslint.config.js +++ b/examples/code-file/eslint.config.js @@ -17,9 +17,6 @@ export default [ }, languageOptions: { parser: graphqlESLint, - parserOptions: { - schema: 'schema.graphql', - }, }, rules: { '@graphql-eslint/no-anonymous-operations': 'error', diff --git a/examples/code-file/graphql.config.ts b/examples/code-file/graphql.config.ts new file mode 100644 index 00000000000..ceb196ffb2e --- /dev/null +++ b/examples/code-file/graphql.config.ts @@ -0,0 +1,3 @@ +export default { + schema: 'schema.graphql', +}; diff --git a/examples/graphql-config-code-file/.graphqlrc.yml b/examples/graphql-config-code-file/.graphqlrc.yml deleted file mode 100644 index 66dcbddfe19..00000000000 --- a/examples/graphql-config-code-file/.graphqlrc.yml +++ /dev/null @@ -1,2 +0,0 @@ -schema: schema.graphql -documents: query.js diff --git a/examples/graphql-config-code-file/eslint.config.js b/examples/graphql-config-code-file/eslint.config.js deleted file mode 100644 index 1d159b78972..00000000000 --- a/examples/graphql-config-code-file/eslint.config.js +++ /dev/null @@ -1,33 +0,0 @@ -import * as graphqlESLint from '@graphql-eslint/eslint-plugin'; -import js from '@eslint/js'; - -export default [ - { - files: ['**/*.js'], - processor: graphqlESLint.processors.graphql, - rules: js.configs.recommended.rules, - }, - { - files: ['**/*.graphql'], - plugins: { - '@graphql-eslint': graphqlESLint, - }, - languageOptions: { - parser: graphqlESLint, - }, - rules: { - '@graphql-eslint/require-id-when-available': 'error', - '@graphql-eslint/no-anonymous-operations': 'error', - '@graphql-eslint/naming-convention': [ - 'error', - { - OperationDefinition: { - style: 'PascalCase', - forbiddenPrefixes: ['Query', 'Mutation', 'Subscription', 'Get'], - forbiddenSuffixes: ['Query', 'Mutation', 'Subscription'], - }, - }, - ], - }, - }, -]; diff --git a/examples/graphql-config-code-file/package.json b/examples/graphql-config-code-file/package.json deleted file mode 100644 index a115b924d16..00000000000 --- a/examples/graphql-config-code-file/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "@graphql-eslint/example-graphql-config-code-file", - "version": "0.0.0", - "type": "module", - "repository": "https://github.com/B2o5T/graphql-eslint", - "author": "Dotan Simha ", - "private": true, - "scripts": { - "lint": "eslint ." - }, - "dependencies": { - "graphql": "16.7.1", - "graphql-tag": "2.12.6" - }, - "devDependencies": { - "@eslint/js": "8.46.0", - "@graphql-eslint/eslint-plugin": "workspace:*", - "eslint": "8.46.0" - } -} diff --git a/examples/graphql-config-code-file/query.js b/examples/graphql-config-code-file/query.js deleted file mode 100644 index 3593310f64d..00000000000 --- a/examples/graphql-config-code-file/query.js +++ /dev/null @@ -1,9 +0,0 @@ -import gql from 'graphql-tag'; - -const GET_USER = gql` - query { - user { - name - } - } -`; diff --git a/examples/graphql-config-code-file/schema.graphql b/examples/graphql-config-code-file/schema.graphql deleted file mode 100644 index 66e44f9b16c..00000000000 --- a/examples/graphql-config-code-file/schema.graphql +++ /dev/null @@ -1,8 +0,0 @@ -type Query { - user: User! -} - -type User { - id: ID! - name: String! -} diff --git a/examples/graphql-config/.graphqlrc.yml b/examples/graphql-config/.graphqlrc.yml deleted file mode 100644 index d908b1e1f8d..00000000000 --- a/examples/graphql-config/.graphqlrc.yml +++ /dev/null @@ -1,2 +0,0 @@ -schema: schema.graphql -documents: operations/*.graphql diff --git a/examples/graphql-config/graphql.config.ts b/examples/graphql-config/graphql.config.ts new file mode 100644 index 00000000000..b99a941c23f --- /dev/null +++ b/examples/graphql-config/graphql.config.ts @@ -0,0 +1,4 @@ +export default { + schema: 'schema.graphql', + documents: 'operations/*.graphql', +}; diff --git a/examples/monorepo/eslint.config.js b/examples/monorepo/eslint.config.js index 5b43a6c4077..9405c604daf 100644 --- a/examples/monorepo/eslint.config.js +++ b/examples/monorepo/eslint.config.js @@ -2,7 +2,6 @@ import * as graphqlESLint from '@graphql-eslint/eslint-plugin'; import js from '@eslint/js'; const SCHEMA_PATH = 'server/**/*.gql'; -const OPERATIONS_PATH = 'client/**/*.{tsx,gql}'; export default [ { @@ -30,10 +29,6 @@ export default [ }, languageOptions: { parser: graphqlESLint, - parserOptions: { - schema: SCHEMA_PATH, - operations: OPERATIONS_PATH, - }, }, }, { diff --git a/examples/monorepo/graphql.config.ts b/examples/monorepo/graphql.config.ts new file mode 100644 index 00000000000..c2b21c8598c --- /dev/null +++ b/examples/monorepo/graphql.config.ts @@ -0,0 +1,4 @@ +export default { + schema: 'server/**/*.gql', + documents: 'client/**/*.{tsx,gql}', +}; diff --git a/examples/multiple-projects-graphql-config/graphql.config.ts b/examples/multiple-projects-graphql-config/graphql.config.ts index b122f56b9ef..37e71f05360 100644 --- a/examples/multiple-projects-graphql-config/graphql.config.ts +++ b/examples/multiple-projects-graphql-config/graphql.config.ts @@ -12,11 +12,11 @@ const config: IGraphQLConfig = { documents: 'query.second-project.js', extensions: { // in case you want to use different names for magic comment and module identifier - pluckConfig: { + pluckConfig: { modules: [{ name: 'custom-graphql-tag', identifier: 'custom' }], globalGqlIdentifierName: 'custom', gqlMagicComment: 'MyGraphQL', - }, + } satisfies GraphQLTagPluckOptions, }, }, }, diff --git a/examples/basic/eslint.config.js b/examples/programmatic/eslint.config.js similarity index 87% rename from examples/basic/eslint.config.js rename to examples/programmatic/eslint.config.js index 5ef75ab71c1..013835cd4a9 100644 --- a/examples/basic/eslint.config.js +++ b/examples/programmatic/eslint.config.js @@ -14,8 +14,10 @@ export default [ languageOptions: { parser: graphqlESLint, parserOptions: { - schema: 'schema.graphql', - operations: ['query.graphql', 'fragment.graphql', 'fragment2.graphql'], + graphQLConfig: { + schema: 'schema.graphql', + documents: ['query.graphql', 'fragment.graphql', 'fragment2.graphql'], + }, }, }, rules: { diff --git a/examples/basic/fragment.graphql b/examples/programmatic/fragment.graphql similarity index 100% rename from examples/basic/fragment.graphql rename to examples/programmatic/fragment.graphql diff --git a/examples/basic/fragment2.graphql b/examples/programmatic/fragment2.graphql similarity index 100% rename from examples/basic/fragment2.graphql rename to examples/programmatic/fragment2.graphql diff --git a/examples/basic/package.json b/examples/programmatic/package.json similarity index 88% rename from examples/basic/package.json rename to examples/programmatic/package.json index 480fb75ea4b..3d160d0f58b 100644 --- a/examples/basic/package.json +++ b/examples/programmatic/package.json @@ -1,5 +1,5 @@ { - "name": "@graphql-eslint/example-basic", + "name": "@graphql-eslint/example-programmatic", "version": "0.0.0", "type": "module", "repository": "https://github.com/B2o5T/graphql-eslint", diff --git a/examples/basic/query.graphql b/examples/programmatic/query.graphql similarity index 100% rename from examples/basic/query.graphql rename to examples/programmatic/query.graphql diff --git a/examples/basic/schema.graphql b/examples/programmatic/schema.graphql similarity index 100% rename from examples/basic/schema.graphql rename to examples/programmatic/schema.graphql diff --git a/package.json b/package.json index c6eed3cf8a9..5d0c16fad52 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,15 @@ "ci:lint": "eslint --ignore-path .gitignore --output-file eslint_report.json --format json .", "create-rule": "tsx scripts/create-rule.ts", "generate:configs": "tsx scripts/generate-configs.ts", - "lint": "eslint --ignore-path .gitignore .", + "lint": "eslint --ignore-path .gitignore --cache .", "lint:prettier": "prettier --cache --check .", "postinstall": "tsx scripts/patch-graphql.ts", "prebuild": "rimraf tsconfig.tsbuildinfo", "prerelease": "NODE_ENV=production pnpm build", "prettier": "pnpm lint:prettier --write", "release": "changeset publish", - "test": "turbo run test --filter=!website" + "test": "turbo run test --filter=!website", + "typecheck": "turbo run typecheck" }, "devDependencies": { "@changesets/changelog-github": "0.4.8", diff --git a/packages/plugin/__tests__/__snapshots__/examples.spec.md b/packages/plugin/__tests__/__snapshots__/examples.spec.md index 1574659785c..21cbea9484e 100644 --- a/packages/plugin/__tests__/__snapshots__/examples.spec.md +++ b/packages/plugin/__tests__/__snapshots__/examples.spec.md @@ -293,10 +293,92 @@ exports[`Examples > should work in vue 1`] = ` ] `; -exports[`Examples > should work on \`.graphql\` files 1`] = ` +exports[`Examples > should work on \`.js\` files 1`] = ` [ { - filePath: examples/basic/fragment.graphql, + filePath: examples/code-file/not-query.js, + messages: [ + { + column: 1, + endColumn: 8, + endLine: 1, + line: 1, + message: 'console' is not defined., + messageId: undef, + nodeType: Identifier, + ruleId: no-undef, + severity: 2, + }, + { + column: 1, + endColumn: 12, + endLine: 1, + line: 1, + message: Unexpected console statement., + messageId: unexpected, + nodeType: MemberExpression, + ruleId: no-console, + severity: 2, + }, + ], + }, + { + filePath: examples/code-file/query.js, + messages: [ + { + column: 3, + endColumn: 8, + endLine: 4, + line: 4, + message: Anonymous GraphQL operations are forbidden. Make sure to name your query!, + messageId: no-anonymous-operations, + nodeType: null, + ruleId: @graphql-eslint/no-anonymous-operations, + severity: 2, + suggestions: [ + { + desc: Rename to \`user\`, + fix: { + range: [ + 77, + 77, + ], + text: user, + }, + }, + ], + }, + { + column: 9, + endColumn: 18, + endLine: 12, + line: 12, + message: Operation "UserQuery" should not have "Query" suffix, + nodeType: Name, + ruleId: @graphql-eslint/naming-convention, + severity: 2, + suggestions: [ + { + desc: Rename to \`User\`, + fix: { + range: [ + 165, + 174, + ], + text: User, + }, + }, + ], + }, + ], + }, +] +`; + +exports[`Examples > should work programmatically 1`] = ` +[ + { + filePath: examples/programmatic/fragment.graphql, messages: [ { column: 10, @@ -313,7 +395,7 @@ exports[`Examples > should work on \`.graphql\` files 1`] = ` ], }, { - filePath: examples/basic/fragment2.graphql, + filePath: examples/programmatic/fragment2.graphql, messages: [ { column: 10, @@ -330,7 +412,7 @@ exports[`Examples > should work on \`.graphql\` files 1`] = ` ], }, { - filePath: examples/basic/query.graphql, + filePath: examples/programmatic/query.graphql, messages: [ { column: 1, @@ -358,7 +440,7 @@ exports[`Examples > should work on \`.graphql\` files 1`] = ` ], }, { - filePath: examples/basic/schema.graphql, + filePath: examples/programmatic/schema.graphql, messages: [ { column: 3, @@ -398,88 +480,6 @@ exports[`Examples > should work on \`.graphql\` files 1`] = ` ] `; -exports[`Examples > should work on \`.js\` files 1`] = ` -[ - { - filePath: examples/code-file/not-query.js, - messages: [ - { - column: 1, - endColumn: 8, - endLine: 1, - line: 1, - message: 'console' is not defined., - messageId: undef, - nodeType: Identifier, - ruleId: no-undef, - severity: 2, - }, - { - column: 1, - endColumn: 12, - endLine: 1, - line: 1, - message: Unexpected console statement., - messageId: unexpected, - nodeType: MemberExpression, - ruleId: no-console, - severity: 2, - }, - ], - }, - { - filePath: examples/code-file/query.js, - messages: [ - { - column: 3, - endColumn: 8, - endLine: 4, - line: 4, - message: Anonymous GraphQL operations are forbidden. Make sure to name your query!, - messageId: no-anonymous-operations, - nodeType: null, - ruleId: @graphql-eslint/no-anonymous-operations, - severity: 2, - suggestions: [ - { - desc: Rename to \`user\`, - fix: { - range: [ - 77, - 77, - ], - text: user, - }, - }, - ], - }, - { - column: 9, - endColumn: 18, - endLine: 12, - line: 12, - message: Operation "UserQuery" should not have "Query" suffix, - nodeType: Name, - ruleId: @graphql-eslint/naming-convention, - severity: 2, - suggestions: [ - { - desc: Rename to \`User\`, - fix: { - range: [ - 165, - 174, - ], - text: User, - }, - }, - ], - }, - ], - }, -] -`; - exports[`Examples > should work with \`eslint-plugin-prettier\` 1`] = ` [ { @@ -970,69 +970,3 @@ exports[`Examples > should work with \`graphql-config\` 1`] = ` }, ] `; - -exports[`Examples > should work with \`graphql-config\` on \`.js\` files 1`] = ` -[ - { - filePath: examples/graphql-config-code-file/query.js, - messages: [ - { - column: 7, - endColumn: 15, - endLine: 3, - line: 3, - message: 'GET_USER' is assigned a value but never used., - messageId: unusedVar, - nodeType: Identifier, - ruleId: no-unused-vars, - severity: 2, - }, - { - column: 3, - endColumn: 8, - endLine: 4, - line: 4, - message: Anonymous GraphQL operations are forbidden. Make sure to name your query!, - messageId: no-anonymous-operations, - nodeType: null, - ruleId: @graphql-eslint/no-anonymous-operations, - severity: 2, - suggestions: [ - { - desc: Rename to \`user\`, - fix: { - range: [ - 61, - 61, - ], - text: user, - }, - }, - ], - }, - { - column: 10, - line: 5, - message: Field \`user.id\` must be selected when it's available on a type. -Include it in your selection set., - messageId: require-id-when-available, - nodeType: null, - ruleId: @graphql-eslint/require-id-when-available, - severity: 2, - suggestions: [ - { - desc: Add \`id\` selection, - fix: { - range: [ - 81, - 81, - ], - text: id , - }, - }, - ], - }, - ], - }, -] -`; diff --git a/packages/plugin/__tests__/__snapshots__/no-one-place-fragments.spec.md b/packages/plugin/__tests__/__snapshots__/no-one-place-fragments.spec.md index 04a9beaa108..453f3fe3151 100644 --- a/packages/plugin/__tests__/__snapshots__/no-one-place-fragments.spec.md +++ b/packages/plugin/__tests__/__snapshots__/no-one-place-fragments.spec.md @@ -11,6 +11,6 @@ exports[`no-one-place-fragments > invalid > should error fragment used in one pl #### ❌ Error > 1 | fragment UserFields on User { - | ^^^^^^^^^^ Fragment \`UserFields\` used only once. Inline him in "-877628611.graphql". + | ^^^^^^^^^^ Fragment \`UserFields\` used only once. Inline him in "146179389.graphql". 2 | id `; diff --git a/packages/plugin/__tests__/examples.spec.ts b/packages/plugin/__tests__/examples.spec.ts index 6ad98e5f525..44ff8bb3102 100644 --- a/packages/plugin/__tests__/examples.spec.ts +++ b/packages/plugin/__tests__/examples.spec.ts @@ -8,7 +8,10 @@ const CWD = join(PROJECT_CWD, '..', '..'); function countErrors(results: ESLint.LintResult[]): number { return results.reduce((acc, curr: ESLint.LintResult & { fatalErrorCount: number }) => { if (curr.fatalErrorCount > 0) { - throw new Error('Found fatal error'); + throw new Error(`Found fatal error: + +${results.map(result => result.messages.map(m => m.message)).join('\n\n')} + `); } return acc + curr.errorCount; }, 0); @@ -38,8 +41,8 @@ function testSnapshot(results: ESLint.LintResult[]): void { } describe('Examples', () => { - it('should work on `.graphql` files', () => { - const cwd = join(CWD, 'examples/basic'); + it('should work programmatically', () => { + const cwd = join(CWD, 'examples/programmatic'); const results = getESLintOutput(cwd); expect(countErrors(results)).toBe(6); testSnapshot(results); @@ -59,13 +62,6 @@ describe('Examples', () => { testSnapshot(results); }); - it('should work with `graphql-config` on `.js` files', () => { - const cwd = join(CWD, 'examples/graphql-config-code-file'); - const results = getESLintOutput(cwd); - expect(countErrors(results)).toBe(3); - testSnapshot(results); - }); - it('should work with `eslint-plugin-prettier`', () => { const cwd = join(CWD, 'examples/prettier'); const results = getESLintOutput(cwd); diff --git a/packages/plugin/__tests__/executable-definitions.spec.ts b/packages/plugin/__tests__/executable-definitions.spec.ts index 7135f77fe24..a85779b766b 100644 --- a/packages/plugin/__tests__/executable-definitions.spec.ts +++ b/packages/plugin/__tests__/executable-definitions.spec.ts @@ -1,6 +1,5 @@ -import { ParserOptions } from '../src'; import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; -import { ruleTester } from './test-utils'; +import { ruleTester, ParserOptionsForTests } from './test-utils'; const TEST_SCHEMA = /* GraphQL */ ` type Query { @@ -19,8 +18,10 @@ const TEST_SCHEMA = /* GraphQL */ ` const WITH_SCHEMA = { parserOptions: { - schema: TEST_SCHEMA, - } as ParserOptions, + graphQLConfig: { + schema: TEST_SCHEMA, + }, + } satisfies ParserOptionsForTests, }; ruleTester.run('executable-definitions', GRAPHQL_JS_VALIDATIONS['executable-definitions'], { diff --git a/packages/plugin/__tests__/fields-on-correct-type.spec.ts b/packages/plugin/__tests__/fields-on-correct-type.spec.ts index a312df67d03..d12037981ab 100644 --- a/packages/plugin/__tests__/fields-on-correct-type.spec.ts +++ b/packages/plugin/__tests__/fields-on-correct-type.spec.ts @@ -1,26 +1,32 @@ -import { ParserOptions, rules } from '../src'; -import { ruleTester } from './test-utils'; +import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils'; +// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this +import { RuleTester } from '@theguild/eslint-rule-tester'; +import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; -const parserOptions: Pick = { - schema: /* GraphQL */ ` - type User { - id: ID - age: Int - } +const ruleTester = new RuleTester({ + ...DEFAULT_CONFIG, + parserOptions: { + graphQLConfig: { + schema: /* GraphQL */ ` + type User { + id: ID + age: Int + } - type Query { - user: User - } - `, -}; + type Query { + user: User + } + `, + }, + }, +}); -ruleTester.run('fields-on-correct-type', rules['fields-on-correct-type'], { +ruleTester.run('fields-on-correct-type', GRAPHQL_JS_VALIDATIONS['fields-on-correct-type'], { valid: [], invalid: [ { name: 'should highlight selection on single line', code: 'fragment UserFields on User { id bad age }', - parserOptions, errors: [{ message: 'Cannot query field "bad" on type "User". Did you mean "id"?' }], }, { @@ -34,7 +40,6 @@ ruleTester.run('fields-on-correct-type', rules['fields-on-correct-type'], { } } `, - parserOptions, errors: [{ message: 'Cannot query field "veryBad" on type "User".' }], }, ], diff --git a/packages/plugin/__tests__/known-directives.spec.ts b/packages/plugin/__tests__/known-directives.spec.ts index fa60d40dfc0..23ffddacb88 100644 --- a/packages/plugin/__tests__/known-directives.spec.ts +++ b/packages/plugin/__tests__/known-directives.spec.ts @@ -1,26 +1,29 @@ -import { rules } from '../src'; +// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this import { RuleTester } from '@theguild/eslint-rule-tester'; -import { DEFAULT_CONFIG } from './test-utils'; +import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils'; +import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; -const ruleTester = new RuleTester({ +const ruleTester = new RuleTester({ ...DEFAULT_CONFIG, parserOptions: { - ...DEFAULT_CONFIG.parserOptions, - schema: /* GraphQL */ ` - type User { - id: ID! - } + graphQLConfig: { + schema: /* GraphQL */ ` + type User { + id: ID! + } - type Query { - user: User - } - `, + type Query { + user: User + } + `, + }, }, }); ruleTester.run<[{ ignoreClientDirectives: string[] }]>( 'known-directives', - rules['known-directives'], + // @ts-expect-error -- I don't know why it's complaining + GRAPHQL_JS_VALIDATIONS['known-directives'], { valid: [ { diff --git a/packages/plugin/__tests__/known-fragment-names.spec.ts b/packages/plugin/__tests__/known-fragment-names.spec.ts index d8ecbdb45be..2b220db7a63 100644 --- a/packages/plugin/__tests__/known-fragment-names.spec.ts +++ b/packages/plugin/__tests__/known-fragment-names.spec.ts @@ -1,15 +1,17 @@ import { join } from 'node:path'; -import { rules } from '../src'; import { ruleTester } from './test-utils'; +import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; -ruleTester.run('known-fragment-names', rules['known-fragment-names'], { +ruleTester.run('known-fragment-names', GRAPHQL_JS_VALIDATIONS['known-fragment-names'], { valid: [ { filename: join(__dirname, 'mocks/user.graphql'), code: ruleTester.fromMockFile('user.graphql'), parserOptions: { - schema: join(__dirname, 'mocks/user-schema.graphql'), - documents: join(__dirname, 'mocks/user-fields-with-variables.gql'), + graphQLConfig: { + schema: join(__dirname, 'mocks/user-schema.graphql'), + documents: join(__dirname, 'mocks/user-fields-with-variables.gql'), + }, }, }, { @@ -22,8 +24,10 @@ ruleTester.run('known-fragment-names', rules['known-fragment-names'], { } `, parserOptions: { - schema: join(__dirname, 'mocks/user-schema.graphql'), - documents: join(__dirname, 'mocks/known-fragment-names.ts'), + graphQLConfig: { + schema: join(__dirname, 'mocks/user-schema.graphql'), + documents: join(__dirname, 'mocks/known-fragment-names.ts'), + }, }, }, { @@ -31,11 +35,13 @@ ruleTester.run('known-fragment-names', rules['known-fragment-names'], { filename: join(__dirname, 'mocks/known-fragment-names/user.gql'), code: ruleTester.fromMockFile('known-fragment-names/user.gql'), parserOptions: { - schema: join(__dirname, 'mocks/user-schema.graphql'), - documents: [ - join(__dirname, 'mocks/known-fragment-names/user.gql'), - join(__dirname, 'mocks/known-fragment-names/user-fields.gql'), - ], + graphQLConfig: { + schema: join(__dirname, 'mocks/user-schema.graphql'), + documents: [ + join(__dirname, 'mocks/known-fragment-names/user.gql'), + join(__dirname, 'mocks/known-fragment-names/user-fields.gql'), + ], + }, }, }, { @@ -48,30 +54,32 @@ ruleTester.run('known-fragment-names', rules['known-fragment-names'], { } `, parserOptions: { - schema: /* GraphQL */ ` - interface ContentUnit { - contentSets: Int - } + graphQLConfig: { + schema: /* GraphQL */ ` + interface ContentUnit { + contentSets: Int + } - type IntroText implements ContentUnit { - contentSets: Int - } + type IntroText implements ContentUnit { + contentSets: Int + } - type Introduction { - introText: IntroText - } + type Introduction { + introText: IntroText + } - type Query { - foo: Int - } - `, - documents: /* GraphQL */ ` - fragment ContentUnit on ContentUnit { - contentSets { - id + type Query { + foo: Int } - } - `, + `, + documents: /* GraphQL */ ` + fragment ContentUnit on ContentUnit { + contentSets { + id + } + } + `, + }, }, }, { @@ -84,41 +92,43 @@ ruleTester.run('known-fragment-names', rules['known-fragment-names'], { } `, parserOptions: { - schema: /* GraphQL */ ` - type Cat { - name: String - } + graphQLConfig: { + schema: /* GraphQL */ ` + type Cat { + name: String + } - type Dog { - age: String - } + type Dog { + age: String + } - union AnimalUnion = Cat | Dog + union AnimalUnion = Cat | Dog - type Animal { - animal: AnimalUnion - } + type Animal { + animal: AnimalUnion + } - type Query { - animal: Animal - } - `, - documents: /* GraphQL */ ` - fragment CatFields on Cat { - title - } + type Query { + animal: Animal + } + `, + documents: /* GraphQL */ ` + fragment CatFields on Cat { + title + } - fragment DogFields on Dog { - url - } + fragment DogFields on Dog { + url + } - fragment AnimalFields on AnimalUnion { - animal { - ...CatFields - ...DogFields + fragment AnimalFields on AnimalUnion { + animal { + ...CatFields + ...DogFields + } } - } - `, + `, + }, }, }, ], @@ -128,11 +138,13 @@ ruleTester.run('known-fragment-names', rules['known-fragment-names'], { filename: join(__dirname, 'mocks/known-fragment-names/operation-with-undefined-fragment.gql'), code: ruleTester.fromMockFile('known-fragment-names/operation-with-undefined-fragment.gql'), parserOptions: { - schema: join(__dirname, 'mocks/user-schema.graphql'), - documents: join( - __dirname, - 'mocks/known-fragment-names/operation-with-undefined-fragment.gql', - ), + graphQLConfig: { + schema: join(__dirname, 'mocks/user-schema.graphql'), + documents: join( + __dirname, + 'mocks/known-fragment-names/operation-with-undefined-fragment.gql', + ), + }, }, errors: [{ message: 'Unknown fragment "DoesNotExist".' }], }, diff --git a/packages/plugin/__tests__/mocks/graphql-server.ts b/packages/plugin/__tests__/mocks/graphql-server.ts index 751d81f6cdb..896f9346141 100644 --- a/packages/plugin/__tests__/mocks/graphql-server.ts +++ b/packages/plugin/__tests__/mocks/graphql-server.ts @@ -4,6 +4,7 @@ import { resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; import { buildSchema, introspectionFromSchema } from 'graphql'; +// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this const __dirname = fileURLToPath(new URL('.', import.meta.url)); const sdlSchema = readFileSync(resolve(__dirname, 'user-schema.graphql'), 'utf8'); @@ -40,7 +41,7 @@ class TestGraphQLServer { } private async router(req: IncomingMessage, res: ServerResponse): Promise { - const { pathname } = new URL(req.url, this.base); + const { pathname } = new URL(req.url!, this.base); if (pathname === '/') { const { query } = await this.parseData(req); diff --git a/packages/plugin/__tests__/naming-convention.spec.ts b/packages/plugin/__tests__/naming-convention.spec.ts index 9b144a1168b..a84ae7c686d 100644 --- a/packages/plugin/__tests__/naming-convention.spec.ts +++ b/packages/plugin/__tests__/naming-convention.spec.ts @@ -395,7 +395,7 @@ ruleTester.run('naming-convention', rule, { subscriptionField: ID } `, - options: (rule.meta.docs.configOptions as any).schema, + options: (rule.meta.docs!.configOptions as any).schema, errors: [ { message: 'Field "fieldQuery" should not have "Query" suffix' }, { message: 'Field "queryField" should not have "query" prefix' }, @@ -423,7 +423,7 @@ ruleTester.run('naming-convention', rule, { fragment TestFragment on Test { id } fragment FragmentTest on Test { id } `, - options: (rule.meta.docs.configOptions as any).operations, + options: (rule.meta.docs!.configOptions as any).operations, errors: [ { message: 'Operation "TestQuery" should not have "Query" suffix' }, { message: 'Operation "QueryTest" should not have "Query" prefix' }, diff --git a/packages/plugin/__tests__/no-deprecated.spec.ts b/packages/plugin/__tests__/no-deprecated.spec.ts index e0a0eb809e6..78a45281e06 100644 --- a/packages/plugin/__tests__/no-deprecated.spec.ts +++ b/packages/plugin/__tests__/no-deprecated.spec.ts @@ -1,6 +1,5 @@ -import { ParserOptions } from '../src'; import { rule } from '../src/rules/no-deprecated'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; const TEST_SCHEMA = /* GraphQL */ ` type Query { @@ -22,9 +21,10 @@ const TEST_SCHEMA = /* GraphQL */ ` const WITH_SCHEMA = { parserOptions: { - schema: TEST_SCHEMA, - documents: [], - } as ParserOptions, + graphQLConfig: { + schema: TEST_SCHEMA, + }, + } satisfies ParserOptionsForTests, }; ruleTester.run('no-deprecated', rule, { diff --git a/packages/plugin/__tests__/no-one-place-fragments.spec.ts b/packages/plugin/__tests__/no-one-place-fragments.spec.ts index 28deb2d4d80..6542bdd099c 100644 --- a/packages/plugin/__tests__/no-one-place-fragments.spec.ts +++ b/packages/plugin/__tests__/no-one-place-fragments.spec.ts @@ -8,7 +8,9 @@ ruleTester.run('no-one-place-fragments', rule, { name: 'ok when spread 2 times', code: ruleTester.fromMockFile('no-one-place-fragments.graphql'), parserOptions: { - documents: join(__dirname, 'mocks/no-one-place-fragments.graphql'), + graphQLConfig: { + documents: join(__dirname, 'mocks/no-one-place-fragments.graphql'), + }, }, }, ], @@ -17,16 +19,18 @@ ruleTester.run('no-one-place-fragments', rule, { name: 'should error fragment used in one place', code: ruleTester.fromMockFile('user-fields.graphql'), errors: [ - { message: 'Fragment `UserFields` used only once. Inline him in "-877628611.graphql".' }, + { message: 'Fragment `UserFields` used only once. Inline him in "146179389.graphql".' }, ], parserOptions: { - documents: /* GraphQL */ ` - { - user { - ...UserFields + graphQLConfig: { + documents: /* GraphQL */ ` + { + user { + ...UserFields + } } - } - `, + `, + }, }, }, ], diff --git a/packages/plugin/__tests__/no-root-type.spec.ts b/packages/plugin/__tests__/no-root-type.spec.ts index 2e94f8813c8..7842b23dd3f 100644 --- a/packages/plugin/__tests__/no-root-type.spec.ts +++ b/packages/plugin/__tests__/no-root-type.spec.ts @@ -1,15 +1,13 @@ -import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/no-root-type'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; -const useSchema = ( - code: string, - schema = '', -): { code: string; parserOptions: Pick } => ({ +const useSchema = (code: string, schema = '') => ({ code, parserOptions: { - schema: schema + code, - }, + graphQLConfig: { + schema: schema + code, + }, + } satisfies ParserOptionsForTests, }); ruleTester.run('no-root-type', rule, { diff --git a/packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts b/packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts index bcfc821e17a..4396482cb5b 100644 --- a/packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts +++ b/packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts @@ -1,20 +1,19 @@ -import { ParserOptions } from '../src'; import { rule } from '../src/rules/no-scalar-result-type-on-mutation'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; -const useSchema = ( - code: string, -): { code: string; parserOptions: Pick } => ({ +const useSchema = (code: string) => ({ code, parserOptions: { - schema: /* GraphQL */ ` - type User { - id: ID! - } + graphQLConfig: { + schema: /* GraphQL */ ` + type User { + id: ID! + } - ${code} - `, - }, + ${code} + `, + }, + } satisfies ParserOptionsForTests, }); ruleTester.run('no-scalar-result-type-on-mutation', rule, { diff --git a/packages/plugin/__tests__/no-undefined-variables.spec.ts b/packages/plugin/__tests__/no-undefined-variables.spec.ts index 95de47b0b14..fb36f54ebfb 100644 --- a/packages/plugin/__tests__/no-undefined-variables.spec.ts +++ b/packages/plugin/__tests__/no-undefined-variables.spec.ts @@ -1,16 +1,18 @@ import { join } from 'node:path'; -import { rules } from '../src'; import { ruleTester } from './test-utils'; +import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; -ruleTester.run('no-undefined-variables', rules['no-undefined-variables'], { +ruleTester.run('no-undefined-variables', GRAPHQL_JS_VALIDATIONS['no-undefined-variables'], { valid: [], invalid: [ { filename: join(__dirname, 'mocks/no-undefined-variables.gql'), code: ruleTester.fromMockFile('no-undefined-variables.gql'), parserOptions: { - schema: join(__dirname, 'mocks/user-schema.graphql'), - documents: join(__dirname, 'mocks/user-fields-with-variables.gql'), + graphQLConfig: { + schema: join(__dirname, 'mocks/user-schema.graphql'), + documents: join(__dirname, 'mocks/user-fields-with-variables.gql'), + }, }, errors: [ { message: 'Variable "$limit" is not defined by operation "User".' }, diff --git a/packages/plugin/__tests__/no-unreachable-types.spec.ts b/packages/plugin/__tests__/no-unreachable-types.spec.ts index 52d562ea288..401050a8754 100644 --- a/packages/plugin/__tests__/no-unreachable-types.spec.ts +++ b/packages/plugin/__tests__/no-unreachable-types.spec.ts @@ -1,129 +1,137 @@ -import { ParserOptions } from '../src'; import { rule } from '../src/rules/no-unreachable-types'; -import { ruleTester } from './test-utils'; - -const useSchema = ( - schema: string, -): { code: string; parserOptions: Pick } => { - return { - parserOptions: { schema }, - code: schema, - }; -}; +import { ruleTester, withSchema } from './test-utils'; ruleTester.run('no-unreachable-types', rule, { valid: [ - useSchema(/* GraphQL */ ` - scalar A - scalar B - - # UnionTypeDefinition - union Response = A | B - - type Query { - foo: Response - } - `), - useSchema(/* GraphQL */ ` - type Query { - me: User - } - - # ObjectTypeDefinition - type User { - id: ID - name: String - } - `), - useSchema(/* GraphQL */ ` - type Query { - me: User - } - - # InterfaceTypeDefinition - interface Address { - city: String - } - - type User implements Address { - city: String - } - `), - useSchema(/* GraphQL */ ` - # ScalarTypeDefinition - scalar DateTime - - type Query { - now: DateTime - } - `), - useSchema(/* GraphQL */ ` - # EnumTypeDefinition - enum Role { - ADMIN - USER - } - - type Query { - role: Role - } - `), - useSchema(/* GraphQL */ ` - input UserInput { - id: ID - } - - type Query { - # InputValueDefinition - user(input: UserInput!): Boolean - } - `), - useSchema(/* GraphQL */ ` - # DirectiveDefinition - directive @auth(role: [Role!]!) on FIELD_DEFINITION - - enum Role { - ADMIN - USER - } - - type Query { - # Directive - user: ID @auth(role: [ADMIN]) - } - `), - useSchema(/* GraphQL */ ` - type RootQuery - type RootMutation - type RootSubscription - - schema { - query: RootQuery - mutation: RootMutation - subscription: RootSubscription - } - `), - useSchema(/* GraphQL */ ` - interface User { - id: ID! - } - - interface Manager implements User { - id: ID! - } - - type TopManager implements Manager { - id: ID! - name: String - } - - type Query { - me: User - } - `), - { + withSchema({ + code: /* GraphQL */ ` + scalar A + scalar B + + # UnionTypeDefinition + union Response = A | B + + type Query { + foo: Response + } + `, + }), + withSchema({ + code: /* GraphQL */ ` + type Query { + me: User + } + + # ObjectTypeDefinition + type User { + id: ID + name: String + } + `, + }), + withSchema({ + code: /* GraphQL */ ` + type Query { + me: User + } + + # InterfaceTypeDefinition + interface Address { + city: String + } + + type User implements Address { + city: String + } + `, + }), + withSchema({ + code: /* GraphQL */ ` + # ScalarTypeDefinition + scalar DateTime + + type Query { + now: DateTime + } + `, + }), + withSchema({ + code: /* GraphQL */ ` + # EnumTypeDefinition + enum Role { + ADMIN + USER + } + + type Query { + role: Role + } + `, + }), + withSchema({ + code: /* GraphQL */ ` + input UserInput { + id: ID + } + + type Query { + # InputValueDefinition + user(input: UserInput!): Boolean + } + `, + }), + withSchema({ + code: /* GraphQL */ ` + # DirectiveDefinition + directive @auth(role: [Role!]!) on FIELD_DEFINITION + + enum Role { + ADMIN + USER + } + + type Query { + # Directive + user: ID @auth(role: [ADMIN]) + } + `, + }), + withSchema({ + code: /* GraphQL */ ` + type RootQuery + type RootMutation + type RootSubscription + + schema { + query: RootQuery + mutation: RootMutation + subscription: RootSubscription + } + `, + }), + withSchema({ + code: /* GraphQL */ ` + interface User { + id: ID! + } + + interface Manager implements User { + id: ID! + } + + type TopManager implements Manager { + id: ID! + name: String + } + + type Query { + me: User + } + `, + }), + withSchema({ name: 'directive on schema', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type Query schema @good { @@ -131,11 +139,11 @@ ruleTester.run('no-unreachable-types', rule, { } directive @good on SCHEMA - `), - }, - { + `, + }), + withSchema({ name: 'should ignore directive with request locations', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` directive @q on QUERY directive @w on MUTATION directive @e on SUBSCRIPTION @@ -145,23 +153,23 @@ ruleTester.run('no-unreachable-types', rule, { directive @u on INLINE_FRAGMENT directive @i on VARIABLE_DEFINITION type Query - `), - }, - { + `, + }), + withSchema({ name: 'should ignore types from directive arguments with request locations', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` enum Enum { A B } directive @q(arg: Enum = A) on QUERY type Query - `), - }, + `, + }), ], invalid: [ - { - ...useSchema(/* GraphQL */ ` + withSchema({ + code: /* GraphQL */ ` type Query { node(id: ID!): AnotherNode! } @@ -184,15 +192,15 @@ ruleTester.run('no-unreachable-types', rule, { name: String address: String } - `), + `, errors: [ { message: 'Interface type `Node` is unreachable.' }, { message: 'Interface type `User` is unreachable.' }, { message: 'Object type `SuperUser` is unreachable.' }, ], - }, - { - ...useSchema(/* GraphQL */ ` + }), + withSchema({ + code: /* GraphQL */ ` # ScalarTypeDefinition scalar DateTime @@ -222,7 +230,7 @@ ruleTester.run('no-unreachable-types', rule, { type User implements Address { city: String } - `), + `, errors: [ { message: 'Scalar type `DateTime` is unreachable.' }, { message: 'Enum type `Role` is unreachable.' }, @@ -232,9 +240,9 @@ ruleTester.run('no-unreachable-types', rule, { { message: 'Interface type `Address` is unreachable.' }, { message: 'Object type `User` is unreachable.' }, ], - }, - { - ...useSchema(/* GraphQL */ ` + }), + withSchema({ + code: /* GraphQL */ ` interface User { id: String } @@ -253,11 +261,11 @@ ruleTester.run('no-unreachable-types', rule, { } scalar DateTime - `), + `, errors: [{ message: 'Scalar type `DateTime` is unreachable.' }], - }, - { - ...useSchema(/* GraphQL */ ` + }), + withSchema({ + code: /* GraphQL */ ` interface User { id: String } @@ -278,15 +286,15 @@ ruleTester.run('no-unreachable-types', rule, { type Query { user: AnotherUser! } - `), + `, errors: [ { message: 'Interface type `User` is unreachable.' }, { message: 'Object type `SuperUser` is unreachable.' }, { message: 'Object type `SuperUser` is unreachable.' }, ], - }, - { - ...useSchema(/* GraphQL */ ` + }), + withSchema({ + code: /* GraphQL */ ` type Query { node(id: ID!): Node! } @@ -307,8 +315,8 @@ ruleTester.run('no-unreachable-types', rule, { } scalar DateTime - `), + `, errors: [{ message: 'Scalar type `DateTime` is unreachable.' }], - }, + }), ], }); diff --git a/packages/plugin/__tests__/no-unused-fields.spec.ts b/packages/plugin/__tests__/no-unused-fields.spec.ts index 3ce922792e3..d03e9272f7b 100644 --- a/packages/plugin/__tests__/no-unused-fields.spec.ts +++ b/packages/plugin/__tests__/no-unused-fields.spec.ts @@ -1,6 +1,7 @@ import { rule } from '../src/rules/no-unused-fields'; +// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this import { RuleTester } from '@theguild/eslint-rule-tester'; -import { DEFAULT_CONFIG } from './test-utils'; +import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils'; const SCHEMA = /* GraphQL */ ` type User { @@ -39,11 +40,12 @@ const SCHEMA = /* GraphQL */ ` } `; -const ruleTester = new RuleTester({ +const ruleTester = new RuleTester({ ...DEFAULT_CONFIG, parserOptions: { - ...DEFAULT_CONFIG.parserOptions, - schema: SCHEMA, + graphQLConfig: { + schema: SCHEMA, + }, }, }); @@ -52,42 +54,44 @@ ruleTester.run('no-unused-fields', rule, { { code: SCHEMA, parserOptions: { - documents: /* GraphQL */ ` - { - user(id: 1) { - ... on User { - address { - zip - events { - ... on Event { - by { - id + graphQLConfig: { + documents: /* GraphQL */ ` + { + user(id: 1) { + ... on User { + address { + zip + events { + ... on Event { + by { + id + } + can_rename: name + data } - can_rename: name - data } } } } } - } - - fragment UserFields on User { - can_rename: firstName - lastName - } - mutation { - deleteUser(id: 2) { - age + fragment UserFields on User { + can_rename: firstName + lastName } - createUser(firstName: "Foo") { - address { - country + + mutation { + deleteUser(id: 2) { + age + } + createUser(firstName: "Foo") { + address { + country + } } } - } - `, + `, + }, }, }, ], @@ -100,13 +104,15 @@ ruleTester.run('no-unused-fields', rule, { } `, parserOptions: { - documents: /* GraphQL */ ` - { - user(id: 1) { - id + graphQLConfig: { + documents: /* GraphQL */ ` + { + user(id: 1) { + id + } } - } - `, + `, + }, }, errors: [{ message: 'Field "firstName" is unused' }], }, @@ -121,13 +127,15 @@ ruleTester.run('no-unused-fields', rule, { } `, parserOptions: { - documents: /* GraphQL */ ` - { - user(id: 1) { - id + graphQLConfig: { + documents: /* GraphQL */ ` + { + user(id: 1) { + id + } } - } - `, + `, + }, }, errors: [{ message: 'Field "deleteUser" is unused' }], }, diff --git a/packages/plugin/__tests__/no-unused-fragments.spec.ts b/packages/plugin/__tests__/no-unused-fragments.spec.ts index 9d2c273743e..3aa1c3f9189 100644 --- a/packages/plugin/__tests__/no-unused-fragments.spec.ts +++ b/packages/plugin/__tests__/no-unused-fragments.spec.ts @@ -1,20 +1,22 @@ import { join } from 'node:path'; -import { rules } from '../src'; import { ruleTester } from './test-utils'; +import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; -ruleTester.run('no-unused-fragments', rules['no-unused-fragments'], { +ruleTester.run('no-unused-fragments', GRAPHQL_JS_VALIDATIONS['no-unused-fragments'], { valid: [ { name: 'should find file with operation definition that import current fragment', filename: join(__dirname, 'mocks/user-fields.graphql'), code: ruleTester.fromMockFile('user-fields.graphql'), parserOptions: { - schema: join(__dirname, 'mocks/user-schema.graphql'), - documents: [ - join(__dirname, 'mocks/user-fields.graphql'), - join(__dirname, 'mocks/post-fields.graphql'), - join(__dirname, 'mocks/post.graphql'), - ], + graphQLConfig: { + schema: join(__dirname, 'mocks/user-schema.graphql'), + documents: [ + join(__dirname, 'mocks/user-fields.graphql'), + join(__dirname, 'mocks/post-fields.graphql'), + join(__dirname, 'mocks/post.graphql'), + ], + }, }, }, ], diff --git a/packages/plugin/__tests__/no-unused-variables.spec.ts b/packages/plugin/__tests__/no-unused-variables.spec.ts index d7b4b8b6d3c..b19167181a1 100644 --- a/packages/plugin/__tests__/no-unused-variables.spec.ts +++ b/packages/plugin/__tests__/no-unused-variables.spec.ts @@ -1,15 +1,17 @@ import { join } from 'node:path'; -import { rules } from '../src'; import { ruleTester } from './test-utils'; +import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; -ruleTester.run('no-unused-variables', rules['no-unused-variables'], { +ruleTester.run('no-unused-variables', GRAPHQL_JS_VALIDATIONS['no-unused-variables'], { valid: [ { filename: join(__dirname, 'mocks/no-unused-variables.gql'), code: ruleTester.fromMockFile('no-unused-variables.gql'), parserOptions: { - schema: join(__dirname, 'mocks/user-schema.graphql'), - documents: join(__dirname, 'mocks/user-fields-with-variables.gql'), + graphQLConfig: { + schema: join(__dirname, 'mocks/user-schema.graphql'), + documents: join(__dirname, 'mocks/user-fields-with-variables.gql'), + }, }, }, ], diff --git a/packages/plugin/__tests__/parser.spec.ts b/packages/plugin/__tests__/parser.spec.ts index 2dd548bf9bb..8bc4df3a245 100644 --- a/packages/plugin/__tests__/parser.spec.ts +++ b/packages/plugin/__tests__/parser.spec.ts @@ -9,7 +9,8 @@ describe('Parser', () => { type Query `; - const result = parseForESLint(code, { filePath: 'test.graphql' }); + // @ts-expect-error -- empty object to run programmatic config + const result = parseForESLint(code, { graphQLConfig: {}, filePath: 'test.graphql' }); expect(result.ast).toMatchSnapshot(); expect(result.ast.tokens).toBeTruthy(); }); @@ -31,7 +32,8 @@ describe('Parser', () => { } `; - const result = parseForESLint(code, { filePath: 'test.graphql' }); + // @ts-expect-error -- empty object to run programmatic config + const result = parseForESLint(code, { graphQLConfig: {}, filePath: 'test.graphql' }); const field = (result.ast.body[0] as any).definitions[0].variableDefinitions[0]; expect(field.type).toBe('VariableDefinition'); @@ -58,8 +60,7 @@ describe('Parser', () => { const result = parseForESLint(code, { filePath: 'test.graphql', - schema, - skipGraphQLConfig: true, + graphQLConfig: { schema }, }); const { selectionSet } = (result.ast.body[0] as any).definitions[0]; const typeInfo = selectionSet.typeInfo(); diff --git a/packages/plugin/__tests__/possible-type-extension.spec.ts b/packages/plugin/__tests__/possible-type-extension.spec.ts index 5ac68d5072d..06cfd2feee1 100644 --- a/packages/plugin/__tests__/possible-type-extension.spec.ts +++ b/packages/plugin/__tests__/possible-type-extension.spec.ts @@ -1,27 +1,27 @@ import { join } from 'node:path'; -import { ParserOptions, rules } from '../src'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; +import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; -const useUserSchema = ( - code: string, -): { code: string; parserOptions: Pick } => { +const useUserSchema = (code: string) => { return { code, parserOptions: { - schema: /* GraphQL */ ` - type User { - id: ID - } + graphQLConfig: { + schema: /* GraphQL */ ` + type User { + id: ID + } - type Query { - user: User - } - `, - }, + type Query { + user: User + } + `, + }, + } satisfies ParserOptionsForTests, }; }; -ruleTester.run('possible-type-extension', rules['possible-type-extension'], { +ruleTester.run('possible-type-extension', GRAPHQL_JS_VALIDATIONS['possible-type-extension'], { valid: [ useUserSchema(/* GraphQL */ ` extend type User { @@ -36,7 +36,9 @@ ruleTester.run('possible-type-extension', rules['possible-type-extension'], { ), code: ruleTester.fromMockFile('possible-type-extension/separate-graphql-files/type-user.gql'), parserOptions: { - schema: join(__dirname, 'mocks/possible-type-extension/separate-graphql-files/*.gql'), + graphQLConfig: { + schema: join(__dirname, 'mocks/possible-type-extension/separate-graphql-files/*.gql'), + }, }, }, { @@ -48,7 +50,9 @@ ruleTester.run('possible-type-extension', rules['possible-type-extension'], { } `, parserOptions: { - schema: join(__dirname, 'mocks/possible-type-extension/separate-code-files/*.ts'), + graphQLConfig: { + schema: join(__dirname, 'mocks/possible-type-extension/separate-code-files/*.ts'), + }, }, }, { @@ -56,7 +60,9 @@ ruleTester.run('possible-type-extension', rules['possible-type-extension'], { filename: join(__dirname, 'mocks/possible-type-extension/one-graphql-file/type-user.gql'), code: ruleTester.fromMockFile('possible-type-extension/one-graphql-file/type-user.gql'), parserOptions: { - schema: join(__dirname, 'mocks/possible-type-extension/one-graphql-file/type-user.gql'), + graphQLConfig: { + schema: join(__dirname, 'mocks/possible-type-extension/one-graphql-file/type-user.gql'), + }, }, }, ], diff --git a/packages/plugin/__tests__/relay-arguments.spec.ts b/packages/plugin/__tests__/relay-arguments.spec.ts index 9d161cf18b7..3a8202a739a 100644 --- a/packages/plugin/__tests__/relay-arguments.spec.ts +++ b/packages/plugin/__tests__/relay-arguments.spec.ts @@ -1,17 +1,18 @@ -import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/relay-arguments'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; -function useSchema(code: string): { code: string; parserOptions: Pick } { +function useSchema(code: string) { return { code, parserOptions: { - schema: /* GraphQL */ ` - ${code} - type PostConnection - type Query - `, - }, + graphQLConfig: { + schema: /* GraphQL */ ` + type PostConnection + type Query + ${code} + `, + }, + } satisfies ParserOptionsForTests, }; } diff --git a/packages/plugin/__tests__/relay-edge-types.spec.ts b/packages/plugin/__tests__/relay-edge-types.spec.ts index c43466e2718..af3ac34e3f2 100644 --- a/packages/plugin/__tests__/relay-edge-types.spec.ts +++ b/packages/plugin/__tests__/relay-edge-types.spec.ts @@ -1,22 +1,12 @@ -import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/relay-edge-types'; -import { ruleTester } from './test-utils'; - -function useSchema(code: string): { code: string; parserOptions: Pick } { - return { - code, - parserOptions: { - schema: code, - }, - }; -} +import { ruleTester, withSchema } from './test-utils'; ruleTester.run('relay-edge-types', rule, { valid: [ - { + withSchema({ name: 'when cursor returns string', options: [{ shouldImplementNode: false }], - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type AEdge { node: Int! cursor: String! @@ -24,11 +14,11 @@ ruleTester.run('relay-edge-types', rule, { type AConnection { edges: [AEdge] } - `), - }, - { + `, + }), + withSchema({ name: 'cursor returns scalar', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` scalar Email type AEdge { node: Email! @@ -37,12 +27,12 @@ ruleTester.run('relay-edge-types', rule, { type AConnection { edges: [AEdge] } - `), - }, - { + `, + }), + withSchema({ name: 'with Edge suffix', options: [{ withEdgeSuffix: true }], - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` scalar Email type AEdge { node: Email! @@ -51,12 +41,12 @@ ruleTester.run('relay-edge-types', rule, { type AConnection { edges: [AEdge] } - `), - }, - { + `, + }), + withSchema({ name: 'should implements Node', options: [{ shouldImplementNode: true }], - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` interface Node { id: ID! } @@ -70,11 +60,11 @@ ruleTester.run('relay-edge-types', rule, { type AConnection { edges: [AEdge] } - `), - }, - { + `, + }), + withSchema({ name: 'should not throw when not Object type is used', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type AEdge { node: Int! cursor: String! @@ -82,14 +72,14 @@ ruleTester.run('relay-edge-types', rule, { type AConnection { edges: [AEdge] } - `), - }, + `, + }), ], invalid: [ - { + withSchema({ name: 'Edge type must be Object type', options: [{ shouldImplementNode: false, listTypeCanWrapOnlyEdgeType: false }], - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type PageInfo type BConnection type DConnection @@ -113,25 +103,25 @@ ruleTester.run('relay-edge-types', rule, { edges: [DEdge!]! pageInfo: PageInfo! } - `), + `, errors: 4, - }, - { + }), + withSchema({ name: 'should report when fields is missing', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type PageInfo type AEdge type AConnection { edges: [AEdge] pageInfo: PageInfo! } - `), + `, errors: 2, - }, - { + }), + withSchema({ name: 'should report cursor when list is used', options: [{ shouldImplementNode: false, listTypeCanWrapOnlyEdgeType: false }], - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type PageInfo type AEdge { node: [PageInfo!]! @@ -141,13 +131,13 @@ ruleTester.run('relay-edge-types', rule, { edges: [AEdge] pageInfo: PageInfo! } - `), + `, errors: 2, - }, - { + }), + withSchema({ name: 'should report when without Edge suffix', options: [{ withEdgeSuffix: true }], - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` scalar Email type Aedge { node: Email! @@ -156,13 +146,13 @@ ruleTester.run('relay-edge-types', rule, { type AConnection { edges: [Aedge] } - `), + `, errors: 1, - }, - { + }), + withSchema({ name: 'list type', options: [{ listTypeCanWrapOnlyEdgeType: true }], - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type AEdge { node: Int! cursor: String! @@ -176,13 +166,13 @@ ruleTester.run('relay-edge-types', rule, { messages: [Int]! posts: [Int!]! } - `), + `, errors: 4, - }, - { + }), + withSchema({ name: 'should implements Node', options: [{ shouldImplementNode: true }], - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type User { id: ID! } @@ -193,8 +183,8 @@ ruleTester.run('relay-edge-types', rule, { type AConnection { edges: [AEdge] } - `), + `, errors: 1, - }, + }), ], }); diff --git a/packages/plugin/__tests__/relay-page-info.spec.ts b/packages/plugin/__tests__/relay-page-info.spec.ts index 3ae600eaf85..9f680d8a6fa 100644 --- a/packages/plugin/__tests__/relay-page-info.spec.ts +++ b/packages/plugin/__tests__/relay-page-info.spec.ts @@ -1,46 +1,38 @@ -import { ParserOptions } from '../src'; import { rule } from '../src/rules/relay-page-info'; -import { ruleTester } from './test-utils'; - -function useSchema(code: string): { code: string; parserOptions: Pick } { - return { - code, - parserOptions: { - schema: code, - }, - }; -} +import { ruleTester, withSchema } from './test-utils'; ruleTester.run('relay-page-info', rule, { valid: [ - useSchema(/* GraphQL */ ` - type PageInfo { - hasPreviousPage: Boolean! - hasNextPage: Boolean! - startCursor: String - endCursor: String - } - `), - { + withSchema({ + code: /* GraphQL */ ` + type PageInfo { + hasPreviousPage: Boolean! + hasNextPage: Boolean! + startCursor: String + endCursor: String + } + `, + }), + withSchema({ name: 'startCursor/endCursor can be Scalar', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type PageInfo { hasPreviousPage: Boolean! hasNextPage: Boolean! startCursor: Int endCursor: Float } - `), - }, + `, + }), ], invalid: [ - { - ...useSchema('scalar PageInfo'), + withSchema({ + code: 'scalar PageInfo', errors: 1, - }, - { + }), + withSchema({ name: 'when union', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` union PageInfo = UserConnection | Post extend union PageInfo = Comment type UserConnection { @@ -50,12 +42,12 @@ ruleTester.run('relay-page-info', rule, { type Post type Comment type UserEdge - `), + `, errors: 2, - }, - { + }), + withSchema({ name: 'when input', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` input PageInfo extend input PageInfo { hasPreviousPage: Boolean! @@ -63,12 +55,12 @@ ruleTester.run('relay-page-info', rule, { startCursor: String endCursor: String } - `), + `, errors: 2, - }, - { + }), + withSchema({ name: 'when enum', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` enum PageInfo extend enum PageInfo { hasPreviousPage @@ -76,12 +68,12 @@ ruleTester.run('relay-page-info', rule, { startCursor endCursor } - `), + `, errors: 2, - }, - { + }), + withSchema({ name: 'when interface', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` interface PageInfo extend interface PageInfo { hasPreviousPage: Boolean! @@ -89,12 +81,12 @@ ruleTester.run('relay-page-info', rule, { startCursor: String endCursor: String } - `), + `, errors: 2, - }, - { + }), + withSchema({ name: 'when extend type', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type PageInfo extend type PageInfo { hasPreviousPage: Boolean! @@ -102,23 +94,23 @@ ruleTester.run('relay-page-info', rule, { startCursor: String endCursor: String } - `), + `, errors: 4, - }, - { + }), + withSchema({ name: 'when fields is missing or incorrect return type', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type PageInfo { hasPreviousPage: [Boolean!]! startCursor: [String] } - `), + `, errors: 4, - }, - { + }), + withSchema({ name: 'when `PageInfo` is missing', - ...useSchema('type Query'), + code: 'type Query', errors: 1, - }, + }), ], }); diff --git a/packages/plugin/__tests__/require-description.spec.ts b/packages/plugin/__tests__/require-description.spec.ts index 10f126d8b91..08b462b98fd 100644 --- a/packages/plugin/__tests__/require-description.spec.ts +++ b/packages/plugin/__tests__/require-description.spec.ts @@ -1,6 +1,5 @@ -import { ParserOptions } from '../src'; import { rule, RuleOptions, RULE_ID } from '../src/rules/require-description'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; const OPERATION = { OperationDefinition: true }; @@ -232,17 +231,19 @@ ruleTester.run('require-description', rule, { ], }); -function useSchema(code: string): { code: string; parserOptions: Pick } { +function useSchema(code: string) { return { code, parserOptions: { - schema: /* GraphQL */ ` - type User { - id: ID! - } + graphQLConfig: { + schema: /* GraphQL */ ` + type User { + id: ID! + } - ${code} - `, - }, + ${code} + `, + }, + } satisfies ParserOptionsForTests, }; } diff --git a/packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts b/packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts index df6c0440f34..e3a48e85fd6 100644 --- a/packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts +++ b/packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts @@ -1,20 +1,19 @@ -import { ParserOptions } from '../src'; import { rule } from '../src/rules/require-field-of-type-query-in-mutation-result'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; -const useSchema = ( - code: string, -): { code: string; parserOptions: Pick } => ({ +const useSchema = (code: string) => ({ code, parserOptions: { - schema: /* GraphQL */ ` - type User { - id: ID! - } + graphQLConfig: { + schema: /* GraphQL */ ` + type User { + id: ID! + } - ${code} - `, - }, + ${code} + `, + }, + } satisfies ParserOptionsForTests, }); ruleTester.run('require-field-of-type-query-in-mutation-result', rule, { diff --git a/packages/plugin/__tests__/require-id-when-available.spec.ts b/packages/plugin/__tests__/require-id-when-available.spec.ts index 9d8498744cc..b9911f635ec 100644 --- a/packages/plugin/__tests__/require-id-when-available.spec.ts +++ b/packages/plugin/__tests__/require-id-when-available.spec.ts @@ -1,6 +1,5 @@ -import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/require-id-when-available'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; const TEST_SCHEMA = /* GraphQL */ ` type Query { @@ -62,9 +61,11 @@ const USER_POST_SCHEMA = /* GraphQL */ ` const WITH_SCHEMA = { parserOptions: { - schema: TEST_SCHEMA, - documents: '{ foo }', - } as ParserOptions, + graphQLConfig: { + schema: TEST_SCHEMA, + documents: '{ foo }', + }, + } satisfies ParserOptionsForTests, }; const MESSAGE_ID = { messageId: 'require-id-when-available' }; @@ -92,16 +93,20 @@ ruleTester.run('require-id-when-available', rule, { } `, parserOptions: { - schema: USER_POST_SCHEMA, - documents: '{ foo }', + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: '{ foo }', + }, }, }, { name: "should ignore checking selections on OperationDefinition as it's redundant check", code: '{ foo }', parserOptions: { - schema: 'type Query { id: ID }', - documents: '{ foo }', + graphQLConfig: { + schema: 'type Query { id: ID }', + documents: '{ foo }', + }, }, }, { ...WITH_SCHEMA, code: '{ noId { name } }' }, @@ -110,8 +115,10 @@ ruleTester.run('require-id-when-available', rule, { name: 'should find selection in fragment', code: '{ hasId { ...HasIdFields } }', parserOptions: { - schema: TEST_SCHEMA, - documents: 'fragment HasIdFields on HasId { id }', + graphQLConfig: { + schema: TEST_SCHEMA, + documents: 'fragment HasIdFields on HasId { id }', + }, }, }, { ...WITH_SCHEMA, code: '{ vehicles { id ...on Car { id mileage } } }' }, @@ -142,16 +149,18 @@ ruleTester.run('require-id-when-available', rule, { } `, parserOptions: { - schema: USER_POST_SCHEMA, - documents: /* GraphQL */ ` - fragment UserLightFields on User { - id - } - fragment UserFullFields on User { - ...UserLightFields - name - } - `, + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: /* GraphQL */ ` + fragment UserLightFields on User { + id + } + fragment UserFullFields on User { + ...UserLightFields + name + } + `, + }, }, }, { @@ -164,20 +173,22 @@ ruleTester.run('require-id-when-available', rule, { } `, parserOptions: { - schema: USER_POST_SCHEMA, - documents: /* GraphQL */ ` - fragment UserLightFields on User { - id - } - fragment UserMediumFields on User { - ...UserLightFields - name - } - fragment UserFullFields on User { - ...UserMediumFields - name - } - `, + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: /* GraphQL */ ` + fragment UserLightFields on User { + id + } + fragment UserMediumFields on User { + ...UserLightFields + name + } + fragment UserFullFields on User { + ...UserMediumFields + name + } + `, + }, }, }, { @@ -190,20 +201,22 @@ ruleTester.run('require-id-when-available', rule, { } `, parserOptions: { - schema: USER_POST_SCHEMA, - documents: /* GraphQL */ ` - fragment UserLightFields on User { - ... on User { - id + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: /* GraphQL */ ` + fragment UserLightFields on User { + ... on User { + id + } } - } - fragment UserMediumFields on User { - ...UserLightFields - } - fragment UserFullFields on User { - ...UserMediumFields - } - `, + fragment UserMediumFields on User { + ...UserLightFields + } + fragment UserFullFields on User { + ...UserMediumFields + } + `, + }, }, }, { @@ -216,26 +229,28 @@ ruleTester.run('require-id-when-available', rule, { } `, parserOptions: { - schema: USER_POST_SCHEMA, - documents: /* GraphQL */ ` - fragment UserFields on User { - id - } - fragment UserLightFields on User { - ... on User { - ...UserFields + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: /* GraphQL */ ` + fragment UserFields on User { + id + } + fragment UserLightFields on User { + ... on User { + ...UserFields + name + } + } + fragment UserMediumFields on User { name + ...UserLightFields } - } - fragment UserMediumFields on User { - name - ...UserLightFields - } - fragment UserFullFields on User { - name - ...UserMediumFields - } - `, + fragment UserFullFields on User { + name + ...UserMediumFields + } + `, + }, }, }, { @@ -248,18 +263,20 @@ ruleTester.run('require-id-when-available', rule, { } `, parserOptions: { - schema: USER_POST_SCHEMA, - documents: /* GraphQL */ ` - fragment UserFields on User { - name - } - fragment UserFullFields on User { - ... on User { - ...UserFields - id # order is matter + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: /* GraphQL */ ` + fragment UserFields on User { + name } - } - `, + fragment UserFullFields on User { + ... on User { + ...UserFields + id # order is matter + } + } + `, + }, }, }, { @@ -272,18 +289,20 @@ ruleTester.run('require-id-when-available', rule, { } `, parserOptions: { - schema: USER_POST_SCHEMA, - documents: /* GraphQL */ ` - fragment UserFields on User { - name - } - fragment UserFullFields on User { - ... on User { - ...UserFields + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: /* GraphQL */ ` + fragment UserFields on User { + name } - id # order is matter - } - `, + fragment UserFullFields on User { + ... on User { + ...UserFields + } + id # order is matter + } + `, + }, }, }, { @@ -321,20 +340,22 @@ ruleTester.run('require-id-when-available', rule, { } `, parserOptions: { - schema: USER_POST_SCHEMA, - documents: /* GraphQL */ ` - fragment UserLightFields on User { - name - } - fragment UserMediumFields on User { - ...UserLightFields - name - } - fragment UserFullFields on User { - ...UserMediumFields - name - } - `, + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: /* GraphQL */ ` + fragment UserLightFields on User { + name + } + fragment UserMediumFields on User { + ...UserLightFields + name + } + fragment UserFullFields on User { + ...UserMediumFields + name + } + `, + }, }, errors: [MESSAGE_ID], }, @@ -343,8 +364,10 @@ ruleTester.run('require-id-when-available', rule, { code: '{ user { id ...UserFields } }', errors: [MESSAGE_ID], parserOptions: { - schema: USER_POST_SCHEMA, - documents: 'fragment UserFields on User { posts { title } }', + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: 'fragment UserFields on User { posts { title } }', + }, }, }, { @@ -352,22 +375,24 @@ ruleTester.run('require-id-when-available', rule, { code: '{ user { ...UserFullFields } }', errors: [MESSAGE_ID, MESSAGE_ID, MESSAGE_ID, MESSAGE_ID], parserOptions: { - schema: USER_POST_SCHEMA, - documents: /* GraphQL */ ` - fragment UserFullFields on User { - posts { - author { - ...UserFields - authorPosts: posts { - title + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: /* GraphQL */ ` + fragment UserFullFields on User { + posts { + author { + ...UserFields + authorPosts: posts { + title + } } } } - } - fragment UserFields on User { - name - } - `, + fragment UserFields on User { + name + } + `, + }, }, }, { @@ -375,8 +400,10 @@ ruleTester.run('require-id-when-available', rule, { errors: [MESSAGE_ID], code: DOCUMENT_WITH_UNION, parserOptions: { - schema: USER_POST_SCHEMA, - documents: DOCUMENT_WITH_UNION, + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: DOCUMENT_WITH_UNION, + }, }, }, { @@ -392,12 +419,14 @@ ruleTester.run('require-id-when-available', rule, { } `, parserOptions: { - schema: USER_POST_SCHEMA, - documents: /* GraphQL */ ` - fragment UserFields on User { - name - } - `, + graphQLConfig: { + schema: USER_POST_SCHEMA, + documents: /* GraphQL */ ` + fragment UserFields on User { + name + } + `, + }, }, }, ], diff --git a/packages/plugin/__tests__/require-import-fragment.spec.ts b/packages/plugin/__tests__/require-import-fragment.spec.ts index b06976db197..b594e68d836 100644 --- a/packages/plugin/__tests__/require-import-fragment.spec.ts +++ b/packages/plugin/__tests__/require-import-fragment.spec.ts @@ -1,38 +1,21 @@ import { join } from 'node:path'; -import { GraphQLInvalidTestCase } from '../src'; import { rule } from '../src/rules/require-import-fragment'; -import { Linter } from 'eslint'; -import ParserOptions = Linter.ParserOptions; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; -function withMocks({ - name, - filename, - errors, -}: { - name: string; - filename: string; - errors?: GraphQLInvalidTestCase['errors']; -}): { - name: string; - filename: string; - code: string; - parserOptions: { - documents: ParserOptions['documents']; - }; - errors: any; -} { +function withMocks({ name, filename, errors }: { name: string; filename: string; errors?: any }) { return { name, filename, code: ruleTester.fromMockFile(filename.split('/mocks')[1]), parserOptions: { - documents: [ - filename, - join(__dirname, 'mocks/import-fragments/foo-fragment.gql'), - join(__dirname, 'mocks/import-fragments/bar-fragment.gql'), - ], - }, + graphQLConfig: { + documents: [ + filename, + join(__dirname, 'mocks/import-fragments/foo-fragment.gql'), + join(__dirname, 'mocks/import-fragments/bar-fragment.gql'), + ], + }, + } satisfies ParserOptionsForTests, errors, }; } diff --git a/packages/plugin/__tests__/require-nullable-result-in-root.spec.ts b/packages/plugin/__tests__/require-nullable-result-in-root.spec.ts index 6748d750275..532927229ab 100644 --- a/packages/plugin/__tests__/require-nullable-result-in-root.spec.ts +++ b/packages/plugin/__tests__/require-nullable-result-in-root.spec.ts @@ -1,18 +1,10 @@ -import { ParserOptions } from '../src'; import { rule } from '../src/rules/require-nullable-result-in-root'; -import { ruleTester } from './test-utils'; - -function useSchema(code: string): { code: string; parserOptions: Omit } { - return { - code, - parserOptions: { schema: code }, - }; -} +import { ruleTester, withSchema } from './test-utils'; ruleTester.run('require-nullable-result-in-root', rule, { valid: [ - { - ...useSchema(/* GraphQL */ ` + withSchema({ + code: /* GraphQL */ ` type Query { foo: User baz: [User]! @@ -21,24 +13,24 @@ ruleTester.run('require-nullable-result-in-root', rule, { type User { id: ID! } - `), - }, + `, + }), ], invalid: [ - { - ...useSchema(/* GraphQL */ ` + withSchema({ + code: /* GraphQL */ ` type Query { user: User! } type User { id: ID! } - `), + `, errors: 1, - }, - { + }), + withSchema({ name: 'should work with extend query', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type MyMutation extend type MyMutation { user: User! @@ -49,12 +41,12 @@ ruleTester.run('require-nullable-result-in-root', rule, { schema { mutation: MyMutation } - `), + `, errors: 1, - }, - { + }), + withSchema({ name: 'should work with default scalars', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type MySubscription extend type MySubscription { foo: Boolean! @@ -62,8 +54,8 @@ ruleTester.run('require-nullable-result-in-root', rule, { schema { subscription: MySubscription } - `), + `, errors: 1, - }, + }), ], }); diff --git a/packages/plugin/__tests__/rules.spec.ts b/packages/plugin/__tests__/rules.spec.ts index 7966cd3dc20..30f7f820793 100644 --- a/packages/plugin/__tests__/rules.spec.ts +++ b/packages/plugin/__tests__/rules.spec.ts @@ -1,12 +1,13 @@ -import { configs, parseForESLint, ParserOptions, rules } from '@graphql-eslint/eslint-plugin'; +import { configs, parseForESLint, rules } from '@graphql-eslint/eslint-plugin'; import eslintExperimentalApis from 'eslint/use-at-your-own-risk'; +import { ParserOptionsForTests } from './test-utils'; // @ts-expect-error we need to wait when ESLint publish correct types const { FlatESLint } = eslintExperimentalApis; export function getESLintWithConfig( config: Record, - parserOptions?: Omit, + graphQLConfig?: ParserOptionsForTests['graphQLConfig'], ) { return new FlatESLint({ overrideConfigFile: true, @@ -16,10 +17,11 @@ export function getESLintWithConfig( languageOptions: { parser: { parseForESLint }, parserOptions: { - schema: 'type Query { foo: Int }', - skipGraphQLConfig: true, - ...parserOptions, - }, + graphQLConfig: { + schema: 'type Query { foo: Int }', + ...graphQLConfig, + }, + } satisfies ParserOptionsForTests, }, plugins: { '@graphql-eslint': { rules }, diff --git a/packages/plugin/__tests__/schema.spec.ts b/packages/plugin/__tests__/schema.spec.ts index 030a3ae48d1..c33f1adc731 100644 --- a/packages/plugin/__tests__/schema.spec.ts +++ b/packages/plugin/__tests__/schema.spec.ts @@ -13,7 +13,7 @@ describe('schema', async () => { const schemaOnDisk = await readFile(SCHEMA_GRAPHQL_PATH, 'utf8'); const testSchema = (schema: string) => { - const gqlConfig = loadGraphQLConfig({ schema, filePath: '' }); + const gqlConfig = loadGraphQLConfig({ graphQLConfig: { schema }, filePath: '' }); const graphQLSchema = getSchema(gqlConfig.getDefault()); expect(graphQLSchema).toBeInstanceOf(GraphQLSchema); @@ -77,42 +77,32 @@ describe('schema', async () => { }); describe('should passe headers', () => { - let schemaUrl: string; - let schemaOptions; - - beforeAll(() => { - schemaUrl = `${url}/my-headers`; - schemaOptions = { - headers: { - authorization: 'Bearer Foo', - }, - }; - }); - // https://graphql-config.com/schema#passing-headers it('with `parserOptions.schema`', () => { const gqlConfig = loadGraphQLConfig({ - schema: { - [schemaUrl]: schemaOptions, + graphQLConfig: { + // @ts-expect-error -- here I don't know why it's complaining + schema: { + [`${url}/my-headers`]: { + headers: { + authorization: 'Bearer Foo', + }, + }, + }, }, filePath: '', }); expect(() => getSchema(gqlConfig.getDefault())).toThrow('authorization: "Bearer Foo"'); }); - - // https://github.com/B2o5T/graphql-eslint/blob/master/docs/parser-options.md#schemaoptions - it('with `parserOptions.schemaOptions`', () => { - const gqlConfig = loadGraphQLConfig({ schema: schemaUrl, filePath: '' }); - expect(() => getSchema(gqlConfig.getDefault(), schemaOptions)).toThrow( - 'authorization: "Bearer Foo"', - ); - }); }); }); describe('schema loading', () => { it('should return Error', () => { - const gqlConfig = loadGraphQLConfig({ schema: 'not-exist.gql', filePath: '' }); + const gqlConfig = loadGraphQLConfig({ + graphQLConfig: { schema: 'not-exist.gql' }, + filePath: '', + }); expect(() => getSchema(gqlConfig.getDefault())).toThrow( 'Unable to find any GraphQL type definitions for the following pointers', ); @@ -121,7 +111,9 @@ describe('schema', async () => { it('should load the graphql-config rc file relative to the linted file', () => { const gqlConfig = loadGraphQLConfig({ - schema: path.resolve(__dirname, 'mocks/using-config/schema.graphql'), + graphQLConfig: { + schema: path.resolve(__dirname, 'mocks/using-config/schema-in-config.graphql'), + }, filePath: path.resolve(__dirname, 'mocks/using-config/test.graphql'), }); diff --git a/packages/plugin/__tests__/selection-set-depth.spec.ts b/packages/plugin/__tests__/selection-set-depth.spec.ts index d130d3664de..565f14dd9c0 100644 --- a/packages/plugin/__tests__/selection-set-depth.spec.ts +++ b/packages/plugin/__tests__/selection-set-depth.spec.ts @@ -1,11 +1,12 @@ -import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/selection-set-depth'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; const WITH_SIBLINGS = { parserOptions: { - documents: 'fragment AlbumFields on Album { id }', - } as ParserOptions, + graphQLConfig: { + documents: 'fragment AlbumFields on Album { id }', + }, + } satisfies ParserOptionsForTests, }; ruleTester.run('selection-set-depth', rule, { @@ -97,14 +98,16 @@ ruleTester.run('selection-set-depth', rule, { { name: 'suggestions should not throw error when fragment is located in different file', parserOptions: { - documents: /* GraphQL */ ` - fragment AlbumFields on Album { - id - modifier { - date + graphQLConfig: { + documents: /* GraphQL */ ` + fragment AlbumFields on Album { + id + modifier { + date + } } - } - `, + `, + }, }, options: [{ maxDepth: 2 }], errors: [{ message: "'' exceeds maximum operation depth of 2" }], diff --git a/packages/plugin/__tests__/strict-id-in-types.spec.ts b/packages/plugin/__tests__/strict-id-in-types.spec.ts index 131e2f4143d..af8c28fe98a 100644 --- a/packages/plugin/__tests__/strict-id-in-types.spec.ts +++ b/packages/plugin/__tests__/strict-id-in-types.spec.ts @@ -1,39 +1,29 @@ -import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/strict-id-in-types'; -import { ruleTester } from './test-utils'; - -function useSchema(code: string): { code: string; parserOptions: Pick } { - return { - code, - parserOptions: { - schema: code, - }, - }; -} +import { ruleTester, withSchema } from './test-utils'; ruleTester.run('strict-id-in-types', rule, { valid: [ - useSchema('type A { id: ID! }'), - { - ...useSchema('type A { _id: String! }'), + withSchema({ code: 'type A { id: ID! }' }), + withSchema({ + code: 'type A { _id: String! }', options: [ { acceptedIdNames: ['_id'], acceptedIdTypes: ['String'], }, ], - }, - { - ...useSchema('type A { _id: String! } type A1 { id: ID! }'), + }), + withSchema({ + code: 'type A { _id: String! } type A1 { id: ID! }', options: [ { acceptedIdNames: ['id', '_id'], acceptedIdTypes: ['ID', 'String'], }, ], - }, - { - ...useSchema('type A { id: ID! } type AResult { key: String! }'), + }), + withSchema({ + code: 'type A { id: ID! } type AResult { key: String! }', options: [ { acceptedIdNames: ['id'], @@ -43,9 +33,9 @@ ruleTester.run('strict-id-in-types', rule, { }, }, ], - }, - { - ...useSchema('type A { id: ID! } type A1 { id: ID! }'), + }), + withSchema({ + code: 'type A { id: ID! } type A1 { id: ID! }', options: [ { acceptedIdNames: ['id'], @@ -55,20 +45,18 @@ ruleTester.run('strict-id-in-types', rule, { }, }, ], - }, - { - ...useSchema('type A { id: ID! } type A1 { id: ID! }'), + }), + withSchema({ + code: 'type A { id: ID! } type A1 { id: ID! }', options: [ { acceptedIdNames: ['id'], acceptedIdTypes: ['ID'], }, ], - }, - { - ...useSchema( - 'type A { id: ID! } type AResult { key: String! } type APayload { bool: Boolean! } type APagination { num: Int! }', - ), + }), + withSchema({ + code: 'type A { id: ID! } type AResult { key: String! } type APayload { bool: Boolean! } type APagination { num: Int! }', options: [ { acceptedIdNames: ['id'], @@ -78,9 +66,9 @@ ruleTester.run('strict-id-in-types', rule, { }, }, ], - }, - { - ...useSchema('type A { id: ID! } type AError { message: String! }'), + }), + withSchema({ + code: 'type A { id: ID! } type AError { message: String! }', options: [ { acceptedIdNames: ['id'], @@ -90,11 +78,10 @@ ruleTester.run('strict-id-in-types', rule, { }, }, ], - }, - { - ...useSchema( - 'type A { id: ID! } type AGeneralError { message: String! } type AForbiddenError { message: String! }', - ), + }), + withSchema({ + code: 'type A { id: ID! } type AGeneralError { message: String! } type AForbiddenError { message: String! }', + options: [ { acceptedIdNames: ['id'], @@ -104,9 +91,9 @@ ruleTester.run('strict-id-in-types', rule, { }, }, ], - }, - { - ...useSchema('type A { id: ID! }'), + }), + withSchema({ + code: 'type A { id: ID! }', options: [ { acceptedIdNames: ['id'], @@ -116,11 +103,9 @@ ruleTester.run('strict-id-in-types', rule, { }, }, ], - }, - { - ...useSchema( - 'type A { id: ID! } type AError { message: String! } type AResult { payload: A! }', - ), + }), + withSchema({ + code: 'type A { id: ID! } type AError { message: String! } type AResult { payload: A! }', options: [ { acceptedIdNames: ['id'], @@ -131,10 +116,10 @@ ruleTester.run('strict-id-in-types', rule, { }, }, ], - }, - { + }), + withSchema({ name: 'should ignore root types', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type User { id: ID! } @@ -147,11 +132,11 @@ ruleTester.run('strict-id-in-types', rule, { type Subscription { userAdded: User } - `), - }, - { + `, + }), + withSchema({ name: 'should ignore root types that are renamed', - ...useSchema(/* GraphQL */ ` + code: /* GraphQL */ ` type User { id: ID! } @@ -169,16 +154,16 @@ ruleTester.run('strict-id-in-types', rule, { mutation: MyMutation subscription: MySubscription } - `), - }, + `, + }), ], invalid: [ - { - ...useSchema('type B { name: String! }'), + withSchema({ + code: 'type B { name: String! }', errors: 1, - }, - { - ...useSchema('type B { id: ID! _id: String! }'), + }), + withSchema({ + code: 'type B { id: ID! _id: String! }', options: [ { acceptedIdNames: ['id', '_id'], @@ -186,11 +171,9 @@ ruleTester.run('strict-id-in-types', rule, { }, ], errors: 1, - }, - { - ...useSchema( - 'type B { id: String! } type B1 { id: [String] } type B2 { id: [String!] } type B3 { id: [String]! } type B4 { id: [String!]! }', - ), + }), + withSchema({ + code: 'type B { id: String! } type B1 { id: [String] } type B2 { id: [String!] } type B3 { id: [String]! } type B4 { id: [String!]! }', options: [ { acceptedIdNames: ['id'], @@ -198,11 +181,9 @@ ruleTester.run('strict-id-in-types', rule, { }, ], errors: 4, - }, - { - ...useSchema( - 'type B { id: ID! } type Bresult { key: String! } type BPayload { bool: Boolean! } type BPagination { num: Int! }', - ), + }), + withSchema({ + code: 'type B { id: ID! } type Bresult { key: String! } type BPayload { bool: Boolean! } type BPagination { num: Int! }', options: [ { acceptedIdNames: ['id'], @@ -213,9 +194,9 @@ ruleTester.run('strict-id-in-types', rule, { }, ], errors: 2, - }, - { - ...useSchema('type B { id: ID! } type BError { message: String! }'), + }), + withSchema({ + code: 'type B { id: ID! } type BError { message: String! }', options: [ { acceptedIdNames: ['id'], @@ -226,6 +207,6 @@ ruleTester.run('strict-id-in-types', rule, { }, ], errors: 1, - }, + }), ], }); diff --git a/packages/plugin/__tests__/test-utils.ts b/packages/plugin/__tests__/test-utils.ts index ba9eb412c54..b29a1d95751 100644 --- a/packages/plugin/__tests__/test-utils.ts +++ b/packages/plugin/__tests__/test-utils.ts @@ -1,10 +1,28 @@ +// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this import { RuleTester } from '@theguild/eslint-rule-tester'; +import { ParserOptions } from '../src/index.js'; export const DEFAULT_CONFIG = { parser: require.resolve('@graphql-eslint/eslint-plugin'), parserOptions: { - skipGraphQLConfig: true, + graphQLConfig: {}, }, }; -export const ruleTester = new RuleTester(DEFAULT_CONFIG); +export type ParserOptionsForTests = { + graphQLConfig: Partial; +}; + +export const ruleTester = new RuleTester(DEFAULT_CONFIG); + +export function withSchema({ code, ...rest }: T) { + return { + code, + parserOptions: { + graphQLConfig: { + schema: code, + }, + } satisfies ParserOptionsForTests, + ...rest, + }; +} diff --git a/packages/plugin/__tests__/unique-fragment-name.spec.ts b/packages/plugin/__tests__/unique-fragment-name.spec.ts index 7697cd44efe..6f0c7217f9a 100644 --- a/packages/plugin/__tests__/unique-fragment-name.spec.ts +++ b/packages/plugin/__tests__/unique-fragment-name.spec.ts @@ -1,7 +1,6 @@ import { join } from 'node:path'; -import { ParserOptions } from '../src'; import { rule } from '../src/rules/unique-fragment-name'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; const TEST_FRAGMENT = /* GraphQL */ ` fragment HasIdFields on HasId { @@ -9,12 +8,12 @@ const TEST_FRAGMENT = /* GraphQL */ ` } `; -const SIBLING_FRAGMENTS = ( - ...documents: string[] -): { parserOptions: Pick } => ({ +const SIBLING_FRAGMENTS = (...documents: string[]) => ({ parserOptions: { - documents, - }, + graphQLConfig: { + documents, + }, + } satisfies ParserOptionsForTests, }); ruleTester.run('unique-fragment-name', rule, { diff --git a/packages/plugin/__tests__/unique-operation-name.spec.ts b/packages/plugin/__tests__/unique-operation-name.spec.ts index fe745d2f4e5..29f1a019581 100644 --- a/packages/plugin/__tests__/unique-operation-name.spec.ts +++ b/packages/plugin/__tests__/unique-operation-name.spec.ts @@ -1,16 +1,15 @@ import { join } from 'node:path'; -import { ParserOptions } from '../src'; import { rule } from '../src/rules/unique-operation-name'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; const TEST_OPERATION = 'query test { foo }'; -const SIBLING_OPERATIONS = ( - ...documents: string[] -): { parserOptions: Pick } => ({ +const SIBLING_OPERATIONS = (...documents: string[]) => ({ parserOptions: { - documents, - }, + graphQLConfig: { + documents, + }, + } satisfies ParserOptionsForTests, }); ruleTester.run('unique-operation-name', rule, { diff --git a/packages/plugin/__tests__/unique-type-names.spec.ts b/packages/plugin/__tests__/unique-type-names.spec.ts index 5725b8974d3..523010694e8 100644 --- a/packages/plugin/__tests__/unique-type-names.spec.ts +++ b/packages/plugin/__tests__/unique-type-names.spec.ts @@ -1,6 +1,5 @@ -import { ParserOptions } from '../src'; import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; -import { ruleTester } from './test-utils'; +import { ParserOptionsForTests, ruleTester } from './test-utils'; const TEST_SCHEMA = /* GraphQL */ ` type Query { @@ -11,9 +10,10 @@ const TEST_SCHEMA = /* GraphQL */ ` const WITH_SCHEMA = { parserOptions: { - schema: TEST_SCHEMA, - documents: [], - } as ParserOptions, + graphQLConfig: { + schema: TEST_SCHEMA, + }, + } satisfies ParserOptionsForTests, }; ruleTester.run('unique-type-names', GRAPHQL_JS_VALIDATIONS['unique-type-names'], { diff --git a/packages/plugin/package.json b/packages/plugin/package.json index ed0811862ee..a1030ae45f0 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -12,6 +12,7 @@ "exports": { "./package.json": "./package.json", ".": { + "browser": "./dist/index.browser.mjs", "require": { "types": "./dist/cjs/index.d.ts", "default": "./dist/cjs/index.js" @@ -34,7 +35,8 @@ ], "scripts": { "build": "tsup", - "test": "vitest" + "test": "vitest", + "typecheck": "tsc --noEmit" }, "peerDependencies": { "eslint": "^8", @@ -47,10 +49,9 @@ "chalk": "^4.1.2", "debug": "^4.3.4", "fast-glob": "^3.2.12", - "graphql-config": "^4.4.0", + "graphql-config": "^4.5.0", "graphql-depth-limit": "^1.1.0", - "lodash.lowercase": "^4.3.0", - "tslib": "^2.4.1" + "lodash.lowercase": "^4.3.0" }, "devDependencies": { "@theguild/eslint-rule-tester": "workspace:*", diff --git a/packages/plugin/serializer.ts b/packages/plugin/serializer.ts index 4066f9ec00c..242225be3db 100644 --- a/packages/plugin/serializer.ts +++ b/packages/plugin/serializer.ts @@ -1,3 +1,4 @@ +// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this import rawSnapshotSerializer from 'jest-snapshot-serializer-raw/always'; expect.addSnapshotSerializer(rawSnapshotSerializer); diff --git a/packages/plugin/src/graphql-config.ts b/packages/plugin/src/graphql-config.ts index bbe73393d00..2ca011c3c4a 100644 --- a/packages/plugin/src/graphql-config.ts +++ b/packages/plugin/src/graphql-config.ts @@ -1,12 +1,7 @@ -import { dirname } from 'node:path'; +import path from 'node:path'; import { CodeFileLoader } from '@graphql-tools/code-file-loader'; import debugFactory from 'debug'; -import { - GraphQLConfig, - GraphQLExtensionDeclaration, - loadConfigSync, - SchemaPointer, -} from 'graphql-config'; +import { GraphQLConfig, GraphQLExtensionDeclaration, loadConfigSync } from 'graphql-config'; import { ParserOptions } from './types.js'; const debug = debugFactory('graphql-eslint:graphql-config'); @@ -15,46 +10,39 @@ let graphQLConfig: GraphQLConfig; export function loadOnDiskGraphQLConfig(filePath: string): GraphQLConfig { return loadConfigSync({ // load config relative to the file being linted - rootDir: dirname(filePath), - throwOnEmpty: false, + rootDir: path.dirname(filePath), throwOnMissing: false, extensions: [codeFileLoaderExtension], }); } -export function loadGraphQLConfig(options: ParserOptions): GraphQLConfig { +export function loadGraphQLConfig({ + graphQLConfig: config, + filePath, +}: ParserOptions): GraphQLConfig { // We don't want cache config on test environment // Otherwise schema and documents will be same for all tests if (process.env.NODE_ENV !== 'test' && graphQLConfig) { return graphQLConfig; } - - const onDiskConfig = !options.skipGraphQLConfig && loadOnDiskGraphQLConfig(options.filePath); - - debug('options.skipGraphQLConfig: %o', options.skipGraphQLConfig); + debug('parserOptions.graphQLConfig: %o', config); + const onDiskConfig = !config && loadOnDiskGraphQLConfig(filePath); if (onDiskConfig) { - debug('Graphql-config path %o', onDiskConfig.filepath); + debug('GraphQL-Config path %o', onDiskConfig.filepath); } - const configOptions = options.projects - ? { projects: options.projects } - : { - schema: (options.schema || '') as SchemaPointer, // if `schema` is `undefined` will throw error `Project 'default' not found` - documents: options.documents, - extensions: options.extensions, - include: options.include, - exclude: options.exclude, - }; + const configOptions = + config && ('projects' in config || 'schemaPath' in config) + ? config + : { + // if `schema` is `undefined` will throw error `Project 'default' not found` + schema: config?.schema ?? '', + ...config, + }; graphQLConfig = onDiskConfig || - new GraphQLConfig( - { - config: configOptions, - filepath: 'virtual-config', - }, - [codeFileLoaderExtension], - ); + new GraphQLConfig({ config: configOptions, filepath: '' }, [codeFileLoaderExtension]); return graphQLConfig; } @@ -63,5 +51,5 @@ const codeFileLoaderExtension: GraphQLExtensionDeclaration = api => { const { schema, documents } = api.loaders; schema.register(new CodeFileLoader()); documents.register(new CodeFileLoader()); - return { name: 'graphql-eslint-loaders' }; + return { name: 'code-file-loaders' }; }; diff --git a/packages/plugin/src/index.browser.ts b/packages/plugin/src/index.browser.ts new file mode 100644 index 00000000000..f8e43ac9661 --- /dev/null +++ b/packages/plugin/src/index.browser.ts @@ -0,0 +1,8 @@ +// rewrite exports because we don't need `processors` export that has fs related dependencies + +export { parseForESLint } 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/parser.ts b/packages/plugin/src/parser.ts index 6361b8802dc..20cda16e055 100644 --- a/packages/plugin/src/parser.ts +++ b/packages/plugin/src/parser.ts @@ -1,12 +1,14 @@ -import { parseGraphQLSDL } from '@graphql-tools/utils'; +import { parseGraphQLSDL, Source } from '@graphql-tools/utils'; import debugFactory from 'debug'; -import { buildSchema, GraphQLError, GraphQLSchema } from 'graphql'; +import { buildSchema, GraphQLError } from 'graphql'; import { convertToESTree, extractComments, extractTokens } from './estree-converter/index.js'; import { loadGraphQLConfig } from './graphql-config.js'; import { getSchema } from './schema.js'; import { getSiblings } from './siblings.js'; -import { GraphQLESLintParseResult, ParserOptions } from './types.js'; +import { GraphQLESLintParseResult, ParserOptions, Schema } from './types.js'; import { CWD, VIRTUAL_DOCUMENT_REGEX } from './utils.js'; +import { GraphQLProjectConfig, IGraphQLProject } from 'graphql-config'; +import { getDocuments } from './documents.js'; const debug = debugFactory('graphql-eslint:parser'); @@ -15,26 +17,35 @@ debug('cwd %o', CWD); export function parseForESLint(code: string, options: ParserOptions): GraphQLESLintParseResult { try { const { filePath } = options; - // TODO: remove in graphql-eslint v4 - options.documents ||= options.operations; // First parse code from file, in case of syntax error do not try load schema, // documents or even graphql-config instance const { document } = parseGraphQLSDL(filePath, code, { - ...options.graphQLParserOptions, noLocation: false, }); - const gqlConfig = loadGraphQLConfig(options); - const realFilepath = filePath.replace(VIRTUAL_DOCUMENT_REGEX, ''); - const project = gqlConfig.getProjectForFile(realFilepath); + let project: GraphQLProjectConfig; + let schema: Schema, documents: Source[]; - let schema: GraphQLSchema | null = null; + if (typeof window === 'undefined') { + const gqlConfig = loadGraphQLConfig(options); + const realFilepath = filePath.replace(VIRTUAL_DOCUMENT_REGEX, ''); + project = gqlConfig.getProjectForFile(realFilepath); + documents = getDocuments(project); + } else { + documents = [ + parseGraphQLSDL( + 'operation.graphql', + (options.graphQLConfig as IGraphQLProject).documents as string, + { noLocation: true }, + ), + ]; + } try { - schema = project - ? getSchema(project, options.schemaOptions) - : typeof options.schema === 'string' - ? buildSchema(options.schema) - : null; + if (typeof window === 'undefined') { + schema = getSchema(project!); + } else { + schema = buildSchema((options.graphQLConfig as IGraphQLProject).schema as string); + } } catch (error) { if (error instanceof Error) { error.message = `Error while loading schema: ${error.message}`; @@ -47,7 +58,7 @@ export function parseForESLint(code: string, options: ParserOptions): GraphQLESL return { services: { schema, - siblingOperations: getSiblings(project, options.documents), + siblingOperations: getSiblings(documents), }, ast: { comments: extractComments(document.loc), diff --git a/packages/plugin/src/processor.ts b/packages/plugin/src/processor.ts index 3e8991259b3..acc3787be90 100644 --- a/packages/plugin/src/processor.ts +++ b/packages/plugin/src/processor.ts @@ -21,7 +21,7 @@ let onDiskConfigLoaded = false; const RELEVANT_KEYWORDS = ['gql', 'graphql', 'GraphQL'] as const; -export const processor: Linter.Processor = { +export const processor = { supportsAutofix: true, preprocess(code, filePath) { if (!onDiskConfigLoaded) { @@ -123,4 +123,4 @@ export const processor: Linter.Processor = { // sort eslint/graphql-eslint messages by line/column return result.sort((a, b) => a.line - b.line || a.column - b.column); }, -}; +} satisfies Linter.Processor; diff --git a/packages/plugin/src/schema.ts b/packages/plugin/src/schema.ts index 8be4f8c744e..9c940a1fd40 100644 --- a/packages/plugin/src/schema.ts +++ b/packages/plugin/src/schema.ts @@ -3,15 +3,12 @@ import fg from 'fast-glob'; import { GraphQLSchema } from 'graphql'; import { GraphQLProjectConfig } from 'graphql-config'; import { ModuleCache } from './cache.js'; -import { ParserOptions, Pointer, Schema } from './types.js'; +import { Pointer, Schema } from './types.js'; const schemaCache = new ModuleCache(); const debug = debugFactory('graphql-eslint:schema'); -export function getSchema( - project: GraphQLProjectConfig, - schemaOptions?: ParserOptions['schemaOptions'], -): Schema { +export function getSchema(project: GraphQLProjectConfig): Schema { const schemaKey = project.schema; if (!schemaKey) { @@ -26,7 +23,6 @@ export function getSchema( debug('Loading schema from %o', project.schema); const schema = project.loadSchemaSync(project.schema, 'GraphQLSchema', { - ...schemaOptions, pluckConfig: project.extensions.pluckConfig, }); if (debug.enabled) { diff --git a/packages/plugin/src/siblings.ts b/packages/plugin/src/siblings.ts index f60c2ba2f9c..f6a4c949cf7 100644 --- a/packages/plugin/src/siblings.ts +++ b/packages/plugin/src/siblings.ts @@ -1,4 +1,4 @@ -import { parseGraphQLSDL, Source } from '@graphql-tools/utils'; +import { Source } from '@graphql-tools/utils'; import { FragmentDefinitionNode, Kind, @@ -7,9 +7,6 @@ import { SelectionSetNode, visit, } from 'graphql'; -import { GraphQLProjectConfig } from 'graphql-config'; -import { getDocuments } from './documents.js'; -import { ParserOptions } from './types.js'; import { logger } from './utils.js'; export type FragmentSource = { filePath: string; document: FragmentDefinitionNode }; @@ -31,23 +28,14 @@ export type SiblingOperations = { const siblingOperationsCache = new Map(); -export function getSiblings( - project?: GraphQLProjectConfig, - documents?: ParserOptions['documents'], -): SiblingOperations { - const siblings = project - ? getDocuments(project) - : typeof documents === 'string' - ? [parseGraphQLSDL('operation.graphql', documents, { noLocation: true })] - : []; - - if (siblings.length === 0) { +export function getSiblings(documents: Source[]): SiblingOperations { + if (documents.length === 0) { let printed = false; const noopWarn = () => { if (!printed) { logger.warn( - 'getSiblingOperations was called without any operations. Make sure to set "parserOptions.operations" to make this feature available!', + 'getSiblingOperations was called without any operations. Make sure to set graphql-config `documents` field to make this feature available! See https://the-guild.dev/graphql/config/docs/user/documents for more info', ); printed = true; } @@ -69,7 +57,7 @@ export function getSiblings( // Since the siblings array is cached, we can use it as cache key. // We should get the same array reference each time we get // to this point for the same graphql project - const value = siblingOperationsCache.get(siblings); + const value = siblingOperationsCache.get(documents); if (value) { return value; @@ -81,7 +69,7 @@ export function getSiblings( if (fragmentsCache === null) { const result: FragmentSource[] = []; - for (const source of siblings) { + for (const source of documents) { for (const definition of source.document?.definitions || []) { if (definition.kind === Kind.FRAGMENT_DEFINITION) { result.push({ @@ -102,7 +90,7 @@ export function getSiblings( if (cachedOperations === null) { const result: OperationSource[] = []; - for (const source of siblings) { + for (const source of documents) { for (const definition of source.document?.definitions || []) { if (definition.kind === Kind.OPERATION_DEFINITION) { result.push({ @@ -159,6 +147,6 @@ export function getSiblings( getOperationByType: type => getOperations().filter(o => o.document.operation === type), }; - siblingOperationsCache.set(siblings, siblingOperations); + siblingOperationsCache.set(documents, siblingOperations); return siblingOperations; } diff --git a/packages/plugin/src/types.ts b/packages/plugin/src/types.ts index 846a67585a8..47859fe9558 100644 --- a/packages/plugin/src/types.ts +++ b/packages/plugin/src/types.ts @@ -1,30 +1,17 @@ -import { GraphQLParseOptions } from '@graphql-tools/utils'; import { AST, Linter, Rule } from 'eslint'; import * as ESTree from 'estree'; import { GraphQLSchema, ASTKindToNode } from 'graphql'; -import { IExtensions, IGraphQLProject } from 'graphql-config'; import { JSONSchema } from 'json-schema-to-ts'; import { SiblingOperations } from './siblings.js'; import { GraphQLESTreeNode } from './estree-converter/index.js'; +import { IGraphQLConfig } from 'graphql-config'; export type Schema = GraphQLSchema | null; export type Pointer = string | string[]; export interface ParserOptions { - schema?: Pointer | Record }>; - documents?: Pointer; - extensions?: IExtensions; - include?: Pointer; - exclude?: Pointer; - projects?: Record; - schemaOptions?: Omit & { - headers: Record; - }; - graphQLParserOptions?: Omit; - skipGraphQLConfig?: boolean; + graphQLConfig?: IGraphQLConfig; filePath: string; - /** @deprecated Use `documents` instead */ - operations?: Pointer; } export type ParserServices = { @@ -65,12 +52,7 @@ export type RuleDocsInfo = Omit code: string; usage?: T; }[]; - configOptions?: - | T - | { - schema?: T; - operations?: T; - }; + configOptions?: T | { schema?: T; operations?: T }; graphQLJSRuleName?: string; isDisabledForAllConfig?: true; }; diff --git a/packages/plugin/src/utils.ts b/packages/plugin/src/utils.ts index 9dbf77fb09a..e25e298625e 100644 --- a/packages/plugin/src/utils.ts +++ b/packages/plugin/src/utils.ts @@ -14,7 +14,7 @@ export function requireSiblingsOperations( const { siblingOperations } = context.parserServices; if (!siblingOperations.available) { throw new Error( - `Rule \`${ruleId}\` requires \`parserOptions.operations\` to be set and loaded. See https://bit.ly/graphql-eslint-operations for more info`, + `Rule \`${ruleId}\` requires graphql-config \`documents\` field to be set and loaded. See https://the-guild.dev/graphql/config/docs/user/documents for more info`, ); } return siblingOperations; @@ -27,7 +27,7 @@ export function requireGraphQLSchemaFromContext( const { schema } = context.parserServices; if (!schema) { throw new Error( - `Rule \`${ruleId}\` requires \`parserOptions.schema\` to be set and loaded. See https://bit.ly/graphql-eslint-schema for more info`, + `Rule \`${ruleId}\` requires graphql-config \`schema\` field to be set and loaded. See https://the-guild.dev/graphql/config/docs/user/schema for more info`, ); } return schema; diff --git a/packages/plugin/tsconfig.json b/packages/plugin/tsconfig.json index fa30e28cf9b..0ca6e3f629c 100644 --- a/packages/plugin/tsconfig.json +++ b/packages/plugin/tsconfig.json @@ -1,14 +1,19 @@ { "compilerOptions": { - "target": "es2019", + "target": "es2022", "module": "Node16", "moduleResolution": "node16", "declaration": false, "noEmit": true, "esModuleInterop": true, "strict": true, - "lib": ["ESNext"], + "lib": ["ESNext", "dom"], "types": ["vitest/globals"], - "resolveJsonModule": true - } + "resolveJsonModule": true, + "skipLibCheck": true, + "paths": { + "@graphql-eslint/eslint-plugin": ["./src/index.ts"] + } + }, + "exclude": ["dist"] } diff --git a/packages/plugin/tsup.config.ts b/packages/plugin/tsup.config.ts index 430751bdd01..58e8b8726c1 100644 --- a/packages/plugin/tsup.config.ts +++ b/packages/plugin/tsup.config.ts @@ -4,20 +4,24 @@ import path from 'node:path'; import packageJson from './package.json'; const opts: Options = { - entry: ['src/**/*.ts'], + entry: ['src/**/*.ts', '!src/index.browser.ts'], clean: true, bundle: false, dts: true, env: { ...(process.env.NODE_ENV && { NODE_ENV: process.env.NODE_ENV }), }, + format: 'esm', + minifySyntax: true, + esbuildOptions(options, _context) { + options.define!.window = 'undefined'; + }, }; const CWD = process.cwd(); export default defineConfig([ { ...opts, - format: 'esm', outDir: 'dist/esm', outExtension: () => ({ js: '.js' }), async onSuccess() { @@ -46,4 +50,19 @@ export default defineConfig([ format: 'cjs', outDir: 'dist/cjs', }, + { + ...opts, + entry: { + 'index.browser': 'src/index.browser.ts', + }, + outDir: 'dist', + dts: false, + bundle: true, + env: { + NODE_ENV: 'production', + }, + esbuildOptions(options, _context) { + options.define!.window = 'true'; + }, + }, ]); diff --git a/packages/plugin/vite.config.ts b/packages/plugin/vite.config.ts index 04cf577fbbf..898ae22d0ed 100644 --- a/packages/plugin/vite.config.ts +++ b/packages/plugin/vite.config.ts @@ -1,3 +1,4 @@ +// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this import { defineConfig } from 'vitest/config'; export default defineConfig({ diff --git a/packages/rule-tester/package.json b/packages/rule-tester/package.json index a0418e48b4b..38a38cedeae 100644 --- a/packages/rule-tester/package.json +++ b/packages/rule-tester/package.json @@ -7,10 +7,12 @@ "node": ">=18" }, "exports": { - ".": "./dist/index.js", - "./package.json": "./package.json" + "./package.json": "./package.json", + ".": { + "import": "./dist/index.js", + "types": "./dist/index.d.ts" + } }, - "types": "./dist/index.d.ts", "scripts": { "build": "tsup", "dev": "tsup --watch", diff --git a/packages/rule-tester/src/index.ts b/packages/rule-tester/src/index.ts index 7c7d89f28d0..641ada5a70e 100644 --- a/packages/rule-tester/src/index.ts +++ b/packages/rule-tester/src/index.ts @@ -3,6 +3,7 @@ import { resolve, dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; import { codeFrameColumns } from '@babel/code-frame'; import { AST, Linter, Rule, RuleTester as ESLintRuleTester } from 'eslint'; +import { GraphQLESLintRule } from '../../plugin/src/types.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); @@ -30,9 +31,9 @@ export class RuleTester extends ESLintRuleTester { } // @ts-expect-error -- fix later - run( + run( ruleId: string, - rule: Rule.RuleModule, + rule: GraphQLESLintRule, tests: { valid: (string | ValidTestCase)[]; invalid: (ValidTestCase & @@ -42,8 +43,11 @@ export class RuleTester extends ESLintRuleTester { // @ts-expect-error -- fix later const { testerConfig, linter } = this; - const getMessages = (testCase: ESLintRuleTester.InvalidTestCase) => { - const { options, code: rawCode, filename, parserOptions } = testCase; + const getMessages = ( + testCase: ESLintRuleTester.InvalidTestCase, + messages: Linter.LintMessage[], + ) => { + const { options, code, filename, parserOptions } = testCase; const config = { parser: testerConfig.parser, @@ -55,8 +59,6 @@ export class RuleTester extends ESLintRuleTester { [ruleId]: Array.isArray(options) ? ['error', ...options] : 'error', }, }; - - const code = removeTrailingBlankLines(rawCode); const codeFrame = indentCode(printCode(code, { line: 0, column: 0 })); const messageForSnapshot = ['#### ⌨️ Code', codeFrame]; @@ -64,8 +66,6 @@ export class RuleTester extends ESLintRuleTester { const opts = JSON.stringify(options, null, 2).slice(1, -1); messageForSnapshot.push('#### ⚙️ Options', indentCode(removeTrailingBlankLines(opts), 2)); } - - const messages = linter.verify(code, config, filename); for (const [index, message] of messages.entries()) { const codeWithMessage = printCode(code, message, 1); messageForSnapshot.push( @@ -88,7 +88,7 @@ export class RuleTester extends ESLintRuleTester { } } } - if (rule.meta!.fixable) { + if (rule.meta.fixable) { const { fixed, output } = linter.verifyAndFix(code, config, filename); if (fixed) { messageForSnapshot.push('#### 🔧 Autofix output', indentCode(printCode(output))); @@ -99,6 +99,7 @@ export class RuleTester extends ESLintRuleTester { for (const [id, testCase] of tests.invalid.entries()) { testCase.name ||= `Invalid #${id + 1}`; + testCase.code = removeTrailingBlankLines(testCase.code); Object.defineProperty(testCase, 'assertMessages', { value: getMessages, }); diff --git a/packages/rule-tester/tsconfig.json b/packages/rule-tester/tsconfig.json index 035651d7863..931eef74356 100644 --- a/packages/rule-tester/tsconfig.json +++ b/packages/rule-tester/tsconfig.json @@ -9,6 +9,8 @@ "strict": true, "lib": ["ESNext"], "types": ["vitest/globals"], - "resolveJsonModule": true - } + "resolveJsonModule": true, + "skipLibCheck": true + }, + "exclude": ["dist"] } diff --git a/patches/eslint@8.46.0.patch b/patches/eslint@8.46.0.patch index 62e9c72f67d..a03efdec702 100644 --- a/patches/eslint@8.46.0.patch +++ b/patches/eslint@8.46.0.patch @@ -45,7 +45,7 @@ index e4dc126783c8232a67268c72def615829c4508b9..6e1de73fd06e8bfec07e14c8779b0509 + // 🚨 Don't need, as we assert autofix output with snapshots } -+ item.assertMessages(item) ++ item.assertMessages(item, messages) assertASTDidntChange(result.beforeAST, result.afterAST); } - \ No newline at end of file + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bc6a55b74fc..b92ee76f2b8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,7 +12,7 @@ patchedDependencies: hash: cdhdgvmsbh3fbusrlxsl6de2he path: patches/eslint-plugin-eslint-plugin@5.0.6.patch eslint@8.46.0: - hash: 7xckwst2ekw7c3pf6pfwcsuiwu + hash: yi5cqffjk423hcgr7hl33kguwu path: patches/eslint@8.46.0.patch json-schema-to-markdown@1.1.1: hash: beglqnggvhpsclgwbdw27hzvu4 @@ -57,7 +57,7 @@ importers: version: 2.4.1 eslint: specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-plugin-eslint-plugin: specifier: 5.0.7 version: 5.0.7(patch_hash=cdhdgvmsbh3fbusrlxsl6de2he)(eslint@8.46.0) @@ -98,22 +98,6 @@ importers: specifier: 0.30.1 version: 0.30.1 - examples/basic: - dependencies: - graphql: - specifier: 16.7.1 - version: 16.7.1 - devDependencies: - '@eslint/js': - specifier: 8.46.0 - version: 8.46.0 - '@graphql-eslint/eslint-plugin': - specifier: workspace:* - version: link:../../packages/plugin/dist - eslint: - specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) - examples/code-file: dependencies: graphql: @@ -128,7 +112,7 @@ importers: version: link:../../packages/plugin/dist eslint: specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) examples/graphql-config: dependencies: @@ -144,26 +128,7 @@ importers: version: link:../../packages/plugin/dist eslint: specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) - - examples/graphql-config-code-file: - dependencies: - graphql: - specifier: 16.7.1 - version: 16.7.1 - graphql-tag: - specifier: 2.12.6 - version: 2.12.6(graphql@16.7.1) - devDependencies: - '@eslint/js': - specifier: 8.46.0 - version: 8.46.0 - '@graphql-eslint/eslint-plugin': - specifier: workspace:* - version: link:../../packages/plugin/dist - eslint: - specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) examples/monorepo: dependencies: @@ -179,7 +144,7 @@ importers: version: link:../../packages/plugin/dist eslint: specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) examples/multiple-projects-graphql-config: dependencies: @@ -195,7 +160,7 @@ importers: version: 5.0.0(@types/node@18.17.1)(cosmiconfig@8.2.0)(typescript@5.1.6) eslint: specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) ts-node: specifier: 10.9.1 version: 10.9.1(@types/node@18.17.1)(typescript@5.1.6) @@ -217,7 +182,7 @@ importers: version: link:../../packages/plugin/dist eslint: specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-config-prettier: specifier: 8.9.0 version: 8.9.0(eslint@8.46.0) @@ -228,6 +193,22 @@ importers: specifier: 2.8.8 version: 2.8.8 + examples/programmatic: + dependencies: + graphql: + specifier: 16.7.1 + version: 16.7.1 + devDependencies: + '@eslint/js': + specifier: 8.46.0 + version: 8.46.0 + '@graphql-eslint/eslint-plugin': + specifier: workspace:* + version: link:../../packages/plugin/dist + eslint: + specifier: 8.46.0 + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) + examples/svelte-code-file: dependencies: graphql: @@ -239,7 +220,7 @@ importers: version: link:../../packages/plugin/dist eslint: specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) svelte: specifier: 4.1.2 version: 4.1.2 @@ -264,7 +245,7 @@ importers: version: 3.3.4 eslint: specifier: 8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) vue-eslint-parser: specifier: 9.3.1 version: 9.3.1(eslint@8.46.0) @@ -286,21 +267,21 @@ importers: debug: specifier: ^4.3.4 version: 4.3.4 + eslint: + specifier: ^8 + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) fast-glob: specifier: ^3.2.12 version: 3.2.12 graphql-config: - specifier: ^4.4.0 - version: 4.4.0(@types/node@18.17.1)(cosmiconfig-toml-loader@1.0.0)(cosmiconfig-typescript-loader@4.4.0)(graphql@16.7.1) + specifier: ^4.5.0 + version: 4.5.0(@types/node@18.17.1)(graphql@16.7.1) graphql-depth-limit: specifier: ^1.1.0 version: 1.1.0(graphql@16.7.1) lodash.lowercase: specifier: ^4.3.0 version: 4.3.0 - tslib: - specifier: ^2.4.1 - version: 2.4.1 devDependencies: '@theguild/eslint-rule-tester': specifier: workspace:* @@ -345,7 +326,7 @@ importers: version: 18.17.1 eslint: specifier: ^8.46.0 - version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + version: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) website: dependencies: @@ -425,7 +406,6 @@ packages: /@aashutoshrathi/word-wrap@1.2.6: resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} engines: {node: '>=0.10.0'} - dev: true /@algolia/autocomplete-core@1.10.0(@algolia/client-search@4.19.1)(algoliasearch@4.18.0)(search-insights@2.7.0): resolution: {integrity: sha512-zaQ4ZOtGkeUvDGObZvaULuZmU4kAcVu/Wm9EP6Vzij5wQ98FAKz1uHn2EPiCI0aFIoUfZi/WhJvn5l6qVBdYEA==} @@ -1108,6 +1088,7 @@ packages: engines: {node: '>=12'} dependencies: '@jridgewell/trace-mapping': 0.3.9 + dev: true /@esbuild-kit/cjs-loader@2.4.2: resolution: {integrity: sha512-BDXFbYOJzT/NBEtp71cvsrGPwGAMGRB/349rwKuoxNSiKjPraNNnlK6MIIabViCjqZugu6j+xeMDlEkWdHHJSg==} @@ -1510,14 +1491,12 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-visitor-keys: 3.4.2 - dev: true /@eslint-community/regexpp@4.6.2: resolution: {integrity: sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - dev: true /@eslint/eslintrc@2.1.1: resolution: {integrity: sha512-9t7ZA7NGGK8ckelF0PQCfcxIUzs1Md5rrO6U/c+FIQNanea5UZC0wqKXH4vHBccmu4ZJgZ2idtPeW7+Q2npOEA==} @@ -1534,12 +1513,10 @@ packages: strip-json-comments: 3.1.1 transitivePeerDependencies: - supports-color - dev: true /@eslint/js@8.46.0: resolution: {integrity: sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true /@floating-ui/core@1.4.1: resolution: {integrity: sha512-jk3WqquEJRlcyu7997NtR5PibI+y5bi+LS3hPmguVClypenMsCY3CBa3LAQnozRCtCrYWSEtAdiskpamuJRFOQ==} @@ -1588,7 +1565,7 @@ packages: '@graphql-tools/utils': 9.2.1(graphql@16.7.1) dataloader: 2.2.2 graphql: 16.7.1 - tslib: 2.4.1 + tslib: 2.6.1 value-or-promise: 1.0.12 dev: false @@ -1633,7 +1610,7 @@ packages: graphql: 16.7.1 graphql-ws: 5.12.1(graphql@16.7.1) isomorphic-ws: 5.0.0(ws@8.13.0) - tslib: 2.4.1 + tslib: 2.6.1 ws: 8.13.0 transitivePeerDependencies: - bufferutil @@ -1652,7 +1629,7 @@ packages: extract-files: 11.0.0 graphql: 16.7.1 meros: 1.3.0(@types/node@18.17.1) - tslib: 2.4.1 + tslib: 2.6.1 value-or-promise: 1.0.12 transitivePeerDependencies: - '@types/node' @@ -1667,7 +1644,7 @@ packages: '@types/ws': 8.5.5 graphql: 16.7.1 isomorphic-ws: 5.0.0(ws@8.13.0) - tslib: 2.4.1 + tslib: 2.6.1 ws: 8.13.0 transitivePeerDependencies: - bufferutil @@ -1683,7 +1660,7 @@ packages: '@graphql-typed-document-node/core': 3.2.0(graphql@16.7.1) '@repeaterjs/repeater': 3.0.4 graphql: 16.7.1 - tslib: 2.4.1 + tslib: 2.6.1 value-or-promise: 1.0.12 dev: false @@ -1696,7 +1673,7 @@ packages: '@graphql-tools/utils': 9.2.1(graphql@16.7.1) globby: 11.1.0 graphql: 16.7.1 - tslib: 2.4.1 + tslib: 2.6.1 unixify: 1.0.0 dev: false @@ -1723,7 +1700,7 @@ packages: '@graphql-tools/utils': 9.2.1(graphql@16.7.1) graphql: 16.7.1 resolve-from: 5.0.0 - tslib: 2.4.1 + tslib: 2.6.1 dev: false /@graphql-tools/json-file-loader@7.4.18(graphql@16.7.1): @@ -1734,7 +1711,7 @@ packages: '@graphql-tools/utils': 9.2.1(graphql@16.7.1) globby: 11.1.0 graphql: 16.7.1 - tslib: 2.4.1 + tslib: 2.6.1 unixify: 1.0.0 dev: false @@ -1747,7 +1724,7 @@ packages: '@graphql-tools/utils': 9.2.1(graphql@16.7.1) graphql: 16.7.1 p-limit: 3.1.0 - tslib: 2.4.1 + tslib: 2.6.1 dev: false /@graphql-tools/merge@8.4.2(graphql@16.7.1): @@ -1757,7 +1734,7 @@ packages: dependencies: '@graphql-tools/utils': 9.2.1(graphql@16.7.1) graphql: 16.7.1 - tslib: 2.4.1 + tslib: 2.6.1 dev: false /@graphql-tools/schema@9.0.19(graphql@16.7.1): @@ -1768,7 +1745,7 @@ packages: '@graphql-tools/merge': 8.4.2(graphql@16.7.1) '@graphql-tools/utils': 9.2.1(graphql@16.7.1) graphql: 16.7.1 - tslib: 2.4.1 + tslib: 2.6.1 value-or-promise: 1.0.12 dev: false @@ -1788,7 +1765,7 @@ packages: '@whatwg-node/fetch': 0.8.8 graphql: 16.7.1 isomorphic-ws: 5.0.0(ws@8.13.0) - tslib: 2.4.1 + tslib: 2.6.1 value-or-promise: 1.0.12 ws: 8.13.0 transitivePeerDependencies: @@ -1825,7 +1802,7 @@ packages: '@graphql-tools/schema': 9.0.19(graphql@16.7.1) '@graphql-tools/utils': 9.2.1(graphql@16.7.1) graphql: 16.7.1 - tslib: 2.4.1 + tslib: 2.6.1 value-or-promise: 1.0.12 dev: false @@ -1857,16 +1834,13 @@ packages: minimatch: 3.1.2 transitivePeerDependencies: - supports-color - dev: true /@humanwhocodes/module-importer@1.0.1: resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} - dev: true /@humanwhocodes/object-schema@1.2.1: resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} - dev: true /@ianvs/prettier-plugin-sort-imports@4.0.0-alpha.3(prettier@2.8.8): resolution: {integrity: sha512-3zUL/BQoNVoe1OHV7GQ5d4j51/QNvo4tvYNm0j87ZWzsj90jSPHIiI4KtQGM7ZCbmK+TXQBwJWSKVxkHl+iUPg==} @@ -1890,10 +1864,6 @@ packages: - supports-color dev: true - /@iarna/toml@2.2.5: - resolution: {integrity: sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==} - dev: false - /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -1921,6 +1891,7 @@ packages: /@jridgewell/resolve-uri@3.1.1: resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} engines: {node: '>=6.0.0'} + dev: true /@jridgewell/set-array@1.1.2: resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} @@ -1949,6 +1920,7 @@ packages: dependencies: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 + dev: true /@lit-labs/ssr-dom-shim@1.1.1: resolution: {integrity: sha512-kXOeFbfCm4fFf2A3WwVEeQj55tMZa8c8/f9AKHMobQMkzNUfUj+antR3fRPaZJawsa1aZiP/Da3ndpZrwEe4rQ==} @@ -2298,14 +2270,14 @@ packages: dependencies: asn1js: 3.0.5 pvtsutils: 1.3.2 - tslib: 2.4.1 + tslib: 2.6.1 dev: false /@peculiar/json-schema@1.1.12: resolution: {integrity: sha512-coUfuoMeIB7B8/NMekxaDzLhaYmp0HZNPEjYRm9goRou8UZIC3z21s0sL9AWoCw4EG876QyO3kYrc61WNF9B/w==} engines: {node: '>=8.0.0'} dependencies: - tslib: 2.4.1 + tslib: 2.6.1 dev: false /@peculiar/webcrypto@1.4.3: @@ -2910,7 +2882,7 @@ packages: '@rushstack/eslint-patch': 1.3.2 '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.46.0)(typescript@5.1.6) '@typescript-eslint/parser': 5.62.0(eslint@8.46.0)(typescript@5.1.6) - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-config-prettier: 8.9.0(eslint@8.46.0) eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.28.0)(eslint@8.46.0) eslint-plugin-import: 2.28.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.46.0) @@ -2983,15 +2955,19 @@ packages: /@tsconfig/node10@1.0.9: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} + dev: true /@tsconfig/node12@1.0.11: resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + dev: true /@tsconfig/node14@1.0.3: resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + dev: true /@tsconfig/node16@1.0.4: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + dev: true /@types/acorn@4.0.6: resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==} @@ -3205,7 +3181,7 @@ packages: '@typescript-eslint/type-utils': 5.62.0(eslint@8.46.0)(typescript@5.1.6) '@typescript-eslint/utils': 5.62.0(eslint@8.46.0)(typescript@5.1.6) debug: 4.3.4 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) graphemer: 1.4.0 ignore: 5.2.4 natural-compare-lite: 1.4.0 @@ -3230,7 +3206,7 @@ packages: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.1.6) debug: 4.3.4 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) typescript: 5.1.6 transitivePeerDependencies: - supports-color @@ -3257,7 +3233,7 @@ packages: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.1.6) '@typescript-eslint/utils': 5.62.0(eslint@8.46.0)(typescript@5.1.6) debug: 4.3.4 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) tsutils: 3.21.0(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: @@ -3302,7 +3278,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.1.6) - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-scope: 5.1.1 semver: 7.5.4 transitivePeerDependencies: @@ -3522,7 +3498,7 @@ packages: busboy: 1.6.0 fast-querystring: 1.1.2 fast-url-parser: 1.1.3 - tslib: 2.4.1 + tslib: 2.6.1 dev: false /@xtuc/ieee754@1.2.0: @@ -3629,7 +3605,6 @@ packages: /ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} - dev: true /ansi-regex@6.0.1: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} @@ -3684,6 +3659,7 @@ packages: /arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + dev: true /arg@5.0.2: resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} @@ -3795,7 +3771,7 @@ packages: dependencies: pvtsutils: 1.3.2 pvutils: 1.1.3 - tslib: 2.4.1 + tslib: 2.6.1 dev: false /assertion-error@1.1.0: @@ -4284,27 +4260,6 @@ packages: layout-base: 2.0.1 dev: false - /cosmiconfig-toml-loader@1.0.0: - resolution: {integrity: sha512-H/2gurFWVi7xXvCyvsWRLCMekl4tITJcX0QEsDMpzxtuxDyM59xLatYNg4s/k9AA/HdtCYfj2su8mgA0GSDLDA==} - dependencies: - '@iarna/toml': 2.2.5 - dev: false - - /cosmiconfig-typescript-loader@4.4.0(@types/node@18.17.1)(cosmiconfig@8.2.0)(ts-node@10.9.1)(typescript@5.1.6): - resolution: {integrity: sha512-BabizFdC3wBHhbI4kJh0VkQP9GkBfoHPydD0COMce1nJ1kJAB3F2TmJ/I7diULBKtmEWSwEbuN/KDtgnmUUVmw==} - engines: {node: '>=v14.21.3'} - peerDependencies: - '@types/node': '*' - cosmiconfig: '>=7' - ts-node: '>=10' - typescript: '>=4' - dependencies: - '@types/node': 18.17.1 - cosmiconfig: 8.2.0 - ts-node: 10.9.1(@types/node@18.17.1)(typescript@5.1.6) - typescript: 5.1.6 - dev: false - /cosmiconfig-typescript-loader@5.0.0(@types/node@18.17.1)(cosmiconfig@8.2.0)(typescript@5.1.6): resolution: {integrity: sha512-+8cK7jRAReYkMwMiG+bxhcNKiHJDM6bR9FD/nGBXOWdMLuYawjF5cGrtLilJ+LGd3ZjCXnJjR5DkfWPoIVlqJA==} engines: {node: '>=v16'} @@ -4337,9 +4292,11 @@ packages: js-yaml: 4.1.0 parse-json: 5.2.0 path-type: 4.0.0 + dev: true /create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + dev: true /cross-spawn@5.1.0: resolution: {integrity: sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==} @@ -4355,7 +4312,6 @@ packages: path-key: 3.1.1 shebang-command: 2.0.0 which: 2.0.2 - dev: true /css-declaration-sorter@6.4.1(postcss@8.4.27): resolution: {integrity: sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==} @@ -4882,7 +4838,6 @@ packages: /deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} - dev: true /deepmerge@4.3.1: resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} @@ -4952,6 +4907,7 @@ packages: /diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} + dev: true /diff@5.1.0: resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==} @@ -4979,7 +4935,6 @@ packages: engines: {node: '>=6.0.0'} dependencies: esutils: 2.0.3 - dev: true /dom-serializer@2.0.0: resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} @@ -5216,7 +5171,6 @@ packages: /escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - dev: true /escape-string-regexp@5.0.0: resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} @@ -5229,7 +5183,7 @@ packages: peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) dev: true /eslint-import-resolver-node@0.3.7: @@ -5251,7 +5205,7 @@ packages: dependencies: debug: 4.3.4 enhanced-resolve: 5.15.0 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.46.0) eslint-plugin-import: 2.28.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.46.0) get-tsconfig: 4.6.2 @@ -5274,7 +5228,7 @@ packages: dependencies: acorn: 8.10.0 acorn-jsx: 5.3.2(acorn@8.10.0) - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) espree: 9.6.1 estree-util-visit: 1.2.1 remark-mdx: 2.3.0 @@ -5314,7 +5268,7 @@ packages: dependencies: '@typescript-eslint/parser': 5.62.0(eslint@8.46.0)(typescript@5.1.6) debug: 3.2.7 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-import-resolver-node: 0.3.7 eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.28.0)(eslint@8.46.0) transitivePeerDependencies: @@ -5329,7 +5283,7 @@ packages: dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) '@eslint-community/regexpp': 4.6.2 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) dev: true /eslint-plugin-eslint-plugin@5.0.7(patch_hash=cdhdgvmsbh3fbusrlxsl6de2he)(eslint@8.46.0): @@ -5338,7 +5292,7 @@ packages: peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-utils: 3.0.0(eslint@8.46.0) estraverse: 5.3.0 dev: true @@ -5361,7 +5315,7 @@ packages: array.prototype.flatmap: 1.3.1 debug: 3.2.7 doctrine: 2.1.0 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-import-resolver-node: 0.3.7 eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.46.0) has: 1.0.3 @@ -5387,7 +5341,7 @@ packages: eslint: '>=6.0.0' dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) jsonc-eslint-parser: 2.3.0 natural-compare: 1.4.0 dev: true @@ -5407,7 +5361,7 @@ packages: axobject-query: 3.2.1 damerau-levenshtein: 1.0.8 emoji-regex: 9.2.2 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) has: 1.0.3 jsx-ast-utils: 3.3.5 language-tags: 1.0.5 @@ -5423,7 +5377,7 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) mdast-util-from-markdown: 0.8.5 transitivePeerDependencies: - supports-color @@ -5435,7 +5389,7 @@ packages: peerDependencies: eslint: '>=8.0.0' dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-mdx: 2.1.0(eslint@8.46.0) eslint-plugin-markdown: 3.0.1(eslint@8.46.0) remark-mdx: 2.3.0 @@ -5456,7 +5410,7 @@ packages: dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) builtins: 5.0.1 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-plugin-es-x: 7.2.0(eslint@8.46.0) ignore: 5.2.4 is-core-module: 2.12.1 @@ -5476,7 +5430,7 @@ packages: eslint-config-prettier: optional: true dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-config-prettier: 8.9.0(eslint@8.46.0) prettier: 2.8.8 prettier-linter-helpers: 1.0.0 @@ -5488,7 +5442,7 @@ packages: peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) dev: true /eslint-plugin-react-hooks@4.6.0(eslint@8.46.0): @@ -5497,7 +5451,7 @@ packages: peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) dev: true /eslint-plugin-react@7.33.1(eslint@8.46.0): @@ -5510,7 +5464,7 @@ packages: array.prototype.flatmap: 1.3.1 array.prototype.tosorted: 1.1.1 doctrine: 2.1.0 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) estraverse: 5.3.0 jsx-ast-utils: 3.3.5 minimatch: 3.1.2 @@ -5530,7 +5484,7 @@ packages: peerDependencies: eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) dev: true /eslint-plugin-tailwindcss@3.13.0(tailwindcss@3.3.3): @@ -5554,7 +5508,7 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) ci-info: 3.8.0 clean-regexp: 1.0.0 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) esquery: 1.5.0 indent-string: 4.0.0 is-builtin-module: 3.2.1 @@ -5576,7 +5530,7 @@ packages: eslint: '>=6.0.0' dependencies: debug: 4.3.4 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) lodash: 4.17.21 natural-compare: 1.4.0 yaml-eslint-parser: 1.2.2 @@ -5597,7 +5551,6 @@ packages: dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 - dev: true /eslint-utils@3.0.0(eslint@8.46.0): resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} @@ -5605,7 +5558,7 @@ packages: peerDependencies: eslint: '>=5' dependencies: - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-visitor-keys: 2.1.0 dev: true @@ -5617,9 +5570,8 @@ packages: /eslint-visitor-keys@3.4.2: resolution: {integrity: sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - /eslint@8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu): + /eslint@8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu): resolution: {integrity: sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true @@ -5663,7 +5615,6 @@ packages: text-table: 0.2.0 transitivePeerDependencies: - supports-color - dev: true patched: true /espree@9.6.1: @@ -5673,7 +5624,6 @@ packages: acorn: 8.10.0 acorn-jsx: 5.3.2(acorn@8.10.0) eslint-visitor-keys: 3.4.2 - dev: true /esprima@4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} @@ -5685,7 +5635,6 @@ packages: engines: {node: '>=0.10'} dependencies: estraverse: 5.3.0 - dev: true /esrecurse@4.3.0: resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} @@ -5751,7 +5700,6 @@ packages: /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} - dev: true /events@3.3.0: resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} @@ -5878,7 +5826,6 @@ packages: /fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - dev: true /fast-querystring@1.1.2: resolution: {integrity: sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==} @@ -5908,7 +5855,6 @@ packages: engines: {node: ^10.12.0 || >=12.0.0} dependencies: flat-cache: 3.0.4 - dev: true /file-loader@4.3.0(webpack@5.88.2): resolution: {integrity: sha512-aKrYPYjF1yG3oX0kWRrqrSMfgftm7oJW5M+m4owoldH5C51C0RkIwB++JbRvEW3IU6/ZG5n8UvEcdgwOt2UOWA==} @@ -5941,7 +5887,6 @@ packages: dependencies: locate-path: 6.0.0 path-exists: 4.0.0 - dev: true /find-yarn-workspace-root2@1.2.16: resolution: {integrity: sha512-hr6hb1w8ePMpPVUK39S4RlwJzi+xPLuVuG8XlwXU3KD5Yn3qgBWVfy3AzNlDhWvE1EORCE65/Qm26rFQt3VLVA==} @@ -5956,11 +5901,9 @@ packages: dependencies: flatted: 3.2.7 rimraf: 3.0.2 - dev: true /flatted@3.2.7: resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==} - dev: true /flexsearch@0.7.31: resolution: {integrity: sha512-XGozTsMPYkm+6b5QL3Z9wQcJjNYxp0CYn3U1gO7dwD6PAqU1SVWZxI9CCg3z+ml3YfqdPnrBehaBrnH2AGKbNA==} @@ -6042,7 +5985,6 @@ packages: /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - dev: true /fsevents@2.3.2: resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} @@ -6159,7 +6101,6 @@ packages: engines: {node: '>=10.13.0'} dependencies: is-glob: 4.0.3 - dev: true /glob-to-regexp@0.4.1: resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} @@ -6196,7 +6137,6 @@ packages: minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 - dev: true /glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} @@ -6218,7 +6158,6 @@ packages: engines: {node: '>=8'} dependencies: type-fest: 0.20.2 - dev: true /globalthis@1.0.3: resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} @@ -6264,15 +6203,16 @@ packages: /graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} - dev: true - /graphql-config@4.4.0(@types/node@18.17.1)(cosmiconfig-toml-loader@1.0.0)(cosmiconfig-typescript-loader@4.4.0)(graphql@16.7.1): - resolution: {integrity: sha512-QUrX7R4htnTBTi83a0IlIilWVfiLEG8ANFlHRcxoZiTvOXTbgan67SUdGe1OlopbDuyNgtcy4ladl3Gvk4C36A==} + /graphql-config@4.5.0(@types/node@18.17.1)(graphql@16.7.1): + resolution: {integrity: sha512-x6D0/cftpLUJ0Ch1e5sj1TZn6Wcxx4oMfmhaG9shM0DKajA9iR+j1z86GSTQ19fShbGvrSSvbIQsHku6aQ6BBw==} engines: {node: '>= 10.0.0'} peerDependencies: cosmiconfig-toml-loader: ^1.0.0 - cosmiconfig-typescript-loader: ^4.0.0 graphql: ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 + peerDependenciesMeta: + cosmiconfig-toml-loader: + optional: true dependencies: '@graphql-tools/graphql-file-loader': 7.5.17(graphql@16.7.1) '@graphql-tools/json-file-loader': 7.4.18(graphql@16.7.1) @@ -6281,12 +6221,11 @@ packages: '@graphql-tools/url-loader': 7.17.18(@types/node@18.17.1)(graphql@16.7.1) '@graphql-tools/utils': 9.2.1(graphql@16.7.1) cosmiconfig: 8.0.0 - cosmiconfig-toml-loader: 1.0.0 - cosmiconfig-typescript-loader: 4.4.0(@types/node@18.17.1)(cosmiconfig@8.2.0)(ts-node@10.9.1)(typescript@5.1.6) graphql: 16.7.1 - minimatch: 4.2.1 + jiti: 1.17.1 + minimatch: 4.2.3 string-env-interpolation: 1.0.1 - tslib: 2.4.1 + tslib: 2.6.1 transitivePeerDependencies: - '@types/node' - bufferutil @@ -6304,16 +6243,6 @@ packages: graphql: 16.7.1 dev: false - /graphql-tag@2.12.6(graphql@16.7.1): - resolution: {integrity: sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==} - engines: {node: '>=10'} - peerDependencies: - graphql: ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 - dependencies: - graphql: 16.7.1 - tslib: 2.6.1 - dev: false - /graphql-ws@5.12.1(graphql@16.7.1): resolution: {integrity: sha512-umt4f5NnMK46ChM2coO36PTFhHouBrK9stWWBczERguwYrGnPNxJ9dimU6IyOBfOkC6Izhkg4H8+F51W/8CYDg==} engines: {node: '>=10'} @@ -6571,7 +6500,6 @@ packages: /imurmurhash@0.1.4: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} - dev: true /indent-string@4.0.0: resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} @@ -6583,11 +6511,9 @@ packages: dependencies: once: 1.4.0 wrappy: 1.0.2 - dev: true /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: true /ini@4.1.1: resolution: {integrity: sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==} @@ -6795,7 +6721,6 @@ packages: /is-path-inside@3.0.3: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} - dev: true /is-plain-obj@1.1.0: resolution: {integrity: sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==} @@ -6938,6 +6863,11 @@ packages: merge-stream: 2.0.0 supports-color: 8.1.1 + /jiti@1.17.1: + resolution: {integrity: sha512-NZIITw8uZQFuzQimqjUxIrIcEdxYDFIe/0xYfIlVXTkiBjjyBEvgasj5bb0/cHtPRD/NziPbT312sFrkI5ALpw==} + hasBin: true + dev: false + /jiti@1.19.1: resolution: {integrity: sha512-oVhqoRDaBXf7sjkll95LHVS6Myyyb1zaunVwk4Z0+WPSW4gjS0pl01zYKHScTuyEhQsFxV5L4DR5r+YqSyqyyg==} hasBin: true @@ -7012,7 +6942,6 @@ packages: /json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} - dev: true /json5@1.0.2: resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} @@ -7105,7 +7034,6 @@ packages: dependencies: prelude-ls: 1.2.1 type-check: 0.4.0 - dev: true /lilconfig@2.1.0: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} @@ -7202,7 +7130,6 @@ packages: engines: {node: '>=10'} dependencies: p-locate: 5.0.0 - dev: true /lodash-es@4.17.21: resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} @@ -7233,7 +7160,6 @@ packages: /lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} - dev: true /lodash.sortby@4.7.0: resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} @@ -7306,6 +7232,7 @@ packages: /make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + dev: true /map-obj@1.0.1: resolution: {integrity: sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==} @@ -7980,10 +7907,9 @@ packages: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: brace-expansion: 1.1.11 - dev: true - /minimatch@4.2.1: - resolution: {integrity: sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==} + /minimatch@4.2.3: + resolution: {integrity: sha512-lIUdtK5hdofgCTu3aT0sOaHsYR37viUuIc0rwnnDXImbwFRcumyLMeZaM0t0I/fgxS6s6JMfu0rLD1Wz9pv1ng==} engines: {node: '>=10'} dependencies: brace-expansion: 1.1.11 @@ -8077,7 +8003,6 @@ packages: /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - dev: true /neo-async@2.6.2: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} @@ -8437,7 +8362,6 @@ packages: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: wrappy: 1.0.2 - dev: true /onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} @@ -8478,7 +8402,6 @@ packages: levn: 0.4.1 prelude-ls: 1.2.1 type-check: 0.4.0 - dev: true /os-tmpdir@1.0.2: resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} @@ -8533,7 +8456,6 @@ packages: engines: {node: '>=10'} dependencies: p-limit: 3.1.0 - dev: true /p-map@2.1.0: resolution: {integrity: sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==} @@ -8625,12 +8547,10 @@ packages: /path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} - dev: true /path-is-absolute@1.0.1: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} - dev: true /path-key@2.0.1: resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==} @@ -8640,7 +8560,6 @@ packages: /path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} - dev: true /path-key@4.0.0: resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} @@ -9107,7 +9026,6 @@ packages: /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - dev: true /prettier-linter-helpers@1.0.0: resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} @@ -9238,7 +9156,7 @@ packages: /pvtsutils@1.3.2: resolution: {integrity: sha512-+Ipe2iNUyrZz+8K/2IOo+kKikdtfhRKzNpQbruF2URmqPtoqAs8g3xS7TJvFF2GcPXjh7DkqMnpVveRFq4PgEQ==} dependencies: - tslib: 2.4.1 + tslib: 2.6.1 dev: false /pvutils@1.1.3: @@ -9656,7 +9574,6 @@ packages: hasBin: true dependencies: glob: 7.2.3 - dev: true /rimraf@5.0.1: resolution: {integrity: sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg==} @@ -9818,7 +9735,6 @@ packages: engines: {node: '>=8'} dependencies: shebang-regex: 3.0.0 - dev: true /shebang-regex@1.0.0: resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==} @@ -9827,7 +9743,6 @@ packages: /shebang-regex@3.0.0: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - dev: true /shiki@0.14.3: resolution: {integrity: sha512-U3S/a+b0KS+UkTyMjoNojvTgrBHjgp7L6ovhFVZsXmBGnVdQ4K4U9oK0z63w538S91ATngv1vXigHCSWOwnr+g==} @@ -10058,7 +9973,6 @@ packages: engines: {node: '>=8'} dependencies: ansi-regex: 5.0.1 - dev: true /strip-ansi@7.1.0: resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} @@ -10101,7 +10015,6 @@ packages: /strip-json-comments@3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} - dev: true /strip-literal@1.0.1: resolution: {integrity: sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==} @@ -10350,7 +10263,6 @@ packages: /text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - dev: true /thenify-all@1.6.0: resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} @@ -10501,6 +10413,7 @@ packages: typescript: 5.1.6 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 + dev: true /tsconfig-paths@3.14.2: resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} @@ -10658,7 +10571,6 @@ packages: engines: {node: '>= 0.8.0'} dependencies: prelude-ls: 1.2.1 - dev: true /type-detect@4.0.8: resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} @@ -10673,7 +10585,6 @@ packages: /type-fest@0.20.2: resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} engines: {node: '>=10'} - dev: true /type-fest@0.6.0: resolution: {integrity: sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==} @@ -10736,6 +10647,7 @@ packages: resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} engines: {node: '>=14.17'} hasBin: true + dev: true /ufo@1.2.0: resolution: {integrity: sha512-RsPyTbqORDNDxqAdQPQBpgqhWle1VcTSou/FraClYlHf6TZnQcGslpLcAphNR+sQW4q5lLWLbOsRlh9j24baQg==} @@ -11017,6 +10929,7 @@ packages: /v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + dev: true /validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -11226,7 +11139,7 @@ packages: eslint: '>=6.0.0' dependencies: debug: 4.3.4 - eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint: 8.46.0(patch_hash=yi5cqffjk423hcgr7hl33kguwu) eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.2 espree: 9.6.1 @@ -11274,7 +11187,7 @@ packages: '@peculiar/json-schema': 1.1.12 asn1js: 3.0.5 pvtsutils: 1.3.2 - tslib: 2.4.1 + tslib: 2.6.1 dev: false /webidl-conversions@3.0.1: @@ -11410,7 +11323,6 @@ packages: hasBin: true dependencies: isexe: 2.0.0 - dev: true /why-is-node-running@2.2.2: resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} @@ -11450,7 +11362,6 @@ packages: /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: true /ws@7.5.9: resolution: {integrity: sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==} @@ -11556,6 +11467,7 @@ packages: /yn@3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} + dev: true /yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} diff --git a/scripts/patch-graphql-eslint-browser.ts b/scripts/patch-graphql-eslint-browser.ts deleted file mode 100644 index d0f468ce749..00000000000 --- a/scripts/patch-graphql-eslint-browser.ts +++ /dev/null @@ -1,29 +0,0 @@ -import fs from 'node:fs/promises'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -const __dirname = fileURLToPath(new URL('.', import.meta.url)); -const CWD = path.resolve(__dirname, '..'); -const ROOT_DIR = path.join(CWD, 'packages', 'plugin', 'dist', 'esm'); - -async function patch(filePath: string, replace: (fileContent: string) => string): Promise { - const fullPath = `${ROOT_DIR}${filePath}`; - const fileContent = await fs.readFile(fullPath, 'utf8'); - const patchComment = '// GRAPHQL-ESLINT BROWSER PATCH\n'; - const isAlreadyPatched = fileContent.startsWith(patchComment); - const newContent = isAlreadyPatched ? fileContent : patchComment + replace(fileContent); - await fs.writeFile(fullPath, newContent, 'utf8'); - console.log(`✅ ${path.relative(CWD, fullPath)} ${isAlreadyPatched ? 'already ' : ''}patched!`); -} - -function commentLine(str: string): string { - return `// ${str}`; -} - -await patch('/index.js', str => str.replace('export * from "./testkit.js"', commentLine)); - -await patch('/parser.js', str => - str - .replace('const gqlConfig = loadGraphQLConfig(options)', commentLine) - .replace('const project = gqlConfig.getProjectForFile(realFilepath)', 'let project'), -); diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 6153837a526..323152af616 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -6,6 +6,11 @@ // ensure that nobody can accidentally use this config for a build "noEmit": true }, - "include": ["scripts/*.ts", "packages/plugin/__tests__/**/*.ts", "vite.config.ts", "serializer.ts"], + "include": [ + "scripts/*.ts", + "packages/plugin/__tests__/**/*.ts", + "vite.config.ts", + "serializer.ts" + ], "exclude": [] } diff --git a/tsconfig.json b/tsconfig.json index f0de7763cc8..fe20e9c0ce5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,11 +21,7 @@ "noImplicitReturns": true, "noUnusedLocals": true, "resolveJsonModule": true, - "skipLibCheck": true, - "paths": { - "@graphql-eslint/eslint-plugin": ["packages/plugin/src/index.ts"] - } + "skipLibCheck": true }, - "include": ["packages"], - "exclude": ["**/tests"] + "include": ["packages"] } diff --git a/website/next.config.js b/website/next.config.js index 56cbfd113fa..492f965f91d 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -21,13 +21,12 @@ 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'), - // fixes for processor.js Module not found: Can't resolve 'velocityjs' and other 36 modules - '@graphql-tools/graphql-tag-pluck': false, - '@graphql-tools/code-file-loader': false, - // fixes for graphql-config.js TypeError: (0 , module__WEBPACK_IMPORTED_MODULE_0__.createRequire) is not a function - 'graphql-config': false, - // fixes for schema.js and documents.js TypeError: Cannot read properties of undefined (reading 'split') - 'fast-glob': false, + '@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.mjs'), }; config.plugins.push( new webpack.NormalModuleReplacementPlugin(/^node:/, resource => { diff --git a/website/package.json b/website/package.json index 61b49a871b7..d0ef2743ee2 100644 --- a/website/package.json +++ b/website/package.json @@ -6,9 +6,8 @@ "scripts": { "analyze": "ANALYZE=true yarn build", "build": "next build && next-sitemap --config next-sitemap.config.cjs && next export", - "dev": "pnpm patch-browser && next", - "patch-browser": "tsx ../scripts/patch-graphql-eslint-browser.ts", - "prebuild": "tsx ../scripts/generate-docs.ts && pnpm patch-browser", + "dev": "next", + "prebuild": "tsx ../scripts/generate-docs.ts", "start": "next start", "theguild-nextra-algolia": "theguild-nextra-algolia" }, diff --git a/website/src/components/graphql-editor.tsx b/website/src/components/graphql-editor.tsx index d1b83c760a4..58b3f71f034 100644 --- a/website/src/components/graphql-editor.tsx +++ b/website/src/components/graphql-editor.tsx @@ -41,7 +41,9 @@ export function GraphQLEditor({ { parser: '@graphql-eslint/eslint-plugin', // extends: `plugin:@graphql-eslint/schema-recommended`, - parserOptions: { schema, documents }, + parserOptions: { + graphQLConfig: { schema, documents }, + }, rules: selectedRules, }, fileName, diff --git a/website/src/pages/rules/alphabetize.md b/website/src/pages/rules/alphabetize.md index f1546839e47..af4c16cff72 100644 --- a/website/src/pages/rules/alphabetize.md +++ b/website/src/pages/rules/alphabetize.md @@ -192,4 +192,4 @@ Additional restrictions: ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/alphabetize.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/alphabetize.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/alphabetize.spec.ts) diff --git a/website/src/pages/rules/description-style.md b/website/src/pages/rules/description-style.md index 0721f2fe9d6..de0dadb65e9 100644 --- a/website/src/pages/rules/description-style.md +++ b/website/src/pages/rules/description-style.md @@ -55,4 +55,4 @@ Default: `"block"` ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/description-style.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/description-style.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/description-style.spec.ts) diff --git a/website/src/pages/rules/input-name.md b/website/src/pages/rules/input-name.md index 7a6ad0d0ecf..8ea8dd2ac5a 100644 --- a/website/src/pages/rules/input-name.md +++ b/website/src/pages/rules/input-name.md @@ -78,4 +78,4 @@ Default: `true` ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/input-name.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/input-name.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/input-name.spec.ts) diff --git a/website/src/pages/rules/lone-executable-definition.md b/website/src/pages/rules/lone-executable-definition.md index 90ca6defd4e..40115628dcd 100644 --- a/website/src/pages/rules/lone-executable-definition.md +++ b/website/src/pages/rules/lone-executable-definition.md @@ -57,4 +57,4 @@ Additional restrictions: ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/lone-executable-definition.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/lone-executable-definition.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/lone-executable-definition.spec.ts) diff --git a/website/src/pages/rules/match-document-filename.md b/website/src/pages/rules/match-document-filename.md index edc3268f46a..6b35b9430a9 100644 --- a/website/src/pages/rules/match-document-filename.md +++ b/website/src/pages/rules/match-document-filename.md @@ -179,4 +179,4 @@ This element must be one of the following enum values: ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/match-document-filename.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/match-document-filename.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/match-document-filename.spec.ts) diff --git a/website/src/pages/rules/naming-convention.md b/website/src/pages/rules/naming-convention.md index 04386d09971..ba603ff5413 100644 --- a/website/src/pages/rules/naming-convention.md +++ b/website/src/pages/rules/naming-convention.md @@ -360,4 +360,4 @@ Option to skip validation of some words, e.g. acronyms ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/naming-convention.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/naming-convention.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/naming-convention.spec.ts) diff --git a/website/src/pages/rules/no-anonymous-operations.md b/website/src/pages/rules/no-anonymous-operations.md index b3eafc98e95..e8695be21d2 100644 --- a/website/src/pages/rules/no-anonymous-operations.md +++ b/website/src/pages/rules/no-anonymous-operations.md @@ -41,4 +41,4 @@ query user { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-anonymous-operations.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-anonymous-operations.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-anonymous-operations.spec.ts) diff --git a/website/src/pages/rules/no-case-insensitive-enum-values-duplicates.md b/website/src/pages/rules/no-case-insensitive-enum-values-duplicates.md index 18ce650a4c2..5970efb4fff 100644 --- a/website/src/pages/rules/no-case-insensitive-enum-values-duplicates.md +++ b/website/src/pages/rules/no-case-insensitive-enum-values-duplicates.md @@ -44,4 +44,4 @@ enum MyEnum { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-case-insensitive-enum-values-duplicates.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-case-insensitive-enum-values-duplicates.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-case-insensitive-enum-values-duplicates.spec.ts) diff --git a/website/src/pages/rules/no-deprecated.md b/website/src/pages/rules/no-deprecated.md index 3582e1b5299..e18cdc790e0 100644 --- a/website/src/pages/rules/no-deprecated.md +++ b/website/src/pages/rules/no-deprecated.md @@ -86,4 +86,4 @@ query user { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-deprecated.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-deprecated.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-deprecated.spec.ts) diff --git a/website/src/pages/rules/no-duplicate-fields.md b/website/src/pages/rules/no-duplicate-fields.md index 4927d8c1540..473c94243b3 100644 --- a/website/src/pages/rules/no-duplicate-fields.md +++ b/website/src/pages/rules/no-duplicate-fields.md @@ -67,4 +67,4 @@ query ( ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-duplicate-fields.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-duplicate-fields.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-duplicate-fields.spec.ts) diff --git a/website/src/pages/rules/no-hashtag-description.md b/website/src/pages/rules/no-hashtag-description.md index dbe1bd82a28..26fd0e38d43 100644 --- a/website/src/pages/rules/no-hashtag-description.md +++ b/website/src/pages/rules/no-hashtag-description.md @@ -60,4 +60,4 @@ type User { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-hashtag-description.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-hashtag-description.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-hashtag-description.spec.ts) diff --git a/website/src/pages/rules/no-one-place-fragments.md b/website/src/pages/rules/no-one-place-fragments.md index 3c7f19d9f7e..f143dca5333 100644 --- a/website/src/pages/rules/no-one-place-fragments.md +++ b/website/src/pages/rules/no-one-place-fragments.md @@ -49,4 +49,4 @@ fragment UserFields on User { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-one-place-fragments.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-one-place-fragments.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-one-place-fragments.spec.ts) diff --git a/website/src/pages/rules/no-root-type.md b/website/src/pages/rules/no-root-type.md index edd6b3dc228..73ef7acc8e1 100644 --- a/website/src/pages/rules/no-root-type.md +++ b/website/src/pages/rules/no-root-type.md @@ -53,4 +53,4 @@ Additional restrictions: ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-root-type.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-root-type.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-root-type.spec.ts) diff --git a/website/src/pages/rules/no-scalar-result-type-on-mutation.md b/website/src/pages/rules/no-scalar-result-type-on-mutation.md index d30371b439e..c5c7a86d611 100644 --- a/website/src/pages/rules/no-scalar-result-type-on-mutation.md +++ b/website/src/pages/rules/no-scalar-result-type-on-mutation.md @@ -37,4 +37,4 @@ type Mutation { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-scalar-result-type-on-mutation.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-scalar-result-type-on-mutation.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts) diff --git a/website/src/pages/rules/no-typename-prefix.md b/website/src/pages/rules/no-typename-prefix.md index b7b7e43f7b7..d274a65770f 100644 --- a/website/src/pages/rules/no-typename-prefix.md +++ b/website/src/pages/rules/no-typename-prefix.md @@ -40,4 +40,4 @@ type User { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-typename-prefix.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-typename-prefix.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-typename-prefix.spec.ts) diff --git a/website/src/pages/rules/no-unreachable-types.md b/website/src/pages/rules/no-unreachable-types.md index 07c65dc4b65..34dee2fe905 100644 --- a/website/src/pages/rules/no-unreachable-types.md +++ b/website/src/pages/rules/no-unreachable-types.md @@ -50,4 +50,4 @@ type Query { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-unreachable-types.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-unreachable-types.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-unreachable-types.spec.ts) diff --git a/website/src/pages/rules/no-unused-fields.md b/website/src/pages/rules/no-unused-fields.md index 3d3051fd1e7..9d9ac1df456 100644 --- a/website/src/pages/rules/no-unused-fields.md +++ b/website/src/pages/rules/no-unused-fields.md @@ -62,4 +62,4 @@ query { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-unused-fields.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/no-unused-fields.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-unused-fields.spec.ts) diff --git a/website/src/pages/rules/relay-arguments.md b/website/src/pages/rules/relay-arguments.md index 72fa5ba6c99..fe9024730a3 100644 --- a/website/src/pages/rules/relay-arguments.md +++ b/website/src/pages/rules/relay-arguments.md @@ -57,4 +57,4 @@ Default: `true` ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/relay-arguments.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/relay-arguments.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/relay-arguments.spec.ts) diff --git a/website/src/pages/rules/relay-connection-types.md b/website/src/pages/rules/relay-connection-types.md index 20b478bebdc..826f747e1ff 100644 --- a/website/src/pages/rules/relay-connection-types.md +++ b/website/src/pages/rules/relay-connection-types.md @@ -41,4 +41,4 @@ type UserConnection { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/relay-connection-types.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/relay-connection-types.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/relay-connection-types.spec.ts) diff --git a/website/src/pages/rules/relay-edge-types.md b/website/src/pages/rules/relay-edge-types.md index 1a5fa10afca..5ea110f305c 100644 --- a/website/src/pages/rules/relay-edge-types.md +++ b/website/src/pages/rules/relay-edge-types.md @@ -58,4 +58,4 @@ Default: `true` ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/relay-edge-types.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/relay-edge-types.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/relay-edge-types.spec.ts) diff --git a/website/src/pages/rules/relay-page-info.md b/website/src/pages/rules/relay-page-info.md index c507d5c981a..7cc5aba2f3e 100644 --- a/website/src/pages/rules/relay-page-info.md +++ b/website/src/pages/rules/relay-page-info.md @@ -32,4 +32,4 @@ type PageInfo { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/relay-page-info.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/relay-page-info.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/relay-page-info.spec.ts) diff --git a/website/src/pages/rules/require-deprecation-date.md b/website/src/pages/rules/require-deprecation-date.md index 72581d5af38..a63b1871915 100644 --- a/website/src/pages/rules/require-deprecation-date.md +++ b/website/src/pages/rules/require-deprecation-date.md @@ -57,4 +57,4 @@ The schema defines the following properties: ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-deprecation-date.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/require-deprecation-date.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-deprecation-date.spec.ts) diff --git a/website/src/pages/rules/require-deprecation-reason.md b/website/src/pages/rules/require-deprecation-reason.md index fd9aa6c895d..669124dfc06 100644 --- a/website/src/pages/rules/require-deprecation-reason.md +++ b/website/src/pages/rules/require-deprecation-reason.md @@ -47,4 +47,4 @@ type MyType { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-deprecation-reason.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/require-deprecation-reason.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-deprecation-reason.spec.ts) diff --git a/website/src/pages/rules/require-description.md b/website/src/pages/rules/require-description.md index 9e8d0e74417..9eea8764a59 100644 --- a/website/src/pages/rules/require-description.md +++ b/website/src/pages/rules/require-description.md @@ -145,4 +145,4 @@ Read more about this kind on ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-description.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/require-description.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-description.spec.ts) diff --git a/website/src/pages/rules/require-field-of-type-query-in-mutation-result.md b/website/src/pages/rules/require-field-of-type-query-in-mutation-result.md index 816cf37392a..ceb2aa562df 100644 --- a/website/src/pages/rules/require-field-of-type-query-in-mutation-result.md +++ b/website/src/pages/rules/require-field-of-type-query-in-mutation-result.md @@ -48,4 +48,4 @@ type Mutation { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/require-field-of-type-query-in-mutation-result.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts) diff --git a/website/src/pages/rules/require-id-when-available.md b/website/src/pages/rules/require-id-when-available.md index 7b1026bba04..213466fb823 100644 --- a/website/src/pages/rules/require-id-when-available.md +++ b/website/src/pages/rules/require-id-when-available.md @@ -89,4 +89,4 @@ The schema defines the following additional types: ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-id-when-available.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/require-id-when-available.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-id-when-available.spec.ts) diff --git a/website/src/pages/rules/require-import-fragment.md b/website/src/pages/rules/require-import-fragment.md index a87b4e9647d..0162cc996da 100644 --- a/website/src/pages/rules/require-import-fragment.md +++ b/website/src/pages/rules/require-import-fragment.md @@ -68,4 +68,4 @@ query { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-import-fragment.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/require-import-fragment.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-import-fragment.spec.ts) diff --git a/website/src/pages/rules/require-nullable-fields-with-oneof.md b/website/src/pages/rules/require-nullable-fields-with-oneof.md index 7bd88349ea7..2294563513f 100644 --- a/website/src/pages/rules/require-nullable-fields-with-oneof.md +++ b/website/src/pages/rules/require-nullable-fields-with-oneof.md @@ -36,4 +36,4 @@ input Input @oneOf { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-nullable-fields-with-oneof.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/require-nullable-fields-with-oneof.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-nullable-fields-with-oneof.spec.ts) diff --git a/website/src/pages/rules/require-nullable-result-in-root.md b/website/src/pages/rules/require-nullable-result-in-root.md index 1a3d0ad4849..00369c8f8e8 100644 --- a/website/src/pages/rules/require-nullable-result-in-root.md +++ b/website/src/pages/rules/require-nullable-result-in-root.md @@ -39,4 +39,4 @@ type Query { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-nullable-result-in-root.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/require-nullable-result-in-root.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-nullable-result-in-root.spec.ts) diff --git a/website/src/pages/rules/require-type-pattern-with-oneof.md b/website/src/pages/rules/require-type-pattern-with-oneof.md index b1e79ccbf9a..990f1e23d63 100644 --- a/website/src/pages/rules/require-type-pattern-with-oneof.md +++ b/website/src/pages/rules/require-type-pattern-with-oneof.md @@ -37,4 +37,4 @@ type DoSomethingSuccess { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-type-pattern-with-oneof.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/require-type-pattern-with-oneof.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-type-pattern-with-oneof.spec.ts) diff --git a/website/src/pages/rules/selection-set-depth.md b/website/src/pages/rules/selection-set-depth.md index 0335b173792..d58adda9dd8 100644 --- a/website/src/pages/rules/selection-set-depth.md +++ b/website/src/pages/rules/selection-set-depth.md @@ -84,4 +84,4 @@ Additional restrictions: ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/selection-set-depth.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/selection-set-depth.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/selection-set-depth.spec.ts) diff --git a/website/src/pages/rules/strict-id-in-types.md b/website/src/pages/rules/strict-id-in-types.md index 0e5ff884f3e..a7b0ef8580d 100644 --- a/website/src/pages/rules/strict-id-in-types.md +++ b/website/src/pages/rules/strict-id-in-types.md @@ -127,4 +127,4 @@ Additional restrictions: ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/strict-id-in-types.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/strict-id-in-types.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/strict-id-in-types.spec.ts) diff --git a/website/src/pages/rules/unique-fragment-name.md b/website/src/pages/rules/unique-fragment-name.md index 730ad6ed25d..0ee61bed76c 100644 --- a/website/src/pages/rules/unique-fragment-name.md +++ b/website/src/pages/rules/unique-fragment-name.md @@ -53,4 +53,4 @@ fragment UserFields on User { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/unique-fragment-name.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/unique-fragment-name.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/unique-fragment-name.spec.ts) diff --git a/website/src/pages/rules/unique-operation-name.md b/website/src/pages/rules/unique-operation-name.md index 1c9e29dd950..34742d12d0f 100644 --- a/website/src/pages/rules/unique-operation-name.md +++ b/website/src/pages/rules/unique-operation-name.md @@ -57,4 +57,4 @@ query me { ## Resources - [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/unique-operation-name.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/tests/unique-operation-name.spec.ts) +- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/unique-operation-name.spec.ts)