From 804f8b617b3d63407db5bdea686bb3992801fa96 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Tue, 1 Aug 2023 19:28:07 +0200 Subject: [PATCH] [v4] Remove `GraphQLRuleTester` from bundle (#1792) Co-authored-by: github-actions[bot] --- ...-eslint_eslint-plugin-1792-dependencies.md | 9 + .changeset/strong-needles-compare.md | 15 + .github/workflows/pr.yaml | 3 +- .github/workflows/release.yml | 3 +- .github/workflows/tests.yml | 18 +- .github/workflows/website-integrity.yml | 6 +- .github/workflows/website.yml | 6 +- examples/basic/package.json | 2 +- examples/code-file/package.json | 2 +- .../graphql-config-code-file/package.json | 2 +- examples/graphql-config/package.json | 2 +- examples/monorepo/package.json | 2 +- .../package.json | 2 +- examples/prettier/package.json | 2 +- examples/svelte-code-file/package.json | 2 +- examples/vue-code-file/package.json | 2 +- package.json | 9 +- packages/plugin/package.json | 6 +- .../plugin/serializer.ts | 0 packages/plugin/src/index.ts | 1 - packages/plugin/src/rules/alphabetize.ts | 3 +- packages/plugin/src/rules/input-name.ts | 3 +- .../plugin/src/rules/naming-convention.ts | 3 +- packages/plugin/src/rules/relay-edge-types.ts | 3 +- packages/plugin/src/testkit.ts | 239 ---------- packages/plugin/src/types.ts | 11 +- .../tests/__snapshots__/alphabetize.spec.md | 92 ++-- .../__snapshots__/description-style.spec.md | 4 +- .../__snapshots__/eslint-directives.spec.md | 2 +- .../executable-definitions.spec.md | 2 +- .../fields-on-correct-type.spec.md | 4 +- .../tests/__snapshots__/input-name.spec.md | 80 +++- .../__snapshots__/known-directives.spec.md | 2 +- .../known-fragment-names.spec.md | 2 +- .../lone-executable-definition.spec.md | 6 +- .../lone-schema-definition.spec.md | 32 +- .../match-document-filename.spec.md | 14 +- .../__snapshots__/naming-convention.spec.md | 81 ++-- .../no-anonymous-operations.spec.md | 6 +- ...insensitive-enum-values-duplicates.spec.md | 4 +- .../tests/__snapshots__/no-deprecated.spec.md | 8 +- .../__snapshots__/no-duplicate-fields.spec.md | 8 +- .../no-hashtag-description.spec.md | 10 +- .../no-one-place-fragments.spec.md | 2 +- .../tests/__snapshots__/no-root-type.spec.md | 8 +- .../no-scalar-result-type-on-mutation.spec.md | 10 +- .../__snapshots__/no-typename-prefix.spec.md | 6 +- .../no-undefined-variables.spec.md | 2 +- .../no-unreachable-types.spec.md | 10 +- .../__snapshots__/no-unused-fields.spec.md | 4 +- .../possible-type-extension.spec.md | 2 +- .../__snapshots__/relay-arguments.spec.md | 6 +- .../relay-connection-types.spec.md | 12 +- .../__snapshots__/relay-edge-types.spec.md | 30 +- .../__snapshots__/relay-page-info.spec.md | 16 +- .../require-deprecation-date.spec.md | 10 +- .../require-deprecation-reason.spec.md | 2 +- .../__snapshots__/require-description.spec.md | 38 +- ...d-of-type-query-in-mutation-result.spec.md | 8 +- .../require-id-when-available.spec.md | 16 +- .../require-import-fragment.spec.md | 6 +- ...require-nullable-fields-with-oneof.spec.md | 4 +- .../require-nullable-result-in-root.spec.md | 6 +- .../require-type-pattern-with-oneof.spec.md | 4 +- .../__snapshots__/selection-set-depth.spec.md | 8 +- .../__snapshots__/strict-id-in-types.spec.md | 10 +- .../unique-fragment-name.spec.md | 4 +- .../unique-operation-name.spec.md | 4 +- .../__snapshots__/unique-type-names.spec.md | 2 +- packages/plugin/tests/alphabetize.spec.ts | 6 +- .../plugin/tests/description-style.spec.ts | 6 +- .../plugin/tests/eslint-directives.spec.ts | 8 +- packages/plugin/tests/examples.spec.ts | 23 +- .../tests/executable-definitions.spec.ts | 55 ++- .../tests/fields-on-correct-type.spec.ts | 6 +- packages/plugin/tests/input-name.spec.ts | 6 +- .../plugin/tests/known-directives.spec.ts | 28 +- .../plugin/tests/known-fragment-names.spec.ts | 7 +- .../tests/lone-executable-definition.spec.ts | 6 +- .../tests/lone-schema-definition.spec.ts | 58 ++- .../tests/match-document-filename.spec.ts | 6 +- .../plugin/tests/naming-convention.spec.ts | 6 +- .../tests/no-anonymous-operations.spec.ts | 6 +- ...insensitive-enum-values-duplicates.spec.ts | 6 +- packages/plugin/tests/no-deprecated.spec.ts | 6 +- .../plugin/tests/no-duplicate-fields.spec.ts | 6 +- .../tests/no-hashtag-description.spec.ts | 6 +- .../tests/no-one-place-fragments.spec.ts | 6 +- packages/plugin/tests/no-root-type.spec.ts | 7 +- .../no-scalar-result-type-on-mutation.spec.ts | 7 +- .../plugin/tests/no-typename-prefix.spec.ts | 6 +- .../tests/no-undefined-variables.spec.ts | 7 +- .../plugin/tests/no-unreachable-types.spec.ts | 7 +- .../plugin/tests/no-unused-fields.spec.ts | 13 +- .../plugin/tests/no-unused-fragments.spec.ts | 7 +- .../plugin/tests/no-unused-variables.spec.ts | 7 +- .../tests/possible-type-extension.spec.ts | 7 +- packages/plugin/tests/relay-arguments.spec.ts | 7 +- .../tests/relay-connection-types.spec.ts | 6 +- .../plugin/tests/relay-edge-types.spec.ts | 7 +- packages/plugin/tests/relay-page-info.spec.ts | 7 +- .../tests/require-deprecation-date.spec.ts | 6 +- .../tests/require-deprecation-reason.spec.ts | 6 +- .../plugin/tests/require-description.spec.ts | 6 +- ...d-of-type-query-in-mutation-result.spec.ts | 7 +- .../tests/require-id-when-available.spec.ts | 6 +- .../tests/require-import-fragment.spec.ts | 7 +- ...require-nullable-fields-with-oneof.spec.ts | 6 +- .../require-nullable-result-in-root.spec.ts | 7 +- .../require-type-pattern-with-oneof.spec.ts | 6 +- packages/plugin/tests/schema.spec.ts | 3 +- .../plugin/tests/selection-set-depth.spec.ts | 7 +- .../plugin/tests/strict-id-in-types.spec.ts | 7 +- packages/plugin/tests/test-utils.ts | 10 + .../plugin/tests/unique-fragment-name.spec.ts | 7 +- .../tests/unique-operation-name.spec.ts | 7 +- .../plugin/tests/unique-type-names.spec.ts | 7 +- packages/plugin/tsup.config.ts | 6 +- .../plugin/vite.config.ts | 2 +- packages/rule-tester/package.json | 30 ++ packages/rule-tester/src/index.ts | 153 +++++++ packages/rule-tester/tsconfig.json | 14 + packages/rule-tester/tsup.config.ts | 9 + patches/eslint@8.31.0.patch | 36 -- patches/eslint@8.46.0.patch | 51 +++ pnpm-lock.yaml | 418 +++++++++--------- turbo.json | 32 ++ 127 files changed, 1103 insertions(+), 1048 deletions(-) create mode 100644 .changeset/@graphql-eslint_eslint-plugin-1792-dependencies.md create mode 100644 .changeset/strong-needles-compare.md rename serializer.ts => packages/plugin/serializer.ts (100%) delete mode 100644 packages/plugin/src/testkit.ts create mode 100644 packages/plugin/tests/test-utils.ts rename vite.config.ts => packages/plugin/vite.config.ts (80%) create mode 100644 packages/rule-tester/package.json create mode 100644 packages/rule-tester/src/index.ts create mode 100644 packages/rule-tester/tsconfig.json create mode 100644 packages/rule-tester/tsup.config.ts delete mode 100644 patches/eslint@8.31.0.patch create mode 100644 patches/eslint@8.46.0.patch create mode 100644 turbo.json diff --git a/.changeset/@graphql-eslint_eslint-plugin-1792-dependencies.md b/.changeset/@graphql-eslint_eslint-plugin-1792-dependencies.md new file mode 100644 index 00000000000..ff7f426e403 --- /dev/null +++ b/.changeset/@graphql-eslint_eslint-plugin-1792-dependencies.md @@ -0,0 +1,9 @@ +--- +'@graphql-eslint/eslint-plugin': patch +--- + +dependencies updates: + +- Removed dependency + [`@babel/code-frame@^7.18.6` ↗︎](https://www.npmjs.com/package/@babel/code-frame/v/7.18.6) (from + `dependencies`) diff --git a/.changeset/strong-needles-compare.md b/.changeset/strong-needles-compare.md new file mode 100644 index 00000000000..d4250b75cda --- /dev/null +++ b/.changeset/strong-needles-compare.md @@ -0,0 +1,15 @@ +--- +'@graphql-eslint/eslint-plugin': major +--- + +Remove `GraphQLRuleTester` from bundle, to test your rules use regular `RuleTester` from eslint + +> **Note**: with this change unnecessary dependency `@babel/code-frame` was removed too + +```js +import { RuleTester } from 'eslint' + +const ruleTester = new RuleTester({ + parser: require.resolve('@graphql-eslint/eslint-plugin') +}) +``` diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index a25042531bb..a4cb02f78f1 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,8 +1,7 @@ name: pr on: pull_request: - branches: - - master + branches: [master] jobs: dependencies: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b09f0c222e..45560fe9268 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,7 @@ name: release on: push: - branches: - - master + branches: [master] jobs: stable: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 802d62cb717..0ac5cd47a23 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,9 @@ name: test on: push: - branches: [master] + branches: [master, v4] pull_request: - branches: [master] + branches: [master, v4] jobs: lint: @@ -44,12 +44,6 @@ jobs: - name: Build run: pnpm build - - name: Upload Build Artifact - uses: actions/upload-artifact@v3 - with: - name: build-artifact - path: packages/plugin/dist - test: name: Node.js v${{matrix.node_version}} / GraphQL v${{matrix.graphql_version}} / ESLint v8 timeout-minutes: 60 @@ -78,14 +72,6 @@ jobs: - name: Install Dependencies run: pnpm i --no-frozen-lockfile - # We need build for examples.spec.ts test - # Otherwise we'll get error - Cannot find module 'node_modules/@graphql-eslint/eslint-plugin/dist/index.js' - - name: Download Build Artifact - uses: actions/download-artifact@v3 - with: - name: build-artifact - path: packages/plugin/dist - - name: Test run: pnpm test env: diff --git a/.github/workflows/website-integrity.yml b/.github/workflows/website-integrity.yml index e59fa532a3e..3ab1ac2576a 100644 --- a/.github/workflows/website-integrity.yml +++ b/.github/workflows/website-integrity.yml @@ -13,7 +13,7 @@ jobs: - name: Fetch run: git fetch origin master - - name: Setup env + - name: Setup ENV uses: the-guild-org/shared-config/setup@main with: nodeVersion: 18 @@ -28,7 +28,7 @@ jobs: - name: Compare run: git diff origin/${{ github.base_ref }}.. -- website/route-lockfile.txt - - name: Diff to file + - name: Diff to File if: always() id: diff_result run: | @@ -36,7 +36,7 @@ jobs: echo "$(git diff origin/${{ github.base_ref }}.. -- website/route-lockfile.txt)" >> $GITHUB_OUTPUT echo EOF >> $GITHUB_OUTPUT - - name: Publish a message + - name: Publish a Message if: always() && contains(steps.diff_result.outputs.result, 'diff') uses: marocchino/sticky-pull-request-comment@v2 with: diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 2f140c430be..36dc26c895c 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -2,11 +2,9 @@ name: website on: push: - branches: - - master + branches: [master, v4] pull_request: - branches: - - master + branches: [master, v4] jobs: deployment: diff --git a/examples/basic/package.json b/examples/basic/package.json index 632d0ad838e..480fb75ea4b 100644 --- a/examples/basic/package.json +++ b/examples/basic/package.json @@ -14,6 +14,6 @@ "devDependencies": { "@eslint/js": "8.46.0", "@graphql-eslint/eslint-plugin": "workspace:*", - "eslint": "8.38.0" + "eslint": "8.46.0" } } diff --git a/examples/code-file/package.json b/examples/code-file/package.json index a581a755a7b..999d618548d 100644 --- a/examples/code-file/package.json +++ b/examples/code-file/package.json @@ -14,6 +14,6 @@ "devDependencies": { "@eslint/js": "8.46.0", "@graphql-eslint/eslint-plugin": "workspace:*", - "eslint": "8.38.0" + "eslint": "8.46.0" } } diff --git a/examples/graphql-config-code-file/package.json b/examples/graphql-config-code-file/package.json index cae7da13210..a115b924d16 100644 --- a/examples/graphql-config-code-file/package.json +++ b/examples/graphql-config-code-file/package.json @@ -15,6 +15,6 @@ "devDependencies": { "@eslint/js": "8.46.0", "@graphql-eslint/eslint-plugin": "workspace:*", - "eslint": "8.38.0" + "eslint": "8.46.0" } } diff --git a/examples/graphql-config/package.json b/examples/graphql-config/package.json index d7d8c1a6f7a..fb466b30a7f 100644 --- a/examples/graphql-config/package.json +++ b/examples/graphql-config/package.json @@ -14,6 +14,6 @@ "devDependencies": { "@eslint/js": "8.46.0", "@graphql-eslint/eslint-plugin": "workspace:*", - "eslint": "8.38.0" + "eslint": "8.46.0" } } diff --git a/examples/monorepo/package.json b/examples/monorepo/package.json index 32e0b53100b..418af4c61c8 100644 --- a/examples/monorepo/package.json +++ b/examples/monorepo/package.json @@ -13,6 +13,6 @@ "devDependencies": { "@eslint/js": "8.46.0", "@graphql-eslint/eslint-plugin": "workspace:*", - "eslint": "8.38.0" + "eslint": "8.46.0" } } diff --git a/examples/multiple-projects-graphql-config/package.json b/examples/multiple-projects-graphql-config/package.json index 950d8883eb4..6671f9680e4 100644 --- a/examples/multiple-projects-graphql-config/package.json +++ b/examples/multiple-projects-graphql-config/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@graphql-eslint/eslint-plugin": "workspace:*", "cosmiconfig-typescript-loader": "5.0.0", - "eslint": "8.38.0", + "eslint": "8.46.0", "ts-node": "10.9.1", "typescript": "5.1.6" } diff --git a/examples/prettier/package.json b/examples/prettier/package.json index 01b596abdf1..ec1ab1d9655 100644 --- a/examples/prettier/package.json +++ b/examples/prettier/package.json @@ -14,7 +14,7 @@ "devDependencies": { "@eslint/js": "8.46.0", "@graphql-eslint/eslint-plugin": "workspace:*", - "eslint": "8.38.0", + "eslint": "8.46.0", "eslint-config-prettier": "8.9.0", "eslint-plugin-prettier": "4.2.1", "prettier": "2.8.8" diff --git a/examples/svelte-code-file/package.json b/examples/svelte-code-file/package.json index 4d2daee974f..7c30030771c 100644 --- a/examples/svelte-code-file/package.json +++ b/examples/svelte-code-file/package.json @@ -12,7 +12,7 @@ }, "devDependencies": { "@graphql-eslint/eslint-plugin": "workspace:*", - "eslint": "8.38.0", + "eslint": "8.46.0", "svelte": "4.1.2", "svelte-eslint-parser": "0.32.2", "svelte2tsx": "0.6.19" diff --git a/examples/vue-code-file/package.json b/examples/vue-code-file/package.json index a9ea36cd891..8f4986d5837 100644 --- a/examples/vue-code-file/package.json +++ b/examples/vue-code-file/package.json @@ -13,7 +13,7 @@ "devDependencies": { "@graphql-eslint/eslint-plugin": "workspace:*", "@vue/compiler-sfc": "3.3.4", - "eslint": "8.38.0", + "eslint": "8.46.0", "vue-eslint-parser": "9.3.1" } } diff --git a/package.json b/package.json index 94c3134c27e..b7a74548701 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "pnpm": ">=8" }, "scripts": { - "build": "pnpm --filter @graphql-eslint/eslint-plugin build && bob check", + "build": "turbo run build --filter=!website && bob check", "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", @@ -21,7 +21,7 @@ "prerelease": "NODE_ENV=production pnpm build", "prettier": "pnpm lint:prettier --write", "release": "changeset publish", - "test": "vitest ." + "test": "turbo run test --filter=!website" }, "devDependencies": { "@changesets/changelog-github": "0.4.8", @@ -35,7 +35,7 @@ "chalk": "4.1.2", "dedent": "1.5.1", "enquirer": "2.4.1", - "eslint": "8.44.0", + "eslint": "8.46.0", "eslint-plugin-eslint-plugin": "5.0.7", "eslint-plugin-tailwindcss": "3.13.0", "husky": "8.0.3", @@ -46,6 +46,7 @@ "rimraf": "5.0.1", "tsup": "^7.1.0", "tsx": "3.12.7", + "turbo": "^1.10.12", "typescript": "5.1.6", "vitest": "0.30.1" }, @@ -54,7 +55,7 @@ }, "pnpm": { "patchedDependencies": { - "eslint@8.44.0": "patches/eslint@8.31.0.patch", + "eslint@8.46.0": "patches/eslint@8.46.0.patch", "eslint-plugin-eslint-plugin@5.0.7": "patches/eslint-plugin-eslint-plugin@5.0.6.patch", "json-schema-to-markdown@1.1.1": "patches/json-schema-to-markdown@1.1.1.patch", "@vitest/runner@0.30.1": "patches/@vitest__runner@0.28.4.patch" diff --git a/packages/plugin/package.json b/packages/plugin/package.json index e84ce07e29c..5a8f7627ffe 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -35,13 +35,13 @@ "graphql" ], "scripts": { - "build": "tsup" + "build": "tsup", + "test": "vitest" }, "peerDependencies": { "graphql": "^0.8.0 || ^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": { - "@babel/code-frame": "^7.18.6", "@graphql-tools/code-file-loader": "^7.3.6", "@graphql-tools/graphql-tag-pluck": "^7.3.6", "@graphql-tools/utils": "^9.0.0", @@ -54,7 +54,7 @@ "tslib": "^2.4.1" }, "devDependencies": { - "@types/babel__code-frame": "7.0.3", + "@theguild/eslint-rule-tester": "workspace:*", "@types/debug": "4.1.8", "@types/eslint": "8.37.0", "@types/estree": "1.0.1", diff --git a/serializer.ts b/packages/plugin/serializer.ts similarity index 100% rename from serializer.ts rename to packages/plugin/serializer.ts diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index 9c0fac88974..48f0fcea3b1 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -2,7 +2,6 @@ import { processor } from './processor.js'; export { parseForESLint } from './parser.js'; export { rules } from './rules/index.js'; -export * from './testkit.js'; export * from './types.js'; export { requireGraphQLSchemaFromContext, requireSiblingsOperations } from './utils.js'; diff --git a/packages/plugin/src/rules/alphabetize.ts b/packages/plugin/src/rules/alphabetize.ts index f8bfbe03e87..0b66071b221 100644 --- a/packages/plugin/src/rules/alphabetize.ts +++ b/packages/plugin/src/rules/alphabetize.ts @@ -21,8 +21,7 @@ import { import { FromSchema } from 'json-schema-to-ts'; import lowerCase from 'lodash.lowercase'; import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRuleListener } from '../testkit.js'; -import { GraphQLESLintRule } from '../types.js'; +import { GraphQLESLintRule, GraphQLESLintRuleListener } from '../types.js'; import { ARRAY_DEFAULT_OPTIONS, displayNodeName, truthy } from '../utils.js'; const RULE_ID = 'alphabetize'; diff --git a/packages/plugin/src/rules/input-name.ts b/packages/plugin/src/rules/input-name.ts index 4942215c34c..40e38d2bc5f 100644 --- a/packages/plugin/src/rules/input-name.ts +++ b/packages/plugin/src/rules/input-name.ts @@ -10,8 +10,7 @@ import { } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRuleListener } from '../testkit.js'; -import { GraphQLESLintRule } from '../types.js'; +import { GraphQLESLintRule, GraphQLESLintRuleListener } from '../types.js'; const schema = { type: 'array', diff --git a/packages/plugin/src/rules/naming-convention.ts b/packages/plugin/src/rules/naming-convention.ts index 61cef6fadab..490d2f4e4f9 100644 --- a/packages/plugin/src/rules/naming-convention.ts +++ b/packages/plugin/src/rules/naming-convention.ts @@ -1,8 +1,7 @@ import { ASTKindToNode, Kind, NameNode } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRuleListener } from '../testkit.js'; -import { GraphQLESLintRule, ValueOf } from '../types.js'; +import { GraphQLESLintRule, ValueOf, GraphQLESLintRuleListener } from '../types.js'; import { ARRAY_DEFAULT_OPTIONS, convertCase, diff --git a/packages/plugin/src/rules/relay-edge-types.ts b/packages/plugin/src/rules/relay-edge-types.ts index e88f8896c18..3ae78a71077 100644 --- a/packages/plugin/src/rules/relay-edge-types.ts +++ b/packages/plugin/src/rules/relay-edge-types.ts @@ -12,8 +12,7 @@ import { } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRuleListener } from '../testkit.js'; -import { GraphQLESLintRule } from '../types.js'; +import { GraphQLESLintRule, GraphQLESLintRuleListener } from '../types.js'; import { getTypeName, requireGraphQLSchemaFromContext } from '../utils.js'; const RULE_ID = 'relay-edge-types'; diff --git a/packages/plugin/src/testkit.ts b/packages/plugin/src/testkit.ts deleted file mode 100644 index e20460dc8a1..00000000000 --- a/packages/plugin/src/testkit.ts +++ /dev/null @@ -1,239 +0,0 @@ -import { readFileSync } from 'fs'; -import { resolve } from 'path'; -import { codeFrameColumns } from '@babel/code-frame'; -import { AST, Linter, Rule, RuleTester } from 'eslint'; -import { ASTKindToNode } from 'graphql'; -import { GraphQLESTreeNode } from './estree-converter/index.js'; -import { GraphQLESLintRule, ParserOptions } from './types.js'; - -export type GraphQLESLintRuleListener = Record< - string, - any -> & { - [K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode) => void; -}; - -export type GraphQLValidTestCase = Omit< - RuleTester.ValidTestCase, - 'options' | 'parserOptions' -> & { - options?: Options; - parserOptions?: Omit; -}; - -export type GraphQLInvalidTestCase = GraphQLValidTestCase & { - errors: (RuleTester.TestCaseError | string)[] | number; - output?: string | null; -}; - -function indentCode(code: string, indent = 4): string { - return code.replace(/^/gm, ' '.repeat(indent)); -} - -// A simple version of `SourceCodeFixer.applyFixes` -// https://github.com/eslint/eslint/issues/14936#issuecomment-906746754 -function applyFix(code: string, { range, text }: Rule.Fix): string { - return [code.slice(0, range[0]), text, code.slice(range[1])].join(''); -} - -type RuleTesterConfig = { - parser: string; - parserOptions: Omit; -}; - -export class GraphQLRuleTester extends RuleTester { - config: RuleTesterConfig; - - constructor(parserOptions: Omit = {}) { - const config = { - parser: require.resolve('@graphql-eslint/eslint-plugin'), - parserOptions: { - ...parserOptions, - skipGraphQLConfig: true, - }, - }; - super(config); - this.config = config; - } - - fromMockFile(path: string): string { - return readFileSync(resolve(__dirname, `../tests/mocks/${path}`), 'utf-8'); - } - - runGraphQLTests( - ruleId: string, - rule: GraphQLESLintRule, - tests: { - valid: (GraphQLValidTestCase | string)[]; - invalid: GraphQLInvalidTestCase[]; - }, - ): void { - super.run(ruleId, rule as any, tests); - const linter = new Linter(); - linter.defineRule(ruleId, rule as any); - - const hasOnlyTest = [...tests.valid, ...tests.invalid].some( - t => typeof t !== 'string' && t.only, - ); - - // for (const [index, testCase] of tests.valid.entries()) { - // const { name, code, filename, only }: RuleTester.ValidTestCase = - // typeof testCase === 'string' ? { code: testCase } : testCase; - // - // if (hasOnlyTest && !only) { - // continue; - // } - // - // const verifyConfig = getVerifyConfig(ruleId, this.config, testCase); - // defineParser(linter, verifyConfig.parser); - // - // const messages = linter.verify(code, verifyConfig, { filename }); - // const codeFrame = printCode(code, { line: 0, column: 0 }); - // - // it(name || `Valid #${index + 1}\n${codeFrame}`, () => { - // expect(messages).toEqual([]); - // }); - // } - - for (const [idx, testCase] of tests.invalid.entries()) { - const { only, filename, options, name } = testCase; - if (hasOnlyTest && !only) { - continue; - } - - const code = removeTrailingBlankLines(testCase.code); - const verifyConfig = getVerifyConfig(ruleId, this.config, testCase); - defineParser(linter, verifyConfig.parser); - - const messages = linter.verify(code, verifyConfig, filename); - if (messages.length === 0) { - throw new Error('Invalid case should have at least one error.'); - } - const codeFrame = indentCode(printCode(code, { line: 0, column: 0 })); - const messageForSnapshot = ['#### ⌨️ Code', codeFrame]; - - if (options) { - const opts = JSON.stringify(options, null, 2).slice(1, -1); - messageForSnapshot.push('#### ⚙️ Options', indentCode(removeTrailingBlankLines(opts), 2)); - } - - for (const [index, message] of messages.entries()) { - if (message.fatal) { - throw new Error(message.message); - } - - const codeWithMessage = printCode(code, message, 1); - messageForSnapshot.push( - printWithIndex('#### ❌ Error', index, messages.length), - indentCode(codeWithMessage), - ); - - // Don't print suggestions in snapshots for too big codes - if (message.suggestions && (code.match(/\n/g) || '').length < 1000) { - for (const [i, suggestion] of message.suggestions.entries()) { - const title = printWithIndex( - '#### 💡 Suggestion', - i, - message.suggestions.length, - suggestion.desc, - ); - const output = applyFix(code, suggestion.fix); - const codeFrame = printCode(output, { line: 0, column: 0 }); - messageForSnapshot.push(title, indentCode(codeFrame, 2)); - } - } - } - - if (rule.meta.fixable) { - const { fixed, output } = linter.verifyAndFix(code, verifyConfig, filename); - if (fixed) { - messageForSnapshot.push('#### 🔧 Autofix output', indentCode(printCode(output))); - } - } - it(name || `Invalid #${idx + 1}`, () => { - expect(messageForSnapshot.join('\n\n')).toMatchSnapshot(); - }); - } - } -} - -function removeTrailingBlankLines(text: string): string { - return text.replace(/^\s*\n/, '').trimEnd(); -} - -function printWithIndex(title: string, index: number, total: number, description?: string): string { - if (total > 1) { - title += ` ${index + 1}/${total}`; - } - if (description) { - title += `: ${description}`; - } - return title; -} - -function getVerifyConfig( - ruleId: string, - testerConfig: RuleTesterConfig, - testCase: GraphQLInvalidTestCase, -): Omit & { parser: string } { - const { parser = testerConfig.parser, parserOptions, options } = testCase; - - return { - ...testerConfig, - parser, - parserOptions: { - ...testerConfig.parserOptions, - ...parserOptions, - }, - rules: { - [ruleId]: Array.isArray(options) ? ['error', ...options] : 'error', - }, - }; -} - -const parsers = new WeakMap(); - -function defineParser(linter: Linter, parser: string): void { - if (!parser) { - return; - } - if (!parsers.has(linter)) { - parsers.set(linter, new Set()); - } - - const defined = parsers.get(linter); - if (!defined.has(parser)) { - defined.add(parser); - // eslint-disable-next-line @typescript-eslint/no-var-requires - linter.defineParser(parser, require(parser)); - } -} - -function printCode( - code: string, - result: Partial = {}, - linesOffset = Number.POSITIVE_INFINITY, -): string { - const { line, column, endLine, endColumn, message } = result; - const location = {} as AST.SourceLocation; - - if (typeof line === 'number' && typeof column === 'number') { - location.start = { - line, - column, - }; - } - - if (typeof endLine === 'number' && typeof endColumn === 'number') { - location.end = { - line: endLine, - column: endColumn, - }; - } - - return codeFrameColumns(code, location, { - linesAbove: linesOffset, - linesBelow: linesOffset, - message, - }); -} diff --git a/packages/plugin/src/types.ts b/packages/plugin/src/types.ts index 2c4ea82f75e..15cdc5d33eb 100644 --- a/packages/plugin/src/types.ts +++ b/packages/plugin/src/types.ts @@ -1,11 +1,11 @@ import { GraphQLParseOptions } from '@graphql-tools/utils'; import { AST, Linter, Rule } from 'eslint'; import * as ESTree from 'estree'; -import { GraphQLSchema } from 'graphql'; +import { GraphQLSchema, ASTKindToNode } from 'graphql'; import { IExtensions, IGraphQLProject } from 'graphql-config'; import { JSONSchema } from 'json-schema-to-ts'; import { SiblingOperations } from './siblings.js'; -import { GraphQLESLintRuleListener } from './testkit.js'; +import { GraphQLESTreeNode } from './estree-converter/index.js'; export type Schema = GraphQLSchema | null; export type Pointer = string | string[]; @@ -75,6 +75,13 @@ export type RuleDocsInfo = Omit isDisabledForAllConfig?: true; }; +export type GraphQLESLintRuleListener = Record< + string, + any +> & { + [K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode) => void; +}; + export type GraphQLESLintRule = { meta: Omit & { docs?: RuleDocsInfo; diff --git a/packages/plugin/tests/__snapshots__/alphabetize.spec.md b/packages/plugin/tests/__snapshots__/alphabetize.spec.md index 3c5e5813eab..a8fb875f688 100644 --- a/packages/plugin/tests/__snapshots__/alphabetize.spec.md +++ b/packages/plugin/tests/__snapshots__/alphabetize.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`alphabetize > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type User { @@ -15,7 +15,8 @@ exports[`Invalid #1 1`] = ` { "fields": [ "ObjectTypeDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/2 @@ -42,7 +43,7 @@ exports[`Invalid #1 1`] = ` 6 | } `; -exports[`Invalid #2 1`] = ` +exports[`alphabetize > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | extend type User { @@ -57,7 +58,8 @@ exports[`Invalid #2 1`] = ` { "fields": [ "ObjectTypeDefinition" - ] + ], + "definitions": false } #### ❌ Error @@ -77,7 +79,7 @@ exports[`Invalid #2 1`] = ` 6 | } `; -exports[`Invalid #3 1`] = ` +exports[`alphabetize > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | interface Test { @@ -91,7 +93,8 @@ exports[`Invalid #3 1`] = ` { "fields": [ "InterfaceTypeDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/2 @@ -117,7 +120,7 @@ exports[`Invalid #3 1`] = ` 5 | } `; -exports[`Invalid #4 1`] = ` +exports[`alphabetize > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | input UserInput { @@ -132,7 +135,8 @@ exports[`Invalid #4 1`] = ` { "fields": [ "InputObjectTypeDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/2 @@ -159,7 +163,7 @@ exports[`Invalid #4 1`] = ` 6 | } `; -exports[`Invalid #5 1`] = ` +exports[`alphabetize > invalid > Invalid #5 1`] = ` #### ⌨️ Code 1 | extend input UserInput { @@ -174,7 +178,8 @@ exports[`Invalid #5 1`] = ` { "fields": [ "InputObjectTypeDefinition" - ] + ], + "definitions": false } #### ❌ Error @@ -194,7 +199,7 @@ exports[`Invalid #5 1`] = ` 6 | } `; -exports[`Invalid #6 1`] = ` +exports[`alphabetize > invalid > Invalid #6 1`] = ` #### ⌨️ Code 1 | enum Role { @@ -209,7 +214,8 @@ exports[`Invalid #6 1`] = ` { "values": [ "EnumTypeDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/2 @@ -236,7 +242,7 @@ exports[`Invalid #6 1`] = ` 6 | } `; -exports[`Invalid #7 1`] = ` +exports[`alphabetize > invalid > Invalid #7 1`] = ` #### ⌨️ Code 1 | extend enum Role { @@ -251,7 +257,8 @@ exports[`Invalid #7 1`] = ` { "values": [ "EnumTypeDefinition" - ] + ], + "definitions": false } #### ❌ Error @@ -271,7 +278,7 @@ exports[`Invalid #7 1`] = ` 6 | } `; -exports[`Invalid #8 1`] = ` +exports[`alphabetize > invalid > Invalid #8 1`] = ` #### ⌨️ Code 1 | directive @test(cc: [Cc!]!, bb: [Bb!], aa: Aa!) on FIELD_DEFINITION @@ -281,7 +288,8 @@ exports[`Invalid #8 1`] = ` { "arguments": [ "DirectiveDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/2 @@ -299,7 +307,7 @@ exports[`Invalid #8 1`] = ` 1 | directive @test(aa: Aa!, bb: [Bb!], cc: [Cc!]!) on FIELD_DEFINITION `; -exports[`Invalid #9 1`] = ` +exports[`alphabetize > invalid > Invalid #9 1`] = ` #### ⌨️ Code 1 | type Query { @@ -311,7 +319,8 @@ exports[`Invalid #9 1`] = ` { "arguments": [ "FieldDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/2 @@ -335,7 +344,7 @@ exports[`Invalid #9 1`] = ` 3 | } `; -exports[`Invalid #10 1`] = ` +exports[`alphabetize > invalid > Invalid #10 1`] = ` #### ⌨️ Code 1 | fragment TestFields on Test { @@ -349,7 +358,8 @@ exports[`Invalid #10 1`] = ` { "selections": [ "FragmentDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/2 @@ -375,7 +385,7 @@ exports[`Invalid #10 1`] = ` 5 | } `; -exports[`Invalid #11 1`] = ` +exports[`alphabetize > invalid > Invalid #11 1`] = ` #### ⌨️ Code 1 | query { @@ -396,7 +406,8 @@ exports[`Invalid #11 1`] = ` { "selections": [ "OperationDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/4 @@ -443,7 +454,7 @@ exports[`Invalid #11 1`] = ` 12 | } `; -exports[`Invalid #12 1`] = ` +exports[`alphabetize > invalid > Invalid #12 1`] = ` #### ⌨️ Code 1 | mutation ($cc: [Cc!]!, $bb: [Bb!], $aa: Aa!) { @@ -460,7 +471,8 @@ exports[`Invalid #12 1`] = ` ], "arguments": [ "Field" - ] + ], + "definitions": false } #### ❌ Error 1/4 @@ -498,7 +510,7 @@ exports[`Invalid #12 1`] = ` 5 | } `; -exports[`should compare with lexicographic order 1`] = ` +exports[`alphabetize > invalid > should compare with lexicographic order 1`] = ` #### ⌨️ Code 1 | enum Test { @@ -518,7 +530,8 @@ exports[`should compare with lexicographic order 1`] = ` { "values": [ "EnumTypeDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/3 @@ -557,7 +570,7 @@ exports[`should compare with lexicographic order 1`] = ` 11 | } `; -exports[`should move comment 1`] = ` +exports[`alphabetize > invalid > should move comment 1`] = ` #### ⌨️ Code 1 | type Test { # { character @@ -580,7 +593,8 @@ exports[`should move comment 1`] = ` { "fields": [ "ObjectTypeDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/3 @@ -622,7 +636,7 @@ exports[`should move comment 1`] = ` 14 | } # } character `; -exports[`should sort by group when \`*\` at the start 1`] = ` +exports[`alphabetize > invalid > should sort by group when \`*\` at the start 1`] = ` #### ⌨️ Code 1 | type User { @@ -649,7 +663,8 @@ exports[`should sort by group when \`*\` at the start 1`] = ` "updatedAt", "id", "createdAt" - ] + ], + "definitions": false } #### ❌ Error 1/4 @@ -696,7 +711,7 @@ exports[`should sort by group when \`*\` at the start 1`] = ` 12 | } `; -exports[`should sort by group when \`*\` is at the end 1`] = ` +exports[`alphabetize > invalid > should sort by group when \`*\` is at the end 1`] = ` #### ⌨️ Code 1 | type User { @@ -723,7 +738,8 @@ exports[`should sort by group when \`*\` is at the end 1`] = ` "id", "createdAt", "*" - ] + ], + "definitions": false } #### ❌ Error 1/4 @@ -770,7 +786,7 @@ exports[`should sort by group when \`*\` is at the end 1`] = ` 12 | } `; -exports[`should sort by group when \`*\` is between 1`] = ` +exports[`alphabetize > invalid > should sort by group when \`*\` is between 1`] = ` #### ⌨️ Code 1 | type User { @@ -797,7 +813,8 @@ exports[`should sort by group when \`*\` is between 1`] = ` "*", "createdAt", "updatedAt" - ] + ], + "definitions": false } #### ❌ Error 1/4 @@ -844,7 +861,7 @@ exports[`should sort by group when \`*\` is between 1`] = ` 12 | } `; -exports[`should sort definitions 1`] = ` +exports[`alphabetize > invalid > should sort definitions 1`] = ` #### ⌨️ Code 1 | # START @@ -1039,7 +1056,7 @@ exports[`should sort definitions 1`] = ` 59 | # END `; -exports[`should sort when selection is aliased 1`] = ` +exports[`alphabetize > invalid > should sort when selection is aliased 1`] = ` #### ⌨️ Code 1 | { @@ -1055,7 +1072,8 @@ exports[`should sort when selection is aliased 1`] = ` { "selections": [ "OperationDefinition" - ] + ], + "definitions": false } #### ❌ Error 1/2 diff --git a/packages/plugin/tests/__snapshots__/description-style.spec.md b/packages/plugin/tests/__snapshots__/description-style.spec.md index d46cf142c4b..6e6a88237a3 100644 --- a/packages/plugin/tests/__snapshots__/description-style.spec.md +++ b/packages/plugin/tests/__snapshots__/description-style.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`description-style > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | enum EnumUserLanguagesSkill { @@ -91,7 +91,7 @@ exports[`Invalid #1 1`] = ` 12 | } `; -exports[`Invalid #2 1`] = ` +exports[`description-style > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | " Test " diff --git a/packages/plugin/tests/__snapshots__/eslint-directives.spec.md b/packages/plugin/tests/__snapshots__/eslint-directives.spec.md index 88a2604eb82..24f6c139b9f 100644 --- a/packages/plugin/tests/__snapshots__/eslint-directives.spec.md +++ b/packages/plugin/tests/__snapshots__/eslint-directives.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`test-directives > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | # eslint-disable-next-line non-existing-rule diff --git a/packages/plugin/tests/__snapshots__/executable-definitions.spec.md b/packages/plugin/tests/__snapshots__/executable-definitions.spec.md index 12111cd18b1..8802e38bfc0 100644 --- a/packages/plugin/tests/__snapshots__/executable-definitions.spec.md +++ b/packages/plugin/tests/__snapshots__/executable-definitions.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`executable-definitions > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type Query { t: String } diff --git a/packages/plugin/tests/__snapshots__/fields-on-correct-type.spec.md b/packages/plugin/tests/__snapshots__/fields-on-correct-type.spec.md index f69d285c9e1..3fc5c0970eb 100644 --- a/packages/plugin/tests/__snapshots__/fields-on-correct-type.spec.md +++ b/packages/plugin/tests/__snapshots__/fields-on-correct-type.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`should highlight selection on multi line 1`] = ` +exports[`fields-on-correct-type > invalid > should highlight selection on multi line 1`] = ` #### ⌨️ Code 1 | { @@ -19,7 +19,7 @@ exports[`should highlight selection on multi line 1`] = ` 5 | age `; -exports[`should highlight selection on single line 1`] = ` +exports[`fields-on-correct-type > invalid > should highlight selection on single line 1`] = ` #### ⌨️ Code 1 | fragment UserFields on User { id bad age } diff --git a/packages/plugin/tests/__snapshots__/input-name.spec.md b/packages/plugin/tests/__snapshots__/input-name.spec.md index 35290a274a7..308a741fb41 100644 --- a/packages/plugin/tests/__snapshots__/input-name.spec.md +++ b/packages/plugin/tests/__snapshots__/input-name.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`input-name > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type Mutation { SetMessage(message: String): String } @@ -8,7 +8,10 @@ exports[`Invalid #1 1`] = ` #### ⚙️ Options { - "checkInputType": true + "checkInputType": true, + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error 1/2 @@ -30,7 +33,7 @@ exports[`Invalid #1 1`] = ` 1 | type Mutation { SetMessage(message: SetMessageInput): String } `; -exports[`Invalid #2 1`] = ` +exports[`input-name > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | type Mutation { SetMessage(input: String): String } @@ -38,7 +41,10 @@ exports[`Invalid #2 1`] = ` #### ⚙️ Options { - "checkInputType": true + "checkInputType": true, + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error @@ -51,7 +57,7 @@ exports[`Invalid #2 1`] = ` 1 | type Mutation { SetMessage(input: SetMessageInput): String } `; -exports[`Invalid #3 1`] = ` +exports[`input-name > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | type Mutation { SetMessage(hello: SetMessageInput): String } @@ -59,7 +65,10 @@ exports[`Invalid #3 1`] = ` #### ⚙️ Options { - "checkInputType": true + "checkInputType": true, + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error @@ -72,7 +81,7 @@ exports[`Invalid #3 1`] = ` 1 | type Mutation { SetMessage(input: SetMessageInput): String } `; -exports[`Invalid #4 1`] = ` +exports[`input-name > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | type Mutation { userCreate(record: CreateOneUserInput!): CreateOneUserPayload } @@ -80,7 +89,10 @@ exports[`Invalid #4 1`] = ` #### ⚙️ Options { - "checkInputType": true + "checkInputType": true, + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error 1/2 @@ -102,7 +114,7 @@ exports[`Invalid #4 1`] = ` 1 | type Mutation { userCreate(record: userCreateInput!): CreateOneUserPayload } `; -exports[`Invalid #5 1`] = ` +exports[`input-name > invalid > Invalid #5 1`] = ` #### ⌨️ Code 1 | type Mutation { userCreate(record: [CreateOneUserInput]!): CreateOneUserPayload } @@ -110,7 +122,10 @@ exports[`Invalid #5 1`] = ` #### ⚙️ Options { - "checkInputType": true + "checkInputType": true, + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error 1/2 @@ -132,7 +147,7 @@ exports[`Invalid #5 1`] = ` 1 | type Mutation { userCreate(record: [userCreateInput]!): CreateOneUserPayload } `; -exports[`Invalid #6 1`] = ` +exports[`input-name > invalid > Invalid #6 1`] = ` #### ⌨️ Code 1 | type Mutation { userCreate(record: [CreateOneUserInput!]!): CreateOneUserPayload } @@ -140,7 +155,10 @@ exports[`Invalid #6 1`] = ` #### ⚙️ Options { - "checkInputType": true + "checkInputType": true, + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error 1/2 @@ -162,7 +180,7 @@ exports[`Invalid #6 1`] = ` 1 | type Mutation { userCreate(record: [userCreateInput!]!): CreateOneUserPayload } `; -exports[`Invalid #7 1`] = ` +exports[`input-name > invalid > Invalid #7 1`] = ` #### ⌨️ Code 1 | type Mutation { userCreate(record: [CreateOneUserInput!]): CreateOneUserPayload } @@ -170,7 +188,10 @@ exports[`Invalid #7 1`] = ` #### ⚙️ Options { - "checkInputType": true + "checkInputType": true, + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error 1/2 @@ -192,7 +213,7 @@ exports[`Invalid #7 1`] = ` 1 | type Mutation { userCreate(record: [userCreateInput!]): CreateOneUserPayload } `; -exports[`Invalid #8 1`] = ` +exports[`input-name > invalid > Invalid #8 1`] = ` #### ⌨️ Code 1 | type Mutation { userCreate(record: String, test: String): String } @@ -200,7 +221,10 @@ exports[`Invalid #8 1`] = ` #### ⚙️ Options { - "checkInputType": true + "checkInputType": true, + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error 1/4 @@ -240,7 +264,7 @@ exports[`Invalid #8 1`] = ` 1 | type Mutation { userCreate(record: String, test: userCreateInput): String } `; -exports[`Invalid #9 1`] = ` +exports[`input-name > invalid > Invalid #9 1`] = ` #### ⌨️ Code 1 | type Mutation { userCreate(record: String, test: String): String } @@ -248,7 +272,10 @@ exports[`Invalid #9 1`] = ` #### ⚙️ Options { - "checkInputType": false + "checkInputType": false, + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error 1/2 @@ -270,7 +297,7 @@ exports[`Invalid #9 1`] = ` 1 | type Mutation { userCreate(record: String, input: String): String } `; -exports[`Invalid #10 1`] = ` +exports[`input-name > invalid > Invalid #10 1`] = ` #### ⌨️ Code 1 | type Mutation { userCreate(input: String): String } @@ -279,7 +306,9 @@ exports[`Invalid #10 1`] = ` { "checkInputType": true, - "caseSensitiveInputType": false + "caseSensitiveInputType": false, + "checkQueries": false, + "checkMutations": true } #### ❌ Error @@ -292,7 +321,7 @@ exports[`Invalid #10 1`] = ` 1 | type Mutation { userCreate(input: userCreateInput): String } `; -exports[`Invalid #11 1`] = ` +exports[`input-name > invalid > Invalid #11 1`] = ` #### ⌨️ Code 1 | type Mutation { userCreate(input: UserCreateInput): String } @@ -301,7 +330,9 @@ exports[`Invalid #11 1`] = ` { "checkInputType": true, - "caseSensitiveInputType": true + "caseSensitiveInputType": true, + "checkQueries": false, + "checkMutations": true } #### ❌ Error @@ -314,7 +345,7 @@ exports[`Invalid #11 1`] = ` 1 | type Mutation { userCreate(input: userCreateInput): String } `; -exports[`Invalid #12 1`] = ` +exports[`input-name > invalid > Invalid #12 1`] = ` #### ⌨️ Code 1 | type Query { getUser(input: GetUserInput): String } @@ -324,7 +355,8 @@ exports[`Invalid #12 1`] = ` { "checkQueries": true, "checkInputType": true, - "caseSensitiveInputType": true + "caseSensitiveInputType": true, + "checkMutations": true } #### ❌ Error diff --git a/packages/plugin/tests/__snapshots__/known-directives.spec.md b/packages/plugin/tests/__snapshots__/known-directives.spec.md index 897dc0e13ef..7e37884d714 100644 --- a/packages/plugin/tests/__snapshots__/known-directives.spec.md +++ b/packages/plugin/tests/__snapshots__/known-directives.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`should work only with Kind.FIELD 1`] = ` +exports[`known-directives > invalid > should work only with Kind.FIELD 1`] = ` #### ⌨️ Code 1 | scalar Foo @bad diff --git a/packages/plugin/tests/__snapshots__/known-fragment-names.spec.md b/packages/plugin/tests/__snapshots__/known-fragment-names.spec.md index e0898008a60..b648293dd84 100644 --- a/packages/plugin/tests/__snapshots__/known-fragment-names.spec.md +++ b/packages/plugin/tests/__snapshots__/known-fragment-names.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`should not throw an error on undefined fragment 1`] = ` +exports[`known-fragment-names > invalid > should not throw an error on undefined fragment 1`] = ` #### ⌨️ Code 1 | { diff --git a/packages/plugin/tests/__snapshots__/lone-executable-definition.spec.md b/packages/plugin/tests/__snapshots__/lone-executable-definition.spec.md index 1de57f9fcee..2c8d71a6f95 100644 --- a/packages/plugin/tests/__snapshots__/lone-executable-definition.spec.md +++ b/packages/plugin/tests/__snapshots__/lone-executable-definition.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`should allow fragments if they are ignored 1`] = ` +exports[`lone-executable-definition > invalid > should allow fragments if they are ignored 1`] = ` #### ⌨️ Code 1 | query Foo { @@ -31,7 +31,7 @@ exports[`should allow fragments if they are ignored 1`] = ` 8 | createFoo { `; -exports[`should report additional definitions 1`] = ` +exports[`lone-executable-definition > invalid > should report additional definitions 1`] = ` #### ⌨️ Code 1 | query Valid { @@ -103,7 +103,7 @@ exports[`should report additional definitions 1`] = ` 24 | id `; -exports[`should report definitions after short-hand query 1`] = ` +exports[`lone-executable-definition > invalid > should report definitions after short-hand query 1`] = ` #### ⌨️ Code 1 | { diff --git a/packages/plugin/tests/__snapshots__/lone-schema-definition.spec.md b/packages/plugin/tests/__snapshots__/lone-schema-definition.spec.md index 699f53b7a09..261ac984ca7 100644 --- a/packages/plugin/tests/__snapshots__/lone-schema-definition.spec.md +++ b/packages/plugin/tests/__snapshots__/lone-schema-definition.spec.md @@ -1,28 +1,28 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`lone-schema-definition > invalid > Invalid #1 1`] = ` #### ⌨️ Code - 1 | type Query { - 2 | foo: String - 3 | } + 1 | type Query { + 2 | foo: String + 3 | } 4 | - 5 | schema { - 6 | query: Query - 7 | } + 5 | schema { + 6 | query: Query + 7 | } 8 | - 9 | type RootQuery { - 10 | foo: String - 11 | } + 9 | type RootQuery { + 10 | foo: String + 11 | } 12 | - 13 | schema { - 14 | query: RootQuery - 15 | } + 13 | schema { + 14 | query: RootQuery + 15 | } #### ❌ Error 12 | - > 13 | schema { - | ^^^^^^ Must provide only one schema definition. - 14 | query: RootQuery + > 13 | schema { + | ^^^^^^ Must provide only one schema definition. + 14 | query: RootQuery `; diff --git a/packages/plugin/tests/__snapshots__/match-document-filename.spec.md b/packages/plugin/tests/__snapshots__/match-document-filename.spec.md index e612dea0142..0c554ce1e46 100644 --- a/packages/plugin/tests/__snapshots__/match-document-filename.spec.md +++ b/packages/plugin/tests/__snapshots__/match-document-filename.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`match-document-filename > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | { me } @@ -17,7 +17,7 @@ exports[`Invalid #1 1`] = ` | ^ File extension ".graphql" don't match extension ".gql" `; -exports[`Invalid #2 1`] = ` +exports[`match-document-filename > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | query UserById { user { id } } @@ -36,7 +36,7 @@ exports[`Invalid #2 1`] = ` | ^ Unexpected filename "user-by-id.gql". Rename it to "UserById.gql" `; -exports[`Invalid #3 1`] = ` +exports[`match-document-filename > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | query UserById { user { id } } @@ -56,7 +56,7 @@ exports[`Invalid #3 1`] = ` | ^ Unexpected filename "userById.gql". Rename it to "UserById.query.gql" `; -exports[`Invalid #4 1`] = ` +exports[`match-document-filename > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | fragment UserFields on User { id } @@ -75,7 +75,7 @@ exports[`Invalid #4 1`] = ` | ^ Unexpected filename "user-fields.gql". Rename it to "UserFields.gql" `; -exports[`Invalid #7 1`] = ` +exports[`match-document-filename > invalid > Invalid #7 1`] = ` #### ⌨️ Code 1 | mutation addAlertChannel { @@ -97,7 +97,7 @@ exports[`Invalid #7 1`] = ` 2 | foo `; -exports[`compare only first operation name 1`] = ` +exports[`match-document-filename > invalid > compare only first operation name 1`] = ` #### ⌨️ Code 1 | query getUsers { users } mutation createPost { createPost } @@ -121,7 +121,7 @@ exports[`compare only first operation name 1`] = ` | ^ Unexpected filename "getUsersQuery.gql". Rename it to "GetUsers.query.gql" `; -exports[`compare only first operation name if fragment is present 1`] = ` +exports[`match-document-filename > invalid > compare only first operation name if fragment is present 1`] = ` #### ⌨️ Code 1 | fragment UserFields on User { diff --git a/packages/plugin/tests/__snapshots__/naming-convention.spec.md b/packages/plugin/tests/__snapshots__/naming-convention.spec.md index 43a27f75d6f..f18828aaba5 100644 --- a/packages/plugin/tests/__snapshots__/naming-convention.spec.md +++ b/packages/plugin/tests/__snapshots__/naming-convention.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`naming-convention > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type b { test: String } @@ -9,7 +9,9 @@ exports[`Invalid #1 1`] = ` { "types": "PascalCase", - "FieldDefinition": "PascalCase" + "FieldDefinition": "PascalCase", + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/2 @@ -31,7 +33,7 @@ exports[`Invalid #1 1`] = ` 1 | type b { Test: String } `; -exports[`Invalid #2 1`] = ` +exports[`naming-convention > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | type __b { test__: String } @@ -62,7 +64,7 @@ exports[`Invalid #2 1`] = ` 1 | type __b { test: String } `; -exports[`Invalid #3 1`] = ` +exports[`naming-convention > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | scalar BSONDecimal @@ -70,7 +72,9 @@ exports[`Invalid #3 1`] = ` #### ⚙️ Options { - "ScalarTypeDefinition": "snake_case" + "ScalarTypeDefinition": "snake_case", + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error @@ -83,7 +87,7 @@ exports[`Invalid #3 1`] = ` 1 | scalar bson_decimal `; -exports[`Invalid #5 1`] = ` +exports[`naming-convention > invalid > Invalid #5 1`] = ` #### ⌨️ Code 1 | enum B { test } @@ -92,7 +96,9 @@ exports[`Invalid #5 1`] = ` { "EnumTypeDefinition": "camelCase", - "EnumValueDefinition": "UPPER_CASE" + "EnumValueDefinition": "UPPER_CASE", + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/2 @@ -114,7 +120,7 @@ exports[`Invalid #5 1`] = ` 1 | enum B { TEST } `; -exports[`Invalid #6 1`] = ` +exports[`naming-convention > invalid > Invalid #6 1`] = ` #### ⌨️ Code 1 | input test { _Value: String } @@ -123,7 +129,9 @@ exports[`Invalid #6 1`] = ` { "types": "PascalCase", - "InputValueDefinition": "snake_case" + "InputValueDefinition": "snake_case", + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/3 @@ -154,7 +162,7 @@ exports[`Invalid #6 1`] = ` 1 | input test { Value: String } `; -exports[`Invalid #7 1`] = ` +exports[`naming-convention > invalid > Invalid #7 1`] = ` #### ⌨️ Code 1 | type TypeOne { aField: String } enum Z { VALUE_ONE VALUE_TWO } @@ -172,7 +180,9 @@ exports[`Invalid #7 1`] = ` "EnumValueDefinition": { "style": "camelCase", "suffix": "ENUM" - } + }, + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/4 @@ -212,7 +222,7 @@ exports[`Invalid #7 1`] = ` 1 | type TypeOne { aField: String } enum Z { VALUE_ONE VALUE_TWOENUM } `; -exports[`Invalid #8 1`] = ` +exports[`naming-convention > invalid > Invalid #8 1`] = ` #### ⌨️ Code 1 | type One { aField: String } enum Z { A_ENUM_VALUE_ONE VALUE_TWO } @@ -230,7 +240,9 @@ exports[`Invalid #8 1`] = ` "EnumValueDefinition": { "style": "UPPER_CASE", "prefix": "ENUM" - } + }, + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/3 @@ -261,7 +273,7 @@ exports[`Invalid #8 1`] = ` 1 | type One { aField: String } enum Z { A_ENUM_VALUE_ONE ENUMVALUE_TWO } `; -exports[`Invalid #9 1`] = ` +exports[`naming-convention > invalid > Invalid #9 1`] = ` #### ⌨️ Code 1 | type One { getFoo: String, queryBar: String } type Query { getA(id: ID!): String, queryB: String } extend type Query { getC: String } @@ -291,7 +303,9 @@ exports[`Invalid #9 1`] = ` "get", "query" ] - } + }, + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/5 @@ -340,7 +354,7 @@ exports[`Invalid #9 1`] = ` 1 | type One { getFoo: String, queryBar: String } type Query { getA(id: ID!): String, queryB: String } extend type Query { C: String } `; -exports[`Invalid #10 1`] = ` +exports[`naming-convention > invalid > Invalid #10 1`] = ` #### ⌨️ Code 1 | query Foo { foo } query getBar { bar } @@ -353,7 +367,9 @@ exports[`Invalid #10 1`] = ` "forbiddenPrefixes": [ "get" ] - } + }, + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/2 @@ -375,7 +391,7 @@ exports[`Invalid #10 1`] = ` 1 | query Foo { foo } query Bar { bar } `; -exports[`large graphql file 1`] = ` +exports[`naming-convention > invalid > large graphql file 1`] = ` #### ⌨️ Code 1 | input _idOperatorsFilterFindManyUserInput { @@ -1495,7 +1511,8 @@ exports[`large graphql file 1`] = ` "types": "PascalCase", "InputValueDefinition": "camelCase", "EnumValueDefinition": "UPPER_CASE", - "FragmentDefinition": "PascalCase" + "FragmentDefinition": "PascalCase", + "allowTrailingUnderscore": false } #### ❌ Error 1/27 @@ -1687,7 +1704,7 @@ exports[`large graphql file 1`] = ` 390 | } `; -exports[`operations-recommended config 1`] = ` +exports[`naming-convention > invalid > operations-recommended config 1`] = ` #### ⌨️ Code 1 | query TestQuery { test } @@ -1730,7 +1747,9 @@ exports[`operations-recommended config 1`] = ` "forbiddenSuffixes": [ "Fragment" ] - } + }, + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/9 @@ -1939,7 +1958,7 @@ exports[`operations-recommended config 1`] = ` 13 | fragment Test on Test { id } `; -exports[`schema-recommended config 1`] = ` +exports[`naming-convention > invalid > schema-recommended config 1`] = ` #### ⌨️ Code 1 | type Query { @@ -1991,7 +2010,9 @@ exports[`schema-recommended config 1`] = ` "forbiddenSuffixes": [ "Subscription" ] - } + }, + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/7 @@ -2170,7 +2191,7 @@ exports[`schema-recommended config 1`] = ` 15 | } `; -exports[`should error when selected type names do not match require prefixes 1`] = ` +exports[`naming-convention > invalid > should error when selected type names do not match require prefixes 1`] = ` #### ⌨️ Code 1 | scalar Secret @@ -2205,7 +2226,9 @@ exports[`should error when selected type names do not match require prefixes 1`] "requiredPrefixes": [ "hiss" ] - } + }, + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/3 @@ -2286,7 +2309,7 @@ exports[`should error when selected type names do not match require prefixes 1`] 11 | } `; -exports[`should error when selected type names do not match require suffixes 1`] = ` +exports[`naming-convention > invalid > should error when selected type names do not match require suffixes 1`] = ` #### ⌨️ Code 1 | scalar IpAddress @@ -2310,7 +2333,9 @@ exports[`should error when selected type names do not match require suffixes 1`] "requiredSuffixes": [ "IpAddress" ] - } + }, + "allowLeadingUnderscore": false, + "allowTrailingUnderscore": false } #### ❌ Error 1/2 @@ -2355,7 +2380,7 @@ exports[`should error when selected type names do not match require suffixes 1`] 6 | } `; -exports[`should ignore selections fields but check alias renaming 1`] = ` +exports[`naming-convention > invalid > should ignore selections fields but check alias renaming 1`] = ` #### ⌨️ Code 1 | { diff --git a/packages/plugin/tests/__snapshots__/no-anonymous-operations.spec.md b/packages/plugin/tests/__snapshots__/no-anonymous-operations.spec.md index aec338a2840..37215e81880 100644 --- a/packages/plugin/tests/__snapshots__/no-anonymous-operations.spec.md +++ b/packages/plugin/tests/__snapshots__/no-anonymous-operations.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`no-anonymous-operations > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | query { a } @@ -15,7 +15,7 @@ exports[`Invalid #1 1`] = ` 1 | query a { a } `; -exports[`Invalid #2 1`] = ` +exports[`no-anonymous-operations > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | mutation { renamed: a } @@ -30,7 +30,7 @@ exports[`Invalid #2 1`] = ` 1 | mutation renamed { renamed: a } `; -exports[`Invalid #3 1`] = ` +exports[`no-anonymous-operations > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | subscription { ...someFragmentSpread } diff --git a/packages/plugin/tests/__snapshots__/no-case-insensitive-enum-values-duplicates.spec.md b/packages/plugin/tests/__snapshots__/no-case-insensitive-enum-values-duplicates.spec.md index e00d7f30621..6c24d0ed502 100644 --- a/packages/plugin/tests/__snapshots__/no-case-insensitive-enum-values-duplicates.spec.md +++ b/packages/plugin/tests/__snapshots__/no-case-insensitive-enum-values-duplicates.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`no-case-insensitive-enum-values-duplicates > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | enum A { TEST TesT } @@ -15,7 +15,7 @@ exports[`Invalid #1 1`] = ` 1 | enum A { TEST } `; -exports[`Invalid #2 1`] = ` +exports[`no-case-insensitive-enum-values-duplicates > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | extend enum A { TEST TesT } diff --git a/packages/plugin/tests/__snapshots__/no-deprecated.spec.md b/packages/plugin/tests/__snapshots__/no-deprecated.spec.md index 7d0bacc44bb..41564657f1a 100644 --- a/packages/plugin/tests/__snapshots__/no-deprecated.spec.md +++ b/packages/plugin/tests/__snapshots__/no-deprecated.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`no-deprecated > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | mutation { something(t: OLD) } @@ -15,7 +15,7 @@ exports[`Invalid #1 1`] = ` 1 | mutation { something(t: ) } `; -exports[`Invalid #2 1`] = ` +exports[`no-deprecated > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | mutation { something(t: OLD_WITH_REASON) } @@ -30,7 +30,7 @@ exports[`Invalid #2 1`] = ` 1 | mutation { something(t: ) } `; -exports[`Invalid #3 1`] = ` +exports[`no-deprecated > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | query { oldField } @@ -45,7 +45,7 @@ exports[`Invalid #3 1`] = ` 1 | query { } `; -exports[`Invalid #4 1`] = ` +exports[`no-deprecated > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | query { oldFieldWithReason } diff --git a/packages/plugin/tests/__snapshots__/no-duplicate-fields.spec.md b/packages/plugin/tests/__snapshots__/no-duplicate-fields.spec.md index 5f6300a0b32..a914063f4a8 100644 --- a/packages/plugin/tests/__snapshots__/no-duplicate-fields.spec.md +++ b/packages/plugin/tests/__snapshots__/no-duplicate-fields.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`no-duplicate-fields > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | query test($v: String, $t: String, $v: String) { @@ -20,7 +20,7 @@ exports[`Invalid #1 1`] = ` 3 | } `; -exports[`Invalid #2 1`] = ` +exports[`no-duplicate-fields > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | query test { @@ -45,7 +45,7 @@ exports[`Invalid #2 1`] = ` 5 | } `; -exports[`Invalid #3 1`] = ` +exports[`no-duplicate-fields > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | query test { @@ -76,7 +76,7 @@ exports[`Invalid #3 1`] = ` 8 | } `; -exports[`Invalid #4 1`] = ` +exports[`no-duplicate-fields > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | query test { diff --git a/packages/plugin/tests/__snapshots__/no-hashtag-description.spec.md b/packages/plugin/tests/__snapshots__/no-hashtag-description.spec.md index d4fb34a2274..20049bbf613 100644 --- a/packages/plugin/tests/__snapshots__/no-hashtag-description.spec.md +++ b/packages/plugin/tests/__snapshots__/no-hashtag-description.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`no-hashtag-description > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | # Bad @@ -30,7 +30,7 @@ exports[`Invalid #1 1`] = ` 4 | } `; -exports[`Invalid #2 1`] = ` +exports[`no-hashtag-description > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | # multiline @@ -64,7 +64,7 @@ exports[`Invalid #2 1`] = ` 5 | } `; -exports[`Invalid #3 1`] = ` +exports[`no-hashtag-description > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | type Query { @@ -95,7 +95,7 @@ exports[`Invalid #3 1`] = ` 4 | } `; -exports[`Invalid #4 1`] = ` +exports[`no-hashtag-description > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | type Query { @@ -132,7 +132,7 @@ exports[`Invalid #4 1`] = ` 6 | } `; -exports[`Invalid #5 1`] = ` +exports[`no-hashtag-description > invalid > Invalid #5 1`] = ` #### ⌨️ Code 1 | type Query { 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 e8c32fabfb0..04a9beaa108 100644 --- a/packages/plugin/tests/__snapshots__/no-one-place-fragments.spec.md +++ b/packages/plugin/tests/__snapshots__/no-one-place-fragments.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`should error fragment used in one place 1`] = ` +exports[`no-one-place-fragments > invalid > should error fragment used in one place 1`] = ` #### ⌨️ Code 1 | fragment UserFields on User { diff --git a/packages/plugin/tests/__snapshots__/no-root-type.spec.md b/packages/plugin/tests/__snapshots__/no-root-type.spec.md index bdb0ce7b29e..3ad37ae5834 100644 --- a/packages/plugin/tests/__snapshots__/no-root-type.spec.md +++ b/packages/plugin/tests/__snapshots__/no-root-type.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`disallow mutation 1`] = ` +exports[`no-root-type > invalid > disallow mutation 1`] = ` #### ⌨️ Code 1 | type Mutation @@ -23,7 +23,7 @@ exports[`disallow mutation 1`] = ` 1 | `; -exports[`disallow subscription 1`] = ` +exports[`no-root-type > invalid > disallow subscription 1`] = ` #### ⌨️ Code 1 | type Subscription @@ -46,7 +46,7 @@ exports[`disallow subscription 1`] = ` 1 | `; -exports[`disallow when root type name is renamed 1`] = ` +exports[`no-root-type > invalid > disallow when root type name is renamed 1`] = ` #### ⌨️ Code 1 | type MyMutation @@ -69,7 +69,7 @@ exports[`disallow when root type name is renamed 1`] = ` 1 | `; -exports[`disallow with extend 1`] = ` +exports[`no-root-type > invalid > disallow with extend 1`] = ` #### ⌨️ Code 1 | extend type Mutation { foo: ID } diff --git a/packages/plugin/tests/__snapshots__/no-scalar-result-type-on-mutation.spec.md b/packages/plugin/tests/__snapshots__/no-scalar-result-type-on-mutation.spec.md index 32c7667a1a5..b86f5c84e61 100644 --- a/packages/plugin/tests/__snapshots__/no-scalar-result-type-on-mutation.spec.md +++ b/packages/plugin/tests/__snapshots__/no-scalar-result-type-on-mutation.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #2 1`] = ` +exports[`no-scalar-result-type-on-mutation > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | type Mutation @@ -25,7 +25,7 @@ exports[`Invalid #2 1`] = ` 5 | } `; -exports[`Invalid #3 1`] = ` +exports[`no-scalar-result-type-on-mutation > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | type RootMutation { @@ -54,7 +54,7 @@ exports[`Invalid #3 1`] = ` 7 | } `; -exports[`Invalid #4 1`] = ` +exports[`no-scalar-result-type-on-mutation > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | type RootMutation @@ -85,7 +85,7 @@ exports[`Invalid #4 1`] = ` 8 | } `; -exports[`Invalid #5 1`] = ` +exports[`no-scalar-result-type-on-mutation > invalid > Invalid #5 1`] = ` #### ⌨️ Code 1 | type Mutation { @@ -125,7 +125,7 @@ exports[`Invalid #5 1`] = ` 5 | } `; -exports[`should ignore arguments 1`] = ` +exports[`no-scalar-result-type-on-mutation > invalid > should ignore arguments 1`] = ` #### ⌨️ Code 1 | type Mutation { diff --git a/packages/plugin/tests/__snapshots__/no-typename-prefix.spec.md b/packages/plugin/tests/__snapshots__/no-typename-prefix.spec.md index 42a69885ad6..e7f250ded0d 100644 --- a/packages/plugin/tests/__snapshots__/no-typename-prefix.spec.md +++ b/packages/plugin/tests/__snapshots__/no-typename-prefix.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`no-typename-prefix > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type User { @@ -21,7 +21,7 @@ exports[`Invalid #1 1`] = ` 3 | } `; -exports[`Invalid #2 1`] = ` +exports[`no-typename-prefix > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | type User { @@ -58,7 +58,7 @@ exports[`Invalid #2 1`] = ` 4 | } `; -exports[`Invalid #3 1`] = ` +exports[`no-typename-prefix > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | interface Node { diff --git a/packages/plugin/tests/__snapshots__/no-undefined-variables.spec.md b/packages/plugin/tests/__snapshots__/no-undefined-variables.spec.md index f9d072f5080..7469b7f4ed6 100644 --- a/packages/plugin/tests/__snapshots__/no-undefined-variables.spec.md +++ b/packages/plugin/tests/__snapshots__/no-undefined-variables.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`no-undefined-variables > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | query User { diff --git a/packages/plugin/tests/__snapshots__/no-unreachable-types.spec.md b/packages/plugin/tests/__snapshots__/no-unreachable-types.spec.md index e530be8116c..07b0ff5fd08 100644 --- a/packages/plugin/tests/__snapshots__/no-unreachable-types.spec.md +++ b/packages/plugin/tests/__snapshots__/no-unreachable-types.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`no-unreachable-types > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type Query { @@ -114,7 +114,7 @@ exports[`Invalid #1 1`] = ` 18 | `; -exports[`Invalid #2 1`] = ` +exports[`no-unreachable-types > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | # ScalarTypeDefinition @@ -412,7 +412,7 @@ exports[`Invalid #2 1`] = ` 27 | `; -exports[`Invalid #3 1`] = ` +exports[`no-unreachable-types > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | interface User { @@ -462,7 +462,7 @@ exports[`Invalid #3 1`] = ` 18 | `; -exports[`Invalid #4 1`] = ` +exports[`no-unreachable-types > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | interface User { @@ -570,7 +570,7 @@ exports[`Invalid #4 1`] = ` 18 | } `; -exports[`Invalid #5 1`] = ` +exports[`no-unreachable-types > invalid > Invalid #5 1`] = ` #### ⌨️ Code 1 | type Query { diff --git a/packages/plugin/tests/__snapshots__/no-unused-fields.spec.md b/packages/plugin/tests/__snapshots__/no-unused-fields.spec.md index 3b6bb6d7bb9..098b38eb2c5 100644 --- a/packages/plugin/tests/__snapshots__/no-unused-fields.spec.md +++ b/packages/plugin/tests/__snapshots__/no-unused-fields.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`no-unused-fields > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type User { @@ -23,7 +23,7 @@ exports[`Invalid #1 1`] = ` 4 | } `; -exports[`Invalid #2 1`] = ` +exports[`no-unused-fields > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | type Query { diff --git a/packages/plugin/tests/__snapshots__/possible-type-extension.spec.md b/packages/plugin/tests/__snapshots__/possible-type-extension.spec.md index 0e8536a5594..377aaedd976 100644 --- a/packages/plugin/tests/__snapshots__/possible-type-extension.spec.md +++ b/packages/plugin/tests/__snapshots__/possible-type-extension.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`possible-type-extension > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | extend type OtherUser { diff --git a/packages/plugin/tests/__snapshots__/relay-arguments.spec.md b/packages/plugin/tests/__snapshots__/relay-arguments.spec.md index c122b0c2def..98f6f625c11 100644 --- a/packages/plugin/tests/__snapshots__/relay-arguments.spec.md +++ b/packages/plugin/tests/__snapshots__/relay-arguments.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`relay-arguments > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type User { @@ -49,7 +49,7 @@ exports[`Invalid #1 1`] = ` 8 | ): PostConnection `; -exports[`Invalid #2 1`] = ` +exports[`relay-arguments > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | type User { @@ -71,7 +71,7 @@ exports[`Invalid #2 1`] = ` 3 | } `; -exports[`should report about 2nd required argument if 1st was provided 1`] = ` +exports[`relay-arguments > invalid > should report about 2nd required argument if 1st was provided 1`] = ` #### ⌨️ Code 1 | type User { diff --git a/packages/plugin/tests/__snapshots__/relay-connection-types.spec.md b/packages/plugin/tests/__snapshots__/relay-connection-types.spec.md index e85124b3c1b..5b960cd2f97 100644 --- a/packages/plugin/tests/__snapshots__/relay-connection-types.spec.md +++ b/packages/plugin/tests/__snapshots__/relay-connection-types.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`\`edges\` field should return a list type that wraps an edge type 1`] = ` +exports[`relay-connection-types > invalid > \`edges\` field should return a list type that wraps an edge type 1`] = ` #### ⌨️ Code 1 | type AConnection { @@ -27,7 +27,7 @@ exports[`\`edges\` field should return a list type that wraps an edge type 1`] = 7 | pageInfo: PageInfo! `; -exports[`\`pageInfo\` field must return a non-null \`PageInfo\` object 1`] = ` +exports[`relay-connection-types > invalid > \`pageInfo\` field must return a non-null \`PageInfo\` object 1`] = ` #### ⌨️ Code 1 | type AConnection { @@ -87,7 +87,7 @@ exports[`\`pageInfo\` field must return a non-null \`PageInfo\` object 1`] = ` 20 | } `; -exports[`should report about missing \`Connection\` suffix 1`] = ` +exports[`relay-connection-types > invalid > should report about missing \`Connection\` suffix 1`] = ` #### ⌨️ Code 1 | type User { @@ -102,7 +102,7 @@ exports[`should report about missing \`Connection\` suffix 1`] = ` 2 | edges: UserEdge `; -exports[`should report about missing \`edges\` field 1`] = ` +exports[`relay-connection-types > invalid > should report about missing \`edges\` field 1`] = ` #### ⌨️ Code 1 | type UserConnection { pageInfo: PageInfo! } @@ -113,7 +113,7 @@ exports[`should report about missing \`edges\` field 1`] = ` | ^^^^^^^^^^^^^^ Connection type must contain a field \`edges\` that return a list type. `; -exports[`should report about missing \`pageInfo\` field 1`] = ` +exports[`relay-connection-types > invalid > should report about missing \`pageInfo\` field 1`] = ` #### ⌨️ Code 1 | type UserConnection { edges: [UserEdge] } @@ -124,7 +124,7 @@ exports[`should report about missing \`pageInfo\` field 1`] = ` | ^^^^^^^^^^^^^^ Connection type must contain a field \`pageInfo\` that return a non-null \`PageInfo\` Object type. `; -exports[`should report about non connection types with \`Connection\` suffix 1`] = ` +exports[`relay-connection-types > invalid > should report about non connection types with \`Connection\` suffix 1`] = ` #### ⌨️ Code 1 | scalar DateTimeConnection diff --git a/packages/plugin/tests/__snapshots__/relay-edge-types.spec.md b/packages/plugin/tests/__snapshots__/relay-edge-types.spec.md index ba9a0f29522..3b2b5658f4c 100644 --- a/packages/plugin/tests/__snapshots__/relay-edge-types.spec.md +++ b/packages/plugin/tests/__snapshots__/relay-edge-types.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Edge type must be Object type 1`] = ` +exports[`relay-edge-types > invalid > Edge type must be Object type 1`] = ` #### ⌨️ Code 1 | type PageInfo @@ -31,7 +31,8 @@ exports[`Edge type must be Object type 1`] = ` { "shouldImplementNode": false, - "listTypeCanWrapOnlyEdgeType": false + "listTypeCanWrapOnlyEdgeType": false, + "withEdgeSuffix": true } #### ❌ Error 1/4 @@ -63,7 +64,7 @@ exports[`Edge type must be Object type 1`] = ` 22 | pageInfo: PageInfo! `; -exports[`list type 1`] = ` +exports[`relay-edge-types > invalid > list type 1`] = ` #### ⌨️ Code 1 | type AEdge { @@ -83,7 +84,9 @@ exports[`list type 1`] = ` #### ⚙️ Options { - "listTypeCanWrapOnlyEdgeType": true + "listTypeCanWrapOnlyEdgeType": true, + "withEdgeSuffix": true, + "shouldImplementNode": true } #### ❌ Error 1/4 @@ -115,7 +118,7 @@ exports[`list type 1`] = ` 13 | } `; -exports[`should implements Node 1`] = ` +exports[`relay-edge-types > invalid > should implements Node 1`] = ` #### ⌨️ Code 1 | type User { @@ -132,7 +135,9 @@ exports[`should implements Node 1`] = ` #### ⚙️ Options { - "shouldImplementNode": true + "shouldImplementNode": true, + "withEdgeSuffix": true, + "listTypeCanWrapOnlyEdgeType": true } #### ❌ Error @@ -143,7 +148,7 @@ exports[`should implements Node 1`] = ` 5 | node: User! `; -exports[`should report cursor when list is used 1`] = ` +exports[`relay-edge-types > invalid > should report cursor when list is used 1`] = ` #### ⌨️ Code 1 | type PageInfo @@ -160,7 +165,8 @@ exports[`should report cursor when list is used 1`] = ` { "shouldImplementNode": false, - "listTypeCanWrapOnlyEdgeType": false + "listTypeCanWrapOnlyEdgeType": false, + "withEdgeSuffix": true } #### ❌ Error 1/2 @@ -178,7 +184,7 @@ exports[`should report cursor when list is used 1`] = ` 5 | } `; -exports[`should report when fields is missing 1`] = ` +exports[`relay-edge-types > invalid > should report when fields is missing 1`] = ` #### ⌨️ Code 1 | type PageInfo @@ -203,7 +209,7 @@ exports[`should report when fields is missing 1`] = ` 3 | type AConnection { `; -exports[`should report when without Edge suffix 1`] = ` +exports[`relay-edge-types > invalid > should report when without Edge suffix 1`] = ` #### ⌨️ Code 1 | scalar Email @@ -218,7 +224,9 @@ exports[`should report when without Edge suffix 1`] = ` #### ⚙️ Options { - "withEdgeSuffix": true + "withEdgeSuffix": true, + "shouldImplementNode": true, + "listTypeCanWrapOnlyEdgeType": true } #### ❌ Error diff --git a/packages/plugin/tests/__snapshots__/relay-page-info.spec.md b/packages/plugin/tests/__snapshots__/relay-page-info.spec.md index 99649777bd5..bb3d80c2320 100644 --- a/packages/plugin/tests/__snapshots__/relay-page-info.spec.md +++ b/packages/plugin/tests/__snapshots__/relay-page-info.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`relay-page-info > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | scalar PageInfo @@ -11,7 +11,7 @@ exports[`Invalid #1 1`] = ` | ^^^^^^^^ \`PageInfo\` must be an Object type. `; -exports[`when \`PageInfo\` is missing 1`] = ` +exports[`relay-page-info > invalid > when \`PageInfo\` is missing 1`] = ` #### ⌨️ Code 1 | type Query @@ -22,7 +22,7 @@ exports[`when \`PageInfo\` is missing 1`] = ` | ^ The server must provide a \`PageInfo\` object. `; -exports[`when enum 1`] = ` +exports[`relay-page-info > invalid > when enum 1`] = ` #### ⌨️ Code 1 | enum PageInfo @@ -47,7 +47,7 @@ exports[`when enum 1`] = ` 3 | hasPreviousPage `; -exports[`when extend type 1`] = ` +exports[`relay-page-info > invalid > when extend type 1`] = ` #### ⌨️ Code 1 | type PageInfo @@ -83,7 +83,7 @@ exports[`when extend type 1`] = ` 2 | extend type PageInfo { `; -exports[`when fields is missing or incorrect return type 1`] = ` +exports[`relay-page-info > invalid > when fields is missing or incorrect return type 1`] = ` #### ⌨️ Code 1 | type PageInfo { @@ -118,7 +118,7 @@ exports[`when fields is missing or incorrect return type 1`] = ` 4 | } `; -exports[`when input 1`] = ` +exports[`relay-page-info > invalid > when input 1`] = ` #### ⌨️ Code 1 | input PageInfo @@ -143,7 +143,7 @@ exports[`when input 1`] = ` 3 | hasPreviousPage: Boolean! `; -exports[`when interface 1`] = ` +exports[`relay-page-info > invalid > when interface 1`] = ` #### ⌨️ Code 1 | interface PageInfo @@ -168,7 +168,7 @@ exports[`when interface 1`] = ` 3 | hasPreviousPage: Boolean! `; -exports[`when union 1`] = ` +exports[`relay-page-info > invalid > when union 1`] = ` #### ⌨️ Code 1 | union PageInfo = UserConnection | Post diff --git a/packages/plugin/tests/__snapshots__/require-deprecation-date.spec.md b/packages/plugin/tests/__snapshots__/require-deprecation-date.spec.md index b7923f54861..4743ba4ecda 100644 --- a/packages/plugin/tests/__snapshots__/require-deprecation-date.spec.md +++ b/packages/plugin/tests/__snapshots__/require-deprecation-date.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`require-deprecation-date > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | scalar Old @deprecated(deletionDate: "22/08/2021") @@ -15,7 +15,7 @@ exports[`Invalid #1 1`] = ` 1 | `; -exports[`Invalid #2 1`] = ` +exports[`require-deprecation-date > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | scalar Old @deprecated(untilDate: "22/08/2021") @@ -36,7 +36,7 @@ exports[`Invalid #2 1`] = ` 1 | `; -exports[`Invalid #3 1`] = ` +exports[`require-deprecation-date > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | scalar Old @deprecated(deletionDate: "bad") @@ -47,7 +47,7 @@ exports[`Invalid #3 1`] = ` | ^^^^^ Deletion date must be in format "DD/MM/YYYY" for scalar "Old" `; -exports[`Invalid #4 1`] = ` +exports[`require-deprecation-date > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | scalar Old @deprecated(deletionDate: "32/08/2021") @@ -58,7 +58,7 @@ exports[`Invalid #4 1`] = ` | ^^^^^^^^^^^^ Invalid "32/08/2021" deletion date for scalar "Old" `; -exports[`Invalid #5 1`] = ` +exports[`require-deprecation-date > invalid > Invalid #5 1`] = ` #### ⌨️ Code 1 | type Old { oldField: ID @deprecated } diff --git a/packages/plugin/tests/__snapshots__/require-deprecation-reason.spec.md b/packages/plugin/tests/__snapshots__/require-deprecation-reason.spec.md index 6eaf90e70ff..92de704ea9b 100644 --- a/packages/plugin/tests/__snapshots__/require-deprecation-reason.spec.md +++ b/packages/plugin/tests/__snapshots__/require-deprecation-reason.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`require-deprecation-reason > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type A { diff --git a/packages/plugin/tests/__snapshots__/require-description.spec.md b/packages/plugin/tests/__snapshots__/require-description.spec.md index c55d6c1df5f..817e48a1637 100644 --- a/packages/plugin/tests/__snapshots__/require-description.spec.md +++ b/packages/plugin/tests/__snapshots__/require-description.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`require-description > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type User { id: ID } @@ -17,7 +17,7 @@ exports[`Invalid #1 1`] = ` | ^^^^ Description is required for type "User" `; -exports[`Invalid #2 1`] = ` +exports[`require-description > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | interface Node { id: ID! } @@ -34,7 +34,7 @@ exports[`Invalid #2 1`] = ` | ^^^^ Description is required for interface "Node" `; -exports[`Invalid #3 1`] = ` +exports[`require-description > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | enum Role { ADMIN } @@ -51,7 +51,7 @@ exports[`Invalid #3 1`] = ` | ^^^^ Description is required for enum "Role" `; -exports[`Invalid #4 1`] = ` +exports[`require-description > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | scalar Email @@ -68,7 +68,7 @@ exports[`Invalid #4 1`] = ` | ^^^^^ Description is required for scalar "Email" `; -exports[`Invalid #5 1`] = ` +exports[`require-description > invalid > Invalid #5 1`] = ` #### ⌨️ Code 1 | input CreateUserInput { email: Email! } @@ -85,7 +85,7 @@ exports[`Invalid #5 1`] = ` | ^^^^^^^^^^^^^^^ Description is required for input "CreateUserInput" `; -exports[`Invalid #6 1`] = ` +exports[`require-description > invalid > Invalid #6 1`] = ` #### ⌨️ Code 1 | union Media = Book | Movie @@ -102,7 +102,7 @@ exports[`Invalid #6 1`] = ` | ^^^^^ Description is required for union "Media" `; -exports[`Invalid #7 1`] = ` +exports[`require-description > invalid > Invalid #7 1`] = ` #### ⌨️ Code 1 | directive @auth(requires: Role!) on FIELD_DEFINITION @@ -119,7 +119,7 @@ exports[`Invalid #7 1`] = ` | ^^^^ Description is required for directive "auth" `; -exports[`Invalid #8 1`] = ` +exports[`require-description > invalid > Invalid #8 1`] = ` #### ⌨️ Code 1 | type User { email: Email! } @@ -136,7 +136,7 @@ exports[`Invalid #8 1`] = ` | ^^^^^ Description is required for field "email" in type "User" `; -exports[`Invalid #9 1`] = ` +exports[`require-description > invalid > Invalid #9 1`] = ` #### ⌨️ Code 1 | input CreateUserInput { email: Email! } @@ -153,7 +153,7 @@ exports[`Invalid #9 1`] = ` | ^^^^^ Description is required for input value "email" in input "CreateUserInput" `; -exports[`Invalid #10 1`] = ` +exports[`require-description > invalid > Invalid #10 1`] = ` #### ⌨️ Code 1 | enum Role { ADMIN } @@ -170,7 +170,7 @@ exports[`Invalid #10 1`] = ` | ^^^^^ Description is required for enum value "ADMIN" in enum "Role" `; -exports[`Invalid #17 1`] = ` +exports[`require-description > invalid > Invalid #17 1`] = ` #### ⌨️ Code 1 | type Query { user(id: String!): User! } @@ -187,7 +187,7 @@ exports[`Invalid #17 1`] = ` | ^^^^ Description is required for field "user" in type "Query" `; -exports[`Invalid #18 1`] = ` +exports[`require-description > invalid > Invalid #18 1`] = ` #### ⌨️ Code 1 | type Mutation { createUser(id: [ID!]!): User! } @@ -204,7 +204,7 @@ exports[`Invalid #18 1`] = ` | ^^^^^^^^^^ Description is required for field "createUser" in type "Mutation" `; -exports[`Invalid #19 1`] = ` +exports[`require-description > invalid > Invalid #19 1`] = ` #### ⌨️ Code 1 | type MySubscription { @@ -228,7 +228,7 @@ exports[`Invalid #19 1`] = ` 3 | } `; -exports[`should disable description for ObjectTypeDefinition 1`] = ` +exports[`require-description > invalid > should disable description for ObjectTypeDefinition 1`] = ` #### ⌨️ Code 1 | type CreateOneUserPayload { @@ -259,7 +259,7 @@ exports[`should disable description for ObjectTypeDefinition 1`] = ` 4 | } `; -exports[`should ignore comments before fragment definition 1`] = ` +exports[`require-description > invalid > should ignore comments before fragment definition 1`] = ` #### ⌨️ Code 1 | # BAD @@ -287,7 +287,7 @@ exports[`should ignore comments before fragment definition 1`] = ` 7 | user { `; -exports[`should report because of linesBefore !== 1 1`] = ` +exports[`require-description > invalid > should report because of linesBefore !== 1 1`] = ` #### ⌨️ Code 1 | # linesBefore !== 1 @@ -310,7 +310,7 @@ exports[`should report because of linesBefore !== 1 1`] = ` 4 | foo `; -exports[`should report because skips comment that starts with \`eslint\` 1`] = ` +exports[`require-description > invalid > should report because skips comment that starts with \`eslint\` 1`] = ` #### ⌨️ Code 1 | # eslint-disable-next-line semi @@ -332,7 +332,7 @@ exports[`should report because skips comment that starts with \`eslint\` 1`] = ` 3 | foo `; -exports[`should validate mutation 1`] = ` +exports[`require-description > invalid > should validate mutation 1`] = ` #### ⌨️ Code 1 | mutation createUser { foo } @@ -349,7 +349,7 @@ exports[`should validate mutation 1`] = ` | ^^^^^^^^ Description is required for mutation "createUser" `; -exports[`should validate subscription 1`] = ` +exports[`require-description > invalid > should validate subscription 1`] = ` #### ⌨️ Code 1 | subscription commentAdded { foo } diff --git a/packages/plugin/tests/__snapshots__/require-field-of-type-query-in-mutation-result.spec.md b/packages/plugin/tests/__snapshots__/require-field-of-type-query-in-mutation-result.spec.md index 421cb6b7366..3ae90340fde 100644 --- a/packages/plugin/tests/__snapshots__/require-field-of-type-query-in-mutation-result.spec.md +++ b/packages/plugin/tests/__snapshots__/require-field-of-type-query-in-mutation-result.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #2 1`] = ` +exports[`require-field-of-type-query-in-mutation-result > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | type Query @@ -18,7 +18,7 @@ exports[`Invalid #2 1`] = ` 6 | } `; -exports[`Invalid #3 1`] = ` +exports[`require-field-of-type-query-in-mutation-result > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | type RootQuery @@ -39,7 +39,7 @@ exports[`Invalid #3 1`] = ` 4 | } `; -exports[`Invalid #4 1`] = ` +exports[`require-field-of-type-query-in-mutation-result > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | type RootQuery @@ -61,7 +61,7 @@ exports[`Invalid #4 1`] = ` 5 | } `; -exports[`should ignore arguments 1`] = ` +exports[`require-field-of-type-query-in-mutation-result > invalid > should ignore arguments 1`] = ` #### ⌨️ Code 1 | type Query diff --git a/packages/plugin/tests/__snapshots__/require-id-when-available.spec.md b/packages/plugin/tests/__snapshots__/require-id-when-available.spec.md index f7cd4687624..433e8631232 100644 --- a/packages/plugin/tests/__snapshots__/require-id-when-available.spec.md +++ b/packages/plugin/tests/__snapshots__/require-id-when-available.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`require-id-when-available > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | { hasId { name } } @@ -16,7 +16,7 @@ exports[`Invalid #1 1`] = ` 1 | { hasId { id name } } `; -exports[`Invalid #2 1`] = ` +exports[`require-id-when-available > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | { hasId { id } } @@ -38,7 +38,7 @@ exports[`Invalid #2 1`] = ` 1 | { hasId { name id } } `; -exports[`should not work with n nested fragments if you never get the id 1`] = ` +exports[`require-id-when-available > invalid > should not work with n nested fragments if you never get the id 1`] = ` #### ⌨️ Code 1 | query User { @@ -64,7 +64,7 @@ exports[`should not work with n nested fragments if you never get the id 1`] = ` 5 | } `; -exports[`should report an error about missing \`posts.id\` field in fragment 1`] = ` +exports[`require-id-when-available > invalid > should report an error about missing \`posts.id\` field in fragment 1`] = ` #### ⌨️ Code 1 | { user { id ...UserFields } } @@ -76,7 +76,7 @@ exports[`should report an error about missing \`posts.id\` field in fragment 1`] Include it in your selection set or add to used fragment \`UserFields\`. `; -exports[`should report an error about missing \`user.id\`, \`posts.id\`, \`author.id\` and \`authorPosts.id\` selection 1`] = ` +exports[`require-id-when-available > invalid > should report an error about missing \`user.id\`, \`posts.id\`, \`author.id\` and \`authorPosts.id\` selection 1`] = ` #### ⌨️ Code 1 | { user { ...UserFullFields } } @@ -110,7 +110,7 @@ exports[`should report an error about missing \`user.id\`, \`posts.id\`, \`autho Include it in your selection set or add to used fragments \`UserFullFields\` or \`UserFields\`. `; -exports[`should report an error with union 1`] = ` +exports[`require-id-when-available > invalid > should report an error with union 1`] = ` #### ⌨️ Code 1 | { @@ -140,7 +140,7 @@ exports[`should report an error with union 1`] = ` 7 | } `; -exports[`should report an error with union and fragment spread 1`] = ` +exports[`require-id-when-available > invalid > should report an error with union and fragment spread 1`] = ` #### ⌨️ Code 1 | { @@ -170,7 +170,7 @@ exports[`should report an error with union and fragment spread 1`] = ` 7 | } `; -exports[`support multiple id field names 1`] = ` +exports[`require-id-when-available > invalid > support multiple id field names 1`] = ` #### ⌨️ Code 1 | { hasId { name } } diff --git a/packages/plugin/tests/__snapshots__/require-import-fragment.spec.md b/packages/plugin/tests/__snapshots__/require-import-fragment.spec.md index 803e15db845..27391745144 100644 --- a/packages/plugin/tests/__snapshots__/require-import-fragment.spec.md +++ b/packages/plugin/tests/__snapshots__/require-import-fragment.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`should report fragments when there are no import expressions 1`] = ` +exports[`require-import-fragment > invalid > should report fragments when there are no import expressions 1`] = ` #### ⌨️ Code 1 | { @@ -26,7 +26,7 @@ exports[`should report fragments when there are no import expressions 1`] = ` 6 | } `; -exports[`should report with default import 1`] = ` +exports[`require-import-fragment > invalid > should report with default import 1`] = ` #### ⌨️ Code 1 | #import 'bar-fragment.gql' @@ -54,7 +54,7 @@ exports[`should report with default import 1`] = ` 7 | } `; -exports[`should report with named import 1`] = ` +exports[`require-import-fragment > invalid > should report with named import 1`] = ` #### ⌨️ Code 1 | #import FooFields from "bar-fragment.gql" diff --git a/packages/plugin/tests/__snapshots__/require-nullable-fields-with-oneof.spec.md b/packages/plugin/tests/__snapshots__/require-nullable-fields-with-oneof.spec.md index ba7950d4d42..87f80b2e2d7 100644 --- a/packages/plugin/tests/__snapshots__/require-nullable-fields-with-oneof.spec.md +++ b/packages/plugin/tests/__snapshots__/require-nullable-fields-with-oneof.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`should validate \`input\` 1`] = ` +exports[`require-nullable-fields-with-oneof > invalid > should validate \`input\` 1`] = ` #### ⌨️ Code 1 | input Input @oneOf { @@ -23,7 +23,7 @@ exports[`should validate \`input\` 1`] = ` 4 | } `; -exports[`should validate \`type\` 1`] = ` +exports[`require-nullable-fields-with-oneof > invalid > should validate \`type\` 1`] = ` #### ⌨️ Code 1 | type Type @oneOf { diff --git a/packages/plugin/tests/__snapshots__/require-nullable-result-in-root.spec.md b/packages/plugin/tests/__snapshots__/require-nullable-result-in-root.spec.md index bfefa575292..f0d0452db9f 100644 --- a/packages/plugin/tests/__snapshots__/require-nullable-result-in-root.spec.md +++ b/packages/plugin/tests/__snapshots__/require-nullable-result-in-root.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`require-nullable-result-in-root > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type Query { @@ -27,7 +27,7 @@ exports[`Invalid #1 1`] = ` 6 | } `; -exports[`should work with default scalars 1`] = ` +exports[`require-nullable-result-in-root > invalid > should work with default scalars 1`] = ` #### ⌨️ Code 1 | type MySubscription @@ -56,7 +56,7 @@ exports[`should work with default scalars 1`] = ` 7 | } `; -exports[`should work with extend query 1`] = ` +exports[`require-nullable-result-in-root > invalid > should work with extend query 1`] = ` #### ⌨️ Code 1 | type MyMutation diff --git a/packages/plugin/tests/__snapshots__/require-type-pattern-with-oneof.spec.md b/packages/plugin/tests/__snapshots__/require-type-pattern-with-oneof.spec.md index f7bee157a34..ccdc7cd7fba 100644 --- a/packages/plugin/tests/__snapshots__/require-type-pattern-with-oneof.spec.md +++ b/packages/plugin/tests/__snapshots__/require-type-pattern-with-oneof.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`should validate \`error\` field 1`] = ` +exports[`require-type-pattern-with-oneof > invalid > should validate \`error\` field 1`] = ` #### ⌨️ Code 1 | type T @oneOf { @@ -15,7 +15,7 @@ exports[`should validate \`error\` field 1`] = ` 2 | ok: Ok `; -exports[`should validate \`ok\` field 1`] = ` +exports[`require-type-pattern-with-oneof > invalid > should validate \`ok\` field 1`] = ` #### ⌨️ Code 1 | type T @oneOf { diff --git a/packages/plugin/tests/__snapshots__/selection-set-depth.spec.md b/packages/plugin/tests/__snapshots__/selection-set-depth.spec.md index 33c9363275c..b2df89f2364 100644 --- a/packages/plugin/tests/__snapshots__/selection-set-depth.spec.md +++ b/packages/plugin/tests/__snapshots__/selection-set-depth.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`selection-set-depth > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | query deep2 { @@ -33,7 +33,7 @@ exports[`Invalid #1 1`] = ` 5 | } `; -exports[`Invalid #2 1`] = ` +exports[`selection-set-depth > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | query deep2 { @@ -66,7 +66,7 @@ exports[`Invalid #2 1`] = ` 5 | } `; -exports[`suggestions should not throw error when fragment is located in different file 1`] = ` +exports[`selection-set-depth > invalid > suggestions should not throw error when fragment is located in different file 1`] = ` #### ⌨️ Code 1 | { @@ -91,7 +91,7 @@ exports[`suggestions should not throw error when fragment is located in differen 6 | } `; -exports[`suggestions should work with inline fragments 1`] = ` +exports[`selection-set-depth > invalid > suggestions should work with inline fragments 1`] = ` #### ⌨️ Code 1 | { diff --git a/packages/plugin/tests/__snapshots__/strict-id-in-types.spec.md b/packages/plugin/tests/__snapshots__/strict-id-in-types.spec.md index 2be2ddc54fc..83f8e28d1da 100644 --- a/packages/plugin/tests/__snapshots__/strict-id-in-types.spec.md +++ b/packages/plugin/tests/__snapshots__/strict-id-in-types.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`strict-id-in-types > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type B { name: String! } @@ -13,7 +13,7 @@ exports[`Invalid #1 1`] = ` Accepted type: ID. `; -exports[`Invalid #2 1`] = ` +exports[`strict-id-in-types > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | type B { id: ID! _id: String! } @@ -39,7 +39,7 @@ exports[`Invalid #2 1`] = ` Accepted types: ID or String. `; -exports[`Invalid #3 1`] = ` +exports[`strict-id-in-types > invalid > Invalid #3 1`] = ` #### ⌨️ Code 1 | type B { id: String! } type B1 { id: [String] } type B2 { id: [String!] } type B3 { id: [String]! } type B4 { id: [String!]! } @@ -84,7 +84,7 @@ exports[`Invalid #3 1`] = ` Accepted type: String. `; -exports[`Invalid #4 1`] = ` +exports[`strict-id-in-types > invalid > Invalid #4 1`] = ` #### ⌨️ Code 1 | type B { id: ID! } type Bresult { key: String! } type BPayload { bool: Boolean! } type BPagination { num: Int! } @@ -121,7 +121,7 @@ exports[`Invalid #4 1`] = ` Accepted type: ID. `; -exports[`Invalid #5 1`] = ` +exports[`strict-id-in-types > invalid > Invalid #5 1`] = ` #### ⌨️ Code 1 | type B { id: ID! } type BError { message: String! } diff --git a/packages/plugin/tests/__snapshots__/unique-fragment-name.spec.md b/packages/plugin/tests/__snapshots__/unique-fragment-name.spec.md index 2b3b8fcd943..59472efeac1 100644 --- a/packages/plugin/tests/__snapshots__/unique-fragment-name.spec.md +++ b/packages/plugin/tests/__snapshots__/unique-fragment-name.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`unique-fragment-name > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | fragment HasIdFields on U { a b c } @@ -12,7 +12,7 @@ exports[`Invalid #1 1`] = ` -1866344359.graphql `; -exports[`Invalid #2 1`] = ` +exports[`unique-fragment-name > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | fragment HasIdFields on U { a b c } diff --git a/packages/plugin/tests/__snapshots__/unique-operation-name.spec.md b/packages/plugin/tests/__snapshots__/unique-operation-name.spec.md index 45151f7058b..e0c57a89aaa 100644 --- a/packages/plugin/tests/__snapshots__/unique-operation-name.spec.md +++ b/packages/plugin/tests/__snapshots__/unique-operation-name.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`unique-operation-name > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | query test { bar } @@ -12,7 +12,7 @@ exports[`Invalid #1 1`] = ` 6844040.graphql `; -exports[`Invalid #2 1`] = ` +exports[`unique-operation-name > invalid > Invalid #2 1`] = ` #### ⌨️ Code 1 | query test { bar } diff --git a/packages/plugin/tests/__snapshots__/unique-type-names.spec.md b/packages/plugin/tests/__snapshots__/unique-type-names.spec.md index 3e505092477..f40374ffcd0 100644 --- a/packages/plugin/tests/__snapshots__/unique-type-names.spec.md +++ b/packages/plugin/tests/__snapshots__/unique-type-names.spec.md @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Invalid #1 1`] = ` +exports[`unique-type-names > invalid > Invalid #1 1`] = ` #### ⌨️ Code 1 | type Query { diff --git a/packages/plugin/tests/alphabetize.spec.ts b/packages/plugin/tests/alphabetize.spec.ts index c3f623b7e4e..a5be17f3079 100644 --- a/packages/plugin/tests/alphabetize.spec.ts +++ b/packages/plugin/tests/alphabetize.spec.ts @@ -1,7 +1,5 @@ -import { GraphQLRuleTester } from '../src'; import { rule, RuleOptions } from '../src/rules/alphabetize'; - -const ruleTester = new GraphQLRuleTester(); +import { ruleTester } from './test-utils'; const GROUP_ORDER_TEST = /* GraphQL */ ` type User { @@ -18,7 +16,7 @@ const GROUP_ORDER_TEST = /* GraphQL */ ` } `; -ruleTester.runGraphQLTests('alphabetize', rule, { +ruleTester.run('alphabetize', rule, { valid: [ { options: [{ fields: ['ObjectTypeDefinition'] }], diff --git a/packages/plugin/tests/description-style.spec.ts b/packages/plugin/tests/description-style.spec.ts index 409f59d8c67..3c538eb5a0c 100644 --- a/packages/plugin/tests/description-style.spec.ts +++ b/packages/plugin/tests/description-style.spec.ts @@ -1,7 +1,5 @@ -import { GraphQLRuleTester } from '../src'; import { rule, RuleOptions } from '../src/rules/description-style'; - -const ruleTester = new GraphQLRuleTester(); +import { ruleTester } from './test-utils'; const INLINE_SDL = /* GraphQL */ ` " Test " @@ -31,7 +29,7 @@ export const BLOCK_SDL = /* GraphQL */ ` } `; -ruleTester.runGraphQLTests('description-style', rule, { +ruleTester.run('description-style', rule, { valid: [ BLOCK_SDL, { diff --git a/packages/plugin/tests/eslint-directives.spec.ts b/packages/plugin/tests/eslint-directives.spec.ts index fcb6a411013..e3a6114088d 100644 --- a/packages/plugin/tests/eslint-directives.spec.ts +++ b/packages/plugin/tests/eslint-directives.spec.ts @@ -1,11 +1,9 @@ import { join } from 'node:path'; -import { GraphQLRuleTester } from '../src'; import { rule as noAnonymousOperations } from '../src/rules/no-anonymous-operations'; import { rule as noTypenamePrefix } from '../src/rules/no-typename-prefix'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-typename-prefix', noTypenamePrefix, { +ruleTester.run('no-typename-prefix', noTypenamePrefix, { valid: [ { name: 'should work with descriptions #942', @@ -20,7 +18,7 @@ ruleTester.runGraphQLTests('no-typename-prefix', noTypenamePrefix, { invalid: [], }); -ruleTester.runGraphQLTests('test-directives', noAnonymousOperations, { +ruleTester.run('test-directives', noAnonymousOperations, { valid: [ /* GraphQL */ ` # eslint-disable-next-line diff --git a/packages/plugin/tests/examples.spec.ts b/packages/plugin/tests/examples.spec.ts index edb0329fa79..6ad98e5f525 100644 --- a/packages/plugin/tests/examples.spec.ts +++ b/packages/plugin/tests/examples.spec.ts @@ -1,8 +1,9 @@ import { spawnSync } from 'node:child_process'; import { join, relative } from 'node:path'; import { ESLint } from 'eslint'; +import { CWD as PROJECT_CWD } from '../src/utils'; -const ROOT_CWD = process.cwd(); +const CWD = join(PROJECT_CWD, '..', '..'); function countErrors(results: ESLint.LintResult[]): number { return results.reduce((acc, curr: ESLint.LintResult & { fatalErrorCount: number }) => { @@ -28,7 +29,7 @@ function getESLintOutput(cwd: string): ESLint.LintResult[] { function testSnapshot(results: ESLint.LintResult[]): void { const normalizedResults = results .map(result => ({ - filePath: relative(ROOT_CWD, result.filePath), + filePath: relative(CWD, result.filePath), messages: result.messages, })) .filter(result => result.messages.length > 0); @@ -38,63 +39,63 @@ function testSnapshot(results: ESLint.LintResult[]): void { describe('Examples', () => { it('should work on `.graphql` files', () => { - const cwd = join(ROOT_CWD, 'examples/basic'); + const cwd = join(CWD, 'examples/basic'); const results = getESLintOutput(cwd); expect(countErrors(results)).toBe(6); testSnapshot(results); }); it('should work on `.js` files', () => { - const cwd = join(ROOT_CWD, 'examples/code-file'); + const cwd = join(CWD, 'examples/code-file'); const results = getESLintOutput(cwd); expect(countErrors(results)).toBe(4); testSnapshot(results); }); it('should work with `graphql-config`', () => { - const cwd = join(ROOT_CWD, 'examples/graphql-config'); + const cwd = join(CWD, 'examples/graphql-config'); const results = getESLintOutput(cwd); expect(countErrors(results)).toBe(2); testSnapshot(results); }); it('should work with `graphql-config` on `.js` files', () => { - const cwd = join(ROOT_CWD, 'examples/graphql-config-code-file'); + 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(ROOT_CWD, 'examples/prettier'); + const cwd = join(CWD, 'examples/prettier'); const results = getESLintOutput(cwd); expect(countErrors(results)).toBe(23); testSnapshot(results); }); it('should work in monorepo', () => { - const cwd = join(ROOT_CWD, 'examples/monorepo'); + const cwd = join(CWD, 'examples/monorepo'); const results = getESLintOutput(cwd); expect(countErrors(results)).toBe(7); testSnapshot(results); }); it('should work in svelte', () => { - const cwd = join(ROOT_CWD, 'examples/svelte-code-file'); + const cwd = join(CWD, 'examples/svelte-code-file'); const results = getESLintOutput(cwd); expect(countErrors(results)).toBe(2); testSnapshot(results); }); it('should work in vue', () => { - const cwd = join(ROOT_CWD, 'examples/vue-code-file'); + const cwd = join(CWD, 'examples/vue-code-file'); const results = getESLintOutput(cwd); expect(countErrors(results)).toBe(2); testSnapshot(results); }); it('should work in multiple projects', () => { - const cwd = join(ROOT_CWD, 'examples/multiple-projects-graphql-config'); + const cwd = join(CWD, 'examples/multiple-projects-graphql-config'); const results = getESLintOutput(cwd); expect(countErrors(results)).toBe(4); testSnapshot(results); diff --git a/packages/plugin/tests/executable-definitions.spec.ts b/packages/plugin/tests/executable-definitions.spec.ts index ad9fa197142..7135f77fe24 100644 --- a/packages/plugin/tests/executable-definitions.spec.ts +++ b/packages/plugin/tests/executable-definitions.spec.ts @@ -1,5 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; +import { ruleTester } from './test-utils'; const TEST_SCHEMA = /* GraphQL */ ` type Query { @@ -22,32 +23,26 @@ const WITH_SCHEMA = { } as ParserOptions, }; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests( - 'executable-definitions', - GRAPHQL_JS_VALIDATIONS['executable-definitions'], - { - valid: [ - { - ...WITH_SCHEMA, - code: 'query test2 { foo }', - }, - { - ...WITH_SCHEMA, - code: 'mutation test { foo }', - }, - { - ...WITH_SCHEMA, - code: 'fragment Test on T { foo }', - }, - ], - invalid: [ - { - ...WITH_SCHEMA, - code: 'type Query { t: String }', - errors: [{ message: 'The "Query" definition is not executable.' }], - }, - ], - }, -); +ruleTester.run('executable-definitions', GRAPHQL_JS_VALIDATIONS['executable-definitions'], { + valid: [ + { + ...WITH_SCHEMA, + code: 'query test2 { foo }', + }, + { + ...WITH_SCHEMA, + code: 'mutation test { foo }', + }, + { + ...WITH_SCHEMA, + code: 'fragment Test on T { foo }', + }, + ], + invalid: [ + { + ...WITH_SCHEMA, + code: 'type Query { t: String }', + errors: [{ message: 'The "Query" definition is not executable.' }], + }, + ], +}); diff --git a/packages/plugin/tests/fields-on-correct-type.spec.ts b/packages/plugin/tests/fields-on-correct-type.spec.ts index e38562b793c..a312df67d03 100644 --- a/packages/plugin/tests/fields-on-correct-type.spec.ts +++ b/packages/plugin/tests/fields-on-correct-type.spec.ts @@ -1,4 +1,5 @@ -import { GraphQLRuleTester, ParserOptions, rules } from '../src'; +import { ParserOptions, rules } from '../src'; +import { ruleTester } from './test-utils'; const parserOptions: Pick = { schema: /* GraphQL */ ` @@ -12,9 +13,8 @@ const parserOptions: Pick = { } `, }; -const ruleTester = new GraphQLRuleTester(); -ruleTester.runGraphQLTests('fields-on-correct-type', rules['fields-on-correct-type'], { +ruleTester.run('fields-on-correct-type', rules['fields-on-correct-type'], { valid: [], invalid: [ { diff --git a/packages/plugin/tests/input-name.spec.ts b/packages/plugin/tests/input-name.spec.ts index 7bd2285b46a..6e5e75efe4c 100644 --- a/packages/plugin/tests/input-name.spec.ts +++ b/packages/plugin/tests/input-name.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule, RuleOptions } from '../src/rules/input-name'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('input-name', rule, { +ruleTester.run('input-name', rule, { valid: [ { code: 'type Mutation { SetMessage(input: SetMessageInput): String }', diff --git a/packages/plugin/tests/known-directives.spec.ts b/packages/plugin/tests/known-directives.spec.ts index d8e1056a370..fa60d40dfc0 100644 --- a/packages/plugin/tests/known-directives.spec.ts +++ b/packages/plugin/tests/known-directives.spec.ts @@ -1,18 +1,24 @@ -import { GraphQLRuleTester, rules } from '../src'; +import { rules } from '../src'; +import { RuleTester } from '@theguild/eslint-rule-tester'; +import { DEFAULT_CONFIG } from './test-utils'; -const ruleTester = new GraphQLRuleTester({ - schema: /* GraphQL */ ` - type User { - id: ID! - } +const ruleTester = new RuleTester({ + ...DEFAULT_CONFIG, + parserOptions: { + ...DEFAULT_CONFIG.parserOptions, + schema: /* GraphQL */ ` + type User { + id: ID! + } - type Query { - user: User - } - `, + type Query { + user: User + } + `, + }, }); -ruleTester.runGraphQLTests<[{ ignoreClientDirectives: string[] }]>( +ruleTester.run<[{ ignoreClientDirectives: string[] }]>( 'known-directives', rules['known-directives'], { diff --git a/packages/plugin/tests/known-fragment-names.spec.ts b/packages/plugin/tests/known-fragment-names.spec.ts index 3b0804fedbd..d8ecbdb45be 100644 --- a/packages/plugin/tests/known-fragment-names.spec.ts +++ b/packages/plugin/tests/known-fragment-names.spec.ts @@ -1,9 +1,8 @@ import { join } from 'node:path'; -import { GraphQLRuleTester, rules } from '../src'; +import { rules } from '../src'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('known-fragment-names', rules['known-fragment-names'], { +ruleTester.run('known-fragment-names', rules['known-fragment-names'], { valid: [ { filename: join(__dirname, 'mocks/user.graphql'), diff --git a/packages/plugin/tests/lone-executable-definition.spec.ts b/packages/plugin/tests/lone-executable-definition.spec.ts index c925c616aff..b6f18100ae8 100644 --- a/packages/plugin/tests/lone-executable-definition.spec.ts +++ b/packages/plugin/tests/lone-executable-definition.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule, RuleOptions } from '../src/rules/lone-executable-definition'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('lone-executable-definition', rule, { +ruleTester.run('lone-executable-definition', rule, { valid: [ { name: 'should allow single short-hand query', diff --git a/packages/plugin/tests/lone-schema-definition.spec.ts b/packages/plugin/tests/lone-schema-definition.spec.ts index 43f658be668..bc1b9da3a68 100644 --- a/packages/plugin/tests/lone-schema-definition.spec.ts +++ b/packages/plugin/tests/lone-schema-definition.spec.ts @@ -1,14 +1,21 @@ -import { GraphQLRuleTester } from '../src'; import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); +ruleTester.run('lone-schema-definition', GRAPHQL_JS_VALIDATIONS['lone-schema-definition'], { + valid: [ + /* GraphQL */ ` + type Query { + foo: String + } -ruleTester.runGraphQLTests( - 'lone-schema-definition', - GRAPHQL_JS_VALIDATIONS['lone-schema-definition'], - { - valid: [ - /* GraphQL */ ` + schema { + query: Query + } + `, + ], + invalid: [ + { + code: /* GraphQL */ ` type Query { foo: String } @@ -16,29 +23,16 @@ ruleTester.runGraphQLTests( schema { query: Query } - `, - ], - invalid: [ - { - code: /* GraphQL */ ` - type Query { - foo: String - } - - schema { - query: Query - } - type RootQuery { - foo: String - } + type RootQuery { + foo: String + } - schema { - query: RootQuery - } - `, - errors: [{ message: 'Must provide only one schema definition.' }], - }, - ], - }, -); + schema { + query: RootQuery + } + `, + errors: [{ message: 'Must provide only one schema definition.' }], + }, + ], +}); diff --git a/packages/plugin/tests/match-document-filename.spec.ts b/packages/plugin/tests/match-document-filename.spec.ts index 94dacb85a02..08dbaa77158 100644 --- a/packages/plugin/tests/match-document-filename.spec.ts +++ b/packages/plugin/tests/match-document-filename.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule, RuleOptions } from '../src/rules/match-document-filename'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('match-document-filename', rule, { +ruleTester.run('match-document-filename', rule, { valid: [ { filename: 'src/me.gql', diff --git a/packages/plugin/tests/naming-convention.spec.ts b/packages/plugin/tests/naming-convention.spec.ts index 8502edc712b..9b144a1168b 100644 --- a/packages/plugin/tests/naming-convention.spec.ts +++ b/packages/plugin/tests/naming-convention.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule, RuleOptions } from '../src/rules/naming-convention'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('naming-convention', rule, { +ruleTester.run('naming-convention', rule, { valid: [ { code: /* GraphQL */ ` diff --git a/packages/plugin/tests/no-anonymous-operations.spec.ts b/packages/plugin/tests/no-anonymous-operations.spec.ts index d7ddecfca8f..62bee2f51cb 100644 --- a/packages/plugin/tests/no-anonymous-operations.spec.ts +++ b/packages/plugin/tests/no-anonymous-operations.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule } from '../src/rules/no-anonymous-operations'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-anonymous-operations', rule, { +ruleTester.run('no-anonymous-operations', rule, { valid: ['query myQuery { a }', 'mutation doSomething { a }', 'subscription myData { a }'], invalid: [ { code: 'query { a }', errors: 1 }, diff --git a/packages/plugin/tests/no-case-insensitive-enum-values-duplicates.spec.ts b/packages/plugin/tests/no-case-insensitive-enum-values-duplicates.spec.ts index 31ad7a96ecf..f29ef3e181e 100644 --- a/packages/plugin/tests/no-case-insensitive-enum-values-duplicates.spec.ts +++ b/packages/plugin/tests/no-case-insensitive-enum-values-duplicates.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule } from '../src/rules/no-case-insensitive-enum-values-duplicates'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-case-insensitive-enum-values-duplicates', rule, { +ruleTester.run('no-case-insensitive-enum-values-duplicates', rule, { valid: [], invalid: [ { diff --git a/packages/plugin/tests/no-deprecated.spec.ts b/packages/plugin/tests/no-deprecated.spec.ts index 672f3ace547..e0a0eb809e6 100644 --- a/packages/plugin/tests/no-deprecated.spec.ts +++ b/packages/plugin/tests/no-deprecated.spec.ts @@ -1,5 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule } from '../src/rules/no-deprecated'; +import { ruleTester } from './test-utils'; const TEST_SCHEMA = /* GraphQL */ ` type Query { @@ -25,9 +26,8 @@ const WITH_SCHEMA = { documents: [], } as ParserOptions, }; -const ruleTester = new GraphQLRuleTester(); -ruleTester.runGraphQLTests('no-deprecated', rule, { +ruleTester.run('no-deprecated', rule, { valid: [ { ...WITH_SCHEMA, code: 'query { newField }' }, { ...WITH_SCHEMA, code: 'mutation { something(t: NEW) }' }, diff --git a/packages/plugin/tests/no-duplicate-fields.spec.ts b/packages/plugin/tests/no-duplicate-fields.spec.ts index 9f67c5da2dd..32e0b3a7afb 100644 --- a/packages/plugin/tests/no-duplicate-fields.spec.ts +++ b/packages/plugin/tests/no-duplicate-fields.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule } from '../src/rules/no-duplicate-fields'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-duplicate-fields', rule, { +ruleTester.run('no-duplicate-fields', rule, { valid: [], invalid: [ { diff --git a/packages/plugin/tests/no-hashtag-description.spec.ts b/packages/plugin/tests/no-hashtag-description.spec.ts index a740f485084..4f577d41372 100644 --- a/packages/plugin/tests/no-hashtag-description.spec.ts +++ b/packages/plugin/tests/no-hashtag-description.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule, RULE_ID } from '../src/rules/no-hashtag-description'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-hashtag-description', rule, { +ruleTester.run('no-hashtag-description', rule, { valid: [ /* GraphQL */ ` " Good " diff --git a/packages/plugin/tests/no-one-place-fragments.spec.ts b/packages/plugin/tests/no-one-place-fragments.spec.ts index 29ebacd9278..28deb2d4d80 100644 --- a/packages/plugin/tests/no-one-place-fragments.spec.ts +++ b/packages/plugin/tests/no-one-place-fragments.spec.ts @@ -1,10 +1,8 @@ import { join } from 'node:path'; -import { GraphQLRuleTester } from '../src'; import { rule } from '../src/rules/no-one-place-fragments'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-one-place-fragments', rule, { +ruleTester.run('no-one-place-fragments', rule, { valid: [ { name: 'ok when spread 2 times', diff --git a/packages/plugin/tests/no-root-type.spec.ts b/packages/plugin/tests/no-root-type.spec.ts index 1c833de7933..2e94f8813c8 100644 --- a/packages/plugin/tests/no-root-type.spec.ts +++ b/packages/plugin/tests/no-root-type.spec.ts @@ -1,5 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/no-root-type'; +import { ruleTester } from './test-utils'; const useSchema = ( code: string, @@ -11,9 +12,7 @@ const useSchema = ( }, }); -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-root-type', rule, { +ruleTester.run('no-root-type', rule, { valid: [ { ...useSchema('type Query'), 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 bda124ed6b3..bcfc821e17a 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,5 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule } from '../src/rules/no-scalar-result-type-on-mutation'; +import { ruleTester } from './test-utils'; const useSchema = ( code: string, @@ -16,9 +17,7 @@ const useSchema = ( }, }); -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-scalar-result-type-on-mutation', rule, { +ruleTester.run('no-scalar-result-type-on-mutation', rule, { valid: [ useSchema(/* GraphQL */ ` type Query { diff --git a/packages/plugin/tests/no-typename-prefix.spec.ts b/packages/plugin/tests/no-typename-prefix.spec.ts index e4a248f25c4..8d5e0ee68ae 100644 --- a/packages/plugin/tests/no-typename-prefix.spec.ts +++ b/packages/plugin/tests/no-typename-prefix.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule } from '../src/rules/no-typename-prefix'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-typename-prefix', rule, { +ruleTester.run('no-typename-prefix', rule, { valid: [ /* GraphQL */ ` type User { diff --git a/packages/plugin/tests/no-undefined-variables.spec.ts b/packages/plugin/tests/no-undefined-variables.spec.ts index 0ee9f4c4433..95de47b0b14 100644 --- a/packages/plugin/tests/no-undefined-variables.spec.ts +++ b/packages/plugin/tests/no-undefined-variables.spec.ts @@ -1,9 +1,8 @@ import { join } from 'node:path'; -import { GraphQLRuleTester, rules } from '../src'; +import { rules } from '../src'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-undefined-variables', rules['no-undefined-variables'], { +ruleTester.run('no-undefined-variables', rules['no-undefined-variables'], { valid: [], invalid: [ { diff --git a/packages/plugin/tests/no-unreachable-types.spec.ts b/packages/plugin/tests/no-unreachable-types.spec.ts index f9581c7d71f..52d562ea288 100644 --- a/packages/plugin/tests/no-unreachable-types.spec.ts +++ b/packages/plugin/tests/no-unreachable-types.spec.ts @@ -1,5 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule } from '../src/rules/no-unreachable-types'; +import { ruleTester } from './test-utils'; const useSchema = ( schema: string, @@ -10,9 +11,7 @@ const useSchema = ( }; }; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-unreachable-types', rule, { +ruleTester.run('no-unreachable-types', rule, { valid: [ useSchema(/* GraphQL */ ` scalar A diff --git a/packages/plugin/tests/no-unused-fields.spec.ts b/packages/plugin/tests/no-unused-fields.spec.ts index fa0fab6b032..3ce922792e3 100644 --- a/packages/plugin/tests/no-unused-fields.spec.ts +++ b/packages/plugin/tests/no-unused-fields.spec.ts @@ -1,5 +1,6 @@ -import { GraphQLRuleTester } from '../src'; import { rule } from '../src/rules/no-unused-fields'; +import { RuleTester } from '@theguild/eslint-rule-tester'; +import { DEFAULT_CONFIG } from './test-utils'; const SCHEMA = /* GraphQL */ ` type User { @@ -38,9 +39,15 @@ const SCHEMA = /* GraphQL */ ` } `; -const ruleTester = new GraphQLRuleTester({ schema: SCHEMA }); +const ruleTester = new RuleTester({ + ...DEFAULT_CONFIG, + parserOptions: { + ...DEFAULT_CONFIG.parserOptions, + schema: SCHEMA, + }, +}); -ruleTester.runGraphQLTests('no-unused-fields', rule, { +ruleTester.run('no-unused-fields', rule, { valid: [ { code: SCHEMA, diff --git a/packages/plugin/tests/no-unused-fragments.spec.ts b/packages/plugin/tests/no-unused-fragments.spec.ts index 447b5794b6a..9d2c273743e 100644 --- a/packages/plugin/tests/no-unused-fragments.spec.ts +++ b/packages/plugin/tests/no-unused-fragments.spec.ts @@ -1,9 +1,8 @@ import { join } from 'node:path'; -import { GraphQLRuleTester, rules } from '../src'; +import { rules } from '../src'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-unused-fragments', rules['no-unused-fragments'], { +ruleTester.run('no-unused-fragments', rules['no-unused-fragments'], { valid: [ { name: 'should find file with operation definition that import current fragment', diff --git a/packages/plugin/tests/no-unused-variables.spec.ts b/packages/plugin/tests/no-unused-variables.spec.ts index e4733e67b62..d7b4b8b6d3c 100644 --- a/packages/plugin/tests/no-unused-variables.spec.ts +++ b/packages/plugin/tests/no-unused-variables.spec.ts @@ -1,9 +1,8 @@ import { join } from 'node:path'; -import { GraphQLRuleTester, rules } from '../src'; +import { rules } from '../src'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('no-unused-variables', rules['no-unused-variables'], { +ruleTester.run('no-unused-variables', rules['no-unused-variables'], { valid: [ { filename: join(__dirname, 'mocks/no-unused-variables.gql'), diff --git a/packages/plugin/tests/possible-type-extension.spec.ts b/packages/plugin/tests/possible-type-extension.spec.ts index f2026d83665..5ac68d5072d 100644 --- a/packages/plugin/tests/possible-type-extension.spec.ts +++ b/packages/plugin/tests/possible-type-extension.spec.ts @@ -1,7 +1,6 @@ import { join } from 'node:path'; -import { GraphQLRuleTester, ParserOptions, rules } from '../src'; - -const ruleTester = new GraphQLRuleTester(); +import { ParserOptions, rules } from '../src'; +import { ruleTester } from './test-utils'; const useUserSchema = ( code: string, @@ -22,7 +21,7 @@ const useUserSchema = ( }; }; -ruleTester.runGraphQLTests('possible-type-extension', rules['possible-type-extension'], { +ruleTester.run('possible-type-extension', rules['possible-type-extension'], { valid: [ useUserSchema(/* GraphQL */ ` extend type User { diff --git a/packages/plugin/tests/relay-arguments.spec.ts b/packages/plugin/tests/relay-arguments.spec.ts index cd4ccb46667..9d161cf18b7 100644 --- a/packages/plugin/tests/relay-arguments.spec.ts +++ b/packages/plugin/tests/relay-arguments.spec.ts @@ -1,7 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/relay-arguments'; - -const ruleTester = new GraphQLRuleTester(); +import { ruleTester } from './test-utils'; function useSchema(code: string): { code: string; parserOptions: Pick } { return { @@ -16,7 +15,7 @@ function useSchema(code: string): { code: string; parserOptions: Pick('relay-arguments', rule, { +ruleTester.run('relay-arguments', rule, { valid: [ useSchema(/* GraphQL */ ` type User { diff --git a/packages/plugin/tests/relay-connection-types.spec.ts b/packages/plugin/tests/relay-connection-types.spec.ts index d1c74119ae9..a988f0c4360 100644 --- a/packages/plugin/tests/relay-connection-types.spec.ts +++ b/packages/plugin/tests/relay-connection-types.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule } from '../src/rules/relay-connection-types'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('relay-connection-types', rule, { +ruleTester.run('relay-connection-types', rule, { valid: [ { name: 'follow Relay spec', diff --git a/packages/plugin/tests/relay-edge-types.spec.ts b/packages/plugin/tests/relay-edge-types.spec.ts index a6f9f203a3b..c43466e2718 100644 --- a/packages/plugin/tests/relay-edge-types.spec.ts +++ b/packages/plugin/tests/relay-edge-types.spec.ts @@ -1,7 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/relay-edge-types'; - -const ruleTester = new GraphQLRuleTester(); +import { ruleTester } from './test-utils'; function useSchema(code: string): { code: string; parserOptions: Pick } { return { @@ -12,7 +11,7 @@ function useSchema(code: string): { code: string; parserOptions: Pick('relay-edge-types', rule, { +ruleTester.run('relay-edge-types', rule, { valid: [ { name: 'when cursor returns string', diff --git a/packages/plugin/tests/relay-page-info.spec.ts b/packages/plugin/tests/relay-page-info.spec.ts index 07ddd00456d..3ae600eaf85 100644 --- a/packages/plugin/tests/relay-page-info.spec.ts +++ b/packages/plugin/tests/relay-page-info.spec.ts @@ -1,7 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule } from '../src/rules/relay-page-info'; - -const ruleTester = new GraphQLRuleTester(); +import { ruleTester } from './test-utils'; function useSchema(code: string): { code: string; parserOptions: Pick } { return { @@ -12,7 +11,7 @@ function useSchema(code: string): { code: string; parserOptions: Pick('require-deprecation-date', rule, { +ruleTester.run('require-deprecation-date', rule, { valid: [ 'type User { firstName: String }', `scalar Old @deprecated(deletionDate: "${tomorrow}")`, diff --git a/packages/plugin/tests/require-deprecation-reason.spec.ts b/packages/plugin/tests/require-deprecation-reason.spec.ts index 84f8dfbff58..6c2284b281c 100644 --- a/packages/plugin/tests/require-deprecation-reason.spec.ts +++ b/packages/plugin/tests/require-deprecation-reason.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule } from '../src/rules/require-deprecation-reason'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('require-deprecation-reason', rule, { +ruleTester.run('require-deprecation-reason', rule, { valid: [ /* GraphQL */ ` query getUser { diff --git a/packages/plugin/tests/require-description.spec.ts b/packages/plugin/tests/require-description.spec.ts index 076cfe819e0..10f126d8b91 100644 --- a/packages/plugin/tests/require-description.spec.ts +++ b/packages/plugin/tests/require-description.spec.ts @@ -1,10 +1,10 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule, RuleOptions, RULE_ID } from '../src/rules/require-description'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); const OPERATION = { OperationDefinition: true }; -ruleTester.runGraphQLTests('require-description', rule, { +ruleTester.run('require-description', rule, { valid: [ { code: /* GraphQL */ ` 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 b74bda23239..df6c0440f34 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,5 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule } from '../src/rules/require-field-of-type-query-in-mutation-result'; +import { ruleTester } from './test-utils'; const useSchema = ( code: string, @@ -16,9 +17,7 @@ const useSchema = ( }, }); -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('require-field-of-type-query-in-mutation-result', rule, { +ruleTester.run('require-field-of-type-query-in-mutation-result', rule, { valid: [ useSchema(/* GraphQL */ ` type Query { diff --git a/packages/plugin/tests/require-id-when-available.spec.ts b/packages/plugin/tests/require-id-when-available.spec.ts index 8099b914c0f..9d8498744cc 100644 --- a/packages/plugin/tests/require-id-when-available.spec.ts +++ b/packages/plugin/tests/require-id-when-available.spec.ts @@ -1,5 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/require-id-when-available'; +import { ruleTester } from './test-utils'; const TEST_SCHEMA = /* GraphQL */ ` type Query { @@ -66,7 +67,6 @@ const WITH_SCHEMA = { } as ParserOptions, }; -const ruleTester = new GraphQLRuleTester(); const MESSAGE_ID = { messageId: 'require-id-when-available' }; const DOCUMENT_WITH_UNION = /* GraphQL */ ` @@ -79,7 +79,7 @@ const DOCUMENT_WITH_UNION = /* GraphQL */ ` } `; -ruleTester.runGraphQLTests('require-id-when-available', rule, { +ruleTester.run('require-id-when-available', rule, { valid: [ { name: 'should completely ignore FragmentDefinition', diff --git a/packages/plugin/tests/require-import-fragment.spec.ts b/packages/plugin/tests/require-import-fragment.spec.ts index 4a09f908372..b06976db197 100644 --- a/packages/plugin/tests/require-import-fragment.spec.ts +++ b/packages/plugin/tests/require-import-fragment.spec.ts @@ -1,10 +1,9 @@ import { join } from 'node:path'; -import { GraphQLInvalidTestCase, GraphQLRuleTester } from '../src'; +import { GraphQLInvalidTestCase } from '../src'; import { rule } from '../src/rules/require-import-fragment'; import { Linter } from 'eslint'; import ParserOptions = Linter.ParserOptions; - -const ruleTester = new GraphQLRuleTester(); +import { ruleTester } from './test-utils'; function withMocks({ name, @@ -38,7 +37,7 @@ function withMocks({ }; } -ruleTester.runGraphQLTests('require-import-fragment', rule, { +ruleTester.run('require-import-fragment', rule, { valid: [ withMocks({ name: 'should not report with named import', diff --git a/packages/plugin/tests/require-nullable-fields-with-oneof.spec.ts b/packages/plugin/tests/require-nullable-fields-with-oneof.spec.ts index fbc77d33774..1e64c9465dd 100644 --- a/packages/plugin/tests/require-nullable-fields-with-oneof.spec.ts +++ b/packages/plugin/tests/require-nullable-fields-with-oneof.spec.ts @@ -1,9 +1,7 @@ -import { GraphQLRuleTester } from '../src'; import { rule } from '../src/rules/require-nullable-fields-with-oneof'; +import { ruleTester } from './test-utils'; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('require-nullable-fields-with-oneof', rule, { +ruleTester.run('require-nullable-fields-with-oneof', rule, { valid: [ /* GraphQL */ ` input Input @oneOf { 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 cdd0d55aff6..6748d750275 100644 --- a/packages/plugin/tests/require-nullable-result-in-root.spec.ts +++ b/packages/plugin/tests/require-nullable-result-in-root.spec.ts @@ -1,7 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule } from '../src/rules/require-nullable-result-in-root'; - -const ruleTester = new GraphQLRuleTester(); +import { ruleTester } from './test-utils'; function useSchema(code: string): { code: string; parserOptions: Omit } { return { @@ -10,7 +9,7 @@ function useSchema(code: string): { code: string; parserOptions: Omit { const SCHEMA_GRAPHQL_PATH = path.resolve(__dirname, 'mocks/user-schema.graphql'); @@ -57,7 +58,7 @@ directive @specifiedBy( beforeAll( () => new Promise(resolve => { - const tsNodeCommand = path.resolve(process.cwd(), 'node_modules/.bin/tsx'); + const tsNodeCommand = path.resolve(CWD, '..', '..', 'node_modules', '.bin', 'tsx'); const serverPath = path.resolve(__dirname, 'mocks/graphql-server.ts'); // Import `TestGraphQLServer` and run it in this file will don't work diff --git a/packages/plugin/tests/selection-set-depth.spec.ts b/packages/plugin/tests/selection-set-depth.spec.ts index 5ff345178be..d130d3664de 100644 --- a/packages/plugin/tests/selection-set-depth.spec.ts +++ b/packages/plugin/tests/selection-set-depth.spec.ts @@ -1,5 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/selection-set-depth'; +import { ruleTester } from './test-utils'; const WITH_SIBLINGS = { parserOptions: { @@ -7,9 +8,7 @@ const WITH_SIBLINGS = { } as ParserOptions, }; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('selection-set-depth', rule, { +ruleTester.run('selection-set-depth', rule, { valid: [ { options: [{ maxDepth: 2 }], diff --git a/packages/plugin/tests/strict-id-in-types.spec.ts b/packages/plugin/tests/strict-id-in-types.spec.ts index afbf212a1ef..131e2f4143d 100644 --- a/packages/plugin/tests/strict-id-in-types.spec.ts +++ b/packages/plugin/tests/strict-id-in-types.spec.ts @@ -1,7 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule, RuleOptions } from '../src/rules/strict-id-in-types'; - -const ruleTester = new GraphQLRuleTester(); +import { ruleTester } from './test-utils'; function useSchema(code: string): { code: string; parserOptions: Pick } { return { @@ -12,7 +11,7 @@ function useSchema(code: string): { code: string; parserOptions: Pick('strict-id-in-types', rule, { +ruleTester.run('strict-id-in-types', rule, { valid: [ useSchema('type A { id: ID! }'), { diff --git a/packages/plugin/tests/test-utils.ts b/packages/plugin/tests/test-utils.ts new file mode 100644 index 00000000000..ba9eb412c54 --- /dev/null +++ b/packages/plugin/tests/test-utils.ts @@ -0,0 +1,10 @@ +import { RuleTester } from '@theguild/eslint-rule-tester'; + +export const DEFAULT_CONFIG = { + parser: require.resolve('@graphql-eslint/eslint-plugin'), + parserOptions: { + skipGraphQLConfig: true, + }, +}; + +export const ruleTester = new RuleTester(DEFAULT_CONFIG); diff --git a/packages/plugin/tests/unique-fragment-name.spec.ts b/packages/plugin/tests/unique-fragment-name.spec.ts index dd4a036ca81..7697cd44efe 100644 --- a/packages/plugin/tests/unique-fragment-name.spec.ts +++ b/packages/plugin/tests/unique-fragment-name.spec.ts @@ -1,6 +1,7 @@ import { join } from 'node:path'; -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule } from '../src/rules/unique-fragment-name'; +import { ruleTester } from './test-utils'; const TEST_FRAGMENT = /* GraphQL */ ` fragment HasIdFields on HasId { @@ -16,9 +17,7 @@ const SIBLING_FRAGMENTS = ( }, }); -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('unique-fragment-name', rule, { +ruleTester.run('unique-fragment-name', rule, { valid: [ { ...SIBLING_FRAGMENTS(TEST_FRAGMENT), diff --git a/packages/plugin/tests/unique-operation-name.spec.ts b/packages/plugin/tests/unique-operation-name.spec.ts index 58008d4b34c..fe745d2f4e5 100644 --- a/packages/plugin/tests/unique-operation-name.spec.ts +++ b/packages/plugin/tests/unique-operation-name.spec.ts @@ -1,6 +1,7 @@ import { join } from 'node:path'; -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { rule } from '../src/rules/unique-operation-name'; +import { ruleTester } from './test-utils'; const TEST_OPERATION = 'query test { foo }'; @@ -12,9 +13,7 @@ const SIBLING_OPERATIONS = ( }, }); -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('unique-operation-name', rule, { +ruleTester.run('unique-operation-name', rule, { valid: [ { ...SIBLING_OPERATIONS(TEST_OPERATION), diff --git a/packages/plugin/tests/unique-type-names.spec.ts b/packages/plugin/tests/unique-type-names.spec.ts index a82b4667afc..5725b8974d3 100644 --- a/packages/plugin/tests/unique-type-names.spec.ts +++ b/packages/plugin/tests/unique-type-names.spec.ts @@ -1,5 +1,6 @@ -import { GraphQLRuleTester, ParserOptions } from '../src'; +import { ParserOptions } from '../src'; import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation'; +import { ruleTester } from './test-utils'; const TEST_SCHEMA = /* GraphQL */ ` type Query { @@ -15,9 +16,7 @@ const WITH_SCHEMA = { } as ParserOptions, }; -const ruleTester = new GraphQLRuleTester(); - -ruleTester.runGraphQLTests('unique-type-names', GRAPHQL_JS_VALIDATIONS['unique-type-names'], { +ruleTester.run('unique-type-names', GRAPHQL_JS_VALIDATIONS['unique-type-names'], { valid: [ { ...WITH_SCHEMA, code: TEST_SCHEMA }, { diff --git a/packages/plugin/tsup.config.ts b/packages/plugin/tsup.config.ts index af23aa38bf1..834f5cb39c9 100644 --- a/packages/plugin/tsup.config.ts +++ b/packages/plugin/tsup.config.ts @@ -38,11 +38,7 @@ export default defineConfig([ 2, ).replaceAll('dist/', ''), ); - addCreateRequireBanner([ - 'estree-converter/utils.js', - 'rules/graphql-js-validation.js', - 'testkit.js', - ]); + addCreateRequireBanner(['estree-converter/utils.js', 'rules/graphql-js-validation.js']); console.log('✅ Success!'); }, }, diff --git a/vite.config.ts b/packages/plugin/vite.config.ts similarity index 80% rename from vite.config.ts rename to packages/plugin/vite.config.ts index ea843fba4ed..06f7afe2ad5 100644 --- a/vite.config.ts +++ b/packages/plugin/vite.config.ts @@ -7,7 +7,7 @@ export default defineConfig({ testPath.replace('tests/', 'tests/__snapshots__/').replace(/\.ts$/, '.md'), setupFiles: ['./serializer.ts'], alias: { - '@graphql-eslint/eslint-plugin': 'packages/plugin/src/index.ts', + '@graphql-eslint/eslint-plugin': 'src/index.ts', }, }, }); diff --git a/packages/rule-tester/package.json b/packages/rule-tester/package.json new file mode 100644 index 00000000000..a0418e48b4b --- /dev/null +++ b/packages/rule-tester/package.json @@ -0,0 +1,30 @@ +{ + "name": "@theguild/eslint-rule-tester", + "version": "0.0.0", + "type": "module", + "private": true, + "engines": { + "node": ">=18" + }, + "exports": { + ".": "./dist/index.js", + "./package.json": "./package.json" + }, + "types": "./dist/index.d.ts", + "scripts": { + "build": "tsup", + "dev": "tsup --watch", + "typecheck": "tsc --noEmit" + }, + "peerDependencies": { + "eslint": "^8.46.0" + }, + "dependencies": { + "@babel/code-frame": "^7.18.6" + }, + "devDependencies": { + "@types/babel__code-frame": "7.0.3", + "@types/node": "18.17.1", + "eslint": "^8.46.0" + } +} diff --git a/packages/rule-tester/src/index.ts b/packages/rule-tester/src/index.ts new file mode 100644 index 00000000000..47a3579e670 --- /dev/null +++ b/packages/rule-tester/src/index.ts @@ -0,0 +1,153 @@ +import { readFileSync } from 'node:fs'; +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'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +type ValidTestCase> = Omit< + ESLintRuleTester.ValidTestCase, + 'options' | 'parserOptions' +> & { + options?: Options; + parserOptions?: ParserOptions; +}; + +function indentCode(code: string, indent = 4): string { + return code.replace(/^/gm, ' '.repeat(indent)); +} + +// A simple version of `SourceCodeFixer.applyFixes` +// https://github.com/eslint/eslint/issues/14936#issuecomment-906746754 +function applyFix(code: string, { range, text }: Rule.Fix): string { + return [code.slice(0, range[0]), text, code.slice(range[1])].join(''); +} + +export class RuleTester extends ESLintRuleTester { + fromMockFile(path: string): string { + return readFileSync(resolve(__dirname, `../../plugin/tests/mocks/${path}`), 'utf-8'); + } + + // @ts-expect-error -- fix later + run( + ruleId: string, + rule: Rule.RuleModule, + tests: { + valid: (string | ValidTestCase)[]; + invalid: (ValidTestCase & + Pick)[]; + }, + ): void { + // @ts-expect-error -- fix later + const { testerConfig, linter } = this; + + const getMessages = (testCase: ESLintRuleTester.InvalidTestCase) => { + const { options, code: rawCode, filename, parserOptions } = testCase; + + const config = { + parser: testerConfig.parser, + parserOptions: { + ...testerConfig.parserOptions, + ...parserOptions, + }, + rules: { + [ruleId]: Array.isArray(options) ? ['error', ...options] : 'error', + }, + }; + + const code = removeTrailingBlankLines(rawCode); + const codeFrame = indentCode(printCode(code, { line: 0, column: 0 })); + const messageForSnapshot = ['#### ⌨️ Code', codeFrame]; + + if (options) { + 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( + printWithIndex('#### ❌ Error', index, messages.length), + indentCode(codeWithMessage), + ); + + // Don't print suggestions in snapshots for too big codes + if (message.suggestions && (code.match(/\n/g) || '').length < 1000) { + for (const [i, suggestion] of message.suggestions.entries()) { + const title = printWithIndex( + '#### 💡 Suggestion', + i, + message.suggestions.length, + suggestion.desc, + ); + const output = applyFix(code, suggestion.fix); + const codeFrame = printCode(output, { line: 0, column: 0 }); + messageForSnapshot.push(title, indentCode(codeFrame, 2)); + } + } + } + if (rule.meta!.fixable) { + const { fixed, output } = linter.verifyAndFix(code, config, filename); + if (fixed) { + messageForSnapshot.push('#### 🔧 Autofix output', indentCode(printCode(output))); + } + } + expect(messageForSnapshot.join('\n\n')).toMatchSnapshot(); + }; + + for (const [id, testCase] of tests.invalid.entries()) { + testCase.name ||= `Invalid #${id + 1}`; + Object.defineProperty(testCase, 'assertMessages', { + value: getMessages, + }); + } + + // @ts-expect-error -- fix later + super.run(ruleId, rule as any, tests); + } +} + +function removeTrailingBlankLines(text: string): string { + return text.replace(/^\s*\n/, '').trimEnd(); +} + +function printWithIndex(title: string, index: number, total: number, description?: string): string { + if (total > 1) { + title += ` ${index + 1}/${total}`; + } + if (description) { + title += `: ${description}`; + } + return title; +} + +function printCode( + code: string, + result: Partial = {}, + linesOffset = Number.POSITIVE_INFINITY, +): string { + const { line, column, endLine, endColumn, message } = result; + const location = {} as AST.SourceLocation; + + if (typeof line === 'number' && typeof column === 'number') { + location.start = { + line, + column, + }; + } + + if (typeof endLine === 'number' && typeof endColumn === 'number') { + location.end = { + line: endLine, + column: endColumn, + }; + } + + return codeFrameColumns(code, location, { + linesAbove: linesOffset, + linesBelow: linesOffset, + message, + }); +} diff --git a/packages/rule-tester/tsconfig.json b/packages/rule-tester/tsconfig.json new file mode 100644 index 00000000000..035651d7863 --- /dev/null +++ b/packages/rule-tester/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "node16", + "declaration": false, + "noEmit": true, + "esModuleInterop": true, + "strict": true, + "lib": ["ESNext"], + "types": ["vitest/globals"], + "resolveJsonModule": true + } +} diff --git a/packages/rule-tester/tsup.config.ts b/packages/rule-tester/tsup.config.ts new file mode 100644 index 00000000000..ca1c92809cf --- /dev/null +++ b/packages/rule-tester/tsup.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + name: 'eslint-rule-tester', + entry: ['src/*.ts'], + clean: true, + format: 'esm', + dts: true, +}); diff --git a/patches/eslint@8.31.0.patch b/patches/eslint@8.31.0.patch deleted file mode 100644 index 3ce101a2e77..00000000000 --- a/patches/eslint@8.31.0.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/lib/linter/linter.js b/lib/linter/linter.js -index a29ce92..a574871 100644 ---- a/lib/linter/linter.js -+++ b/lib/linter/linter.js -@@ -41,7 +41,8 @@ const { getRuleFromConfig } = require("../config/flat-config-helpers"); - const { FlatConfigArray } = require("../config/flat-config-array"); - - const debug = require("debug")("eslint:linter"); --const MAX_AUTOFIX_PASSES = 10; -+// 🚨 10 is not enough for alphabetize test with definitions sorting -+const MAX_AUTOFIX_PASSES = 20; - const DEFAULT_PARSER_NAME = "espree"; - const DEFAULT_ECMA_VERSION = 5; - const commentParser = new ConfigCommentParser(); -diff --git a/lib/rule-tester/rule-tester.js b/lib/rule-tester/rule-tester.js -index 2af272b..738f80f 100644 ---- a/lib/rule-tester/rule-tester.js -+++ b/lib/rule-tester/rule-tester.js -@@ -1005,11 +1005,12 @@ class RuleTester { - assert.strictEqual(result.output, item.output, "Output is incorrect."); - } - } else { -- assert.strictEqual( -- result.output, -- item.code, -- "The rule fixed the code. Please add 'output' property." -- ); -+ // 🚨 Don't need, as we assert autofix output with snapshots -+ // assert.strictEqual( -+ // result.output, -+ // item.code, -+ // "The rule fixed the code. Please add 'output' property." -+ // ); - } - - assertASTDidntChange(result.beforeAST, result.afterAST); diff --git a/patches/eslint@8.46.0.patch b/patches/eslint@8.46.0.patch new file mode 100644 index 00000000000..62e9c72f67d --- /dev/null +++ b/patches/eslint@8.46.0.patch @@ -0,0 +1,51 @@ +diff --git a/lib/linter/linter.js b/lib/linter/linter.js +index 233cbed5b5ccdf89806df9786a0902a317dd451e..7db8fa9c1fca4183460164ca1fd8fa0a3c9e6206 100644 +--- a/lib/linter/linter.js ++++ b/lib/linter/linter.js +@@ -44,7 +44,8 @@ const { getRuleFromConfig } = require("../config/flat-config-helpers"); + const { FlatConfigArray } = require("../config/flat-config-array"); + + const debug = require("debug")("eslint:linter"); +-const MAX_AUTOFIX_PASSES = 10; ++// 🚨 10 is not enough for alphabetize test with definitions sorting ++const MAX_AUTOFIX_PASSES = 20; + const DEFAULT_PARSER_NAME = "espree"; + const DEFAULT_ECMA_VERSION = 5; + const commentParser = new ConfigCommentParser(); +diff --git a/lib/rule-tester/flat-rule-tester.js b/lib/rule-tester/flat-rule-tester.js +index f143873f7bc76737acc5ff00871e462ef058bf4b..a0b6283b653a9f9cd478711c34bbf4a07ad9008f 100644 +--- a/lib/rule-tester/flat-rule-tester.js ++++ b/lib/rule-tester/flat-rule-tester.js +@@ -998,11 +998,7 @@ class FlatRuleTester { + assert.strictEqual(result.output, item.output, "Output is incorrect."); + } + } else { +- assert.strictEqual( +- result.output, +- item.code, +- "The rule fixed the code. Please add 'output' property." +- ); ++ // 🚨 Don't need, as we assert autofix output with snapshots + } + + assertASTDidntChange(result.beforeAST, result.afterAST); +diff --git a/lib/rule-tester/rule-tester.js b/lib/rule-tester/rule-tester.js +index e4dc126783c8232a67268c72def615829c4508b9..6e1de73fd06e8bfec07e14c8779b050959f3add4 100644 +--- a/lib/rule-tester/rule-tester.js ++++ b/lib/rule-tester/rule-tester.js +@@ -1008,13 +1008,10 @@ class RuleTester { + assert.strictEqual(result.output, item.output, "Output is incorrect."); + } + } else { +- assert.strictEqual( +- result.output, +- item.code, +- "The rule fixed the code. Please add 'output' property." +- ); ++ // 🚨 Don't need, as we assert autofix output with snapshots + } + ++ item.assertMessages(item) + assertASTDidntChange(result.beforeAST, result.afterAST); + } + \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 126f0d0b8bb..0e80e8913ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,9 @@ patchedDependencies: eslint-plugin-eslint-plugin@5.0.7: hash: cdhdgvmsbh3fbusrlxsl6de2he path: patches/eslint-plugin-eslint-plugin@5.0.6.patch - eslint@8.44.0: - hash: v7lv2hbnxmm2b22qo3sob3rjvq - path: patches/eslint@8.31.0.patch + eslint@8.46.0: + hash: 7xckwst2ekw7c3pf6pfwcsuiwu + path: patches/eslint@8.46.0.patch json-schema-to-markdown@1.1.1: hash: beglqnggvhpsclgwbdw27hzvu4 path: patches/json-schema-to-markdown@1.1.1.patch @@ -36,7 +36,7 @@ importers: version: 9.2.1(graphql@16.7.1) '@theguild/eslint-config': specifier: 0.11.0 - version: 0.11.0(eslint@8.44.0)(typescript@5.1.6) + version: 0.11.0(eslint@8.46.0)(typescript@5.1.6) '@theguild/prettier-config': specifier: 1.2.0 version: 1.2.0(prettier@2.8.8) @@ -59,11 +59,11 @@ importers: specifier: 2.4.1 version: 2.4.1 eslint: - specifier: 8.44.0 - version: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) eslint-plugin-eslint-plugin: specifier: 5.0.7 - version: 5.0.7(patch_hash=cdhdgvmsbh3fbusrlxsl6de2he)(eslint@8.44.0) + version: 5.0.7(patch_hash=cdhdgvmsbh3fbusrlxsl6de2he)(eslint@8.46.0) eslint-plugin-tailwindcss: specifier: 3.13.0 version: 3.13.0(tailwindcss@3.3.3) @@ -91,6 +91,9 @@ importers: tsx: specifier: 3.12.7 version: 3.12.7 + turbo: + specifier: ^1.10.12 + version: 1.10.12 typescript: specifier: 5.1.6 version: 5.1.6 @@ -111,8 +114,8 @@ importers: specifier: workspace:* version: link:../../packages/plugin/dist eslint: - specifier: 8.38.0 - version: 8.38.0 + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) examples/code-file: dependencies: @@ -127,8 +130,8 @@ importers: specifier: workspace:* version: link:../../packages/plugin/dist eslint: - specifier: 8.38.0 - version: 8.38.0 + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) examples/graphql-config: dependencies: @@ -143,8 +146,8 @@ importers: specifier: workspace:* version: link:../../packages/plugin/dist eslint: - specifier: 8.38.0 - version: 8.38.0 + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) examples/graphql-config-code-file: dependencies: @@ -162,8 +165,8 @@ importers: specifier: workspace:* version: link:../../packages/plugin/dist eslint: - specifier: 8.38.0 - version: 8.38.0 + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) examples/monorepo: dependencies: @@ -178,8 +181,8 @@ importers: specifier: workspace:* version: link:../../packages/plugin/dist eslint: - specifier: 8.38.0 - version: 8.38.0 + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) examples/multiple-projects-graphql-config: dependencies: @@ -194,8 +197,8 @@ importers: specifier: 5.0.0 version: 5.0.0(@types/node@18.17.1)(cosmiconfig@8.2.0)(typescript@5.1.6) eslint: - specifier: 8.38.0 - version: 8.38.0 + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) ts-node: specifier: 10.9.1 version: 10.9.1(@types/node@18.17.1)(typescript@5.1.6) @@ -216,14 +219,14 @@ importers: specifier: workspace:* version: link:../../packages/plugin/dist eslint: - specifier: 8.38.0 - version: 8.38.0 + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) eslint-config-prettier: specifier: 8.9.0 - version: 8.9.0(eslint@8.38.0) + version: 8.9.0(eslint@8.46.0) eslint-plugin-prettier: specifier: 4.2.1 - version: 4.2.1(eslint-config-prettier@8.9.0)(eslint@8.38.0)(prettier@2.8.8) + version: 4.2.1(eslint-config-prettier@8.9.0)(eslint@8.46.0)(prettier@2.8.8) prettier: specifier: 2.8.8 version: 2.8.8 @@ -238,8 +241,8 @@ importers: specifier: workspace:* version: link:../../packages/plugin/dist eslint: - specifier: 8.38.0 - version: 8.38.0 + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) svelte: specifier: 4.1.2 version: 4.1.2 @@ -263,17 +266,14 @@ importers: specifier: 3.3.4 version: 3.3.4 eslint: - specifier: 8.38.0 - version: 8.38.0 + specifier: 8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) vue-eslint-parser: specifier: 9.3.1 - version: 9.3.1(eslint@8.38.0) + version: 9.3.1(eslint@8.46.0) packages/plugin: dependencies: - '@babel/code-frame': - specifier: ^7.18.6 - version: 7.18.6 '@graphql-tools/code-file-loader': specifier: ^7.3.6 version: 7.3.6(graphql@16.7.1) @@ -305,9 +305,9 @@ importers: specifier: ^2.4.1 version: 2.4.1 devDependencies: - '@types/babel__code-frame': - specifier: 7.0.3 - version: 7.0.3 + '@theguild/eslint-rule-tester': + specifier: workspace:* + version: link:../rule-tester '@types/debug': specifier: 4.1.8 version: 4.1.8 @@ -334,6 +334,22 @@ importers: version: 2.9.1 publishDirectory: dist + packages/rule-tester: + dependencies: + '@babel/code-frame': + specifier: ^7.18.6 + version: 7.18.6 + devDependencies: + '@types/babel__code-frame': + specifier: 7.0.3 + version: 7.0.3 + '@types/node': + specifier: 18.17.1 + version: 18.17.1 + eslint: + specifier: ^8.46.0 + version: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + website: dependencies: '@graphql-eslint/eslint-plugin': @@ -696,6 +712,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/highlight': 7.22.5 + dev: false /@babel/code-frame@7.22.5: resolution: {integrity: sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==} @@ -1509,23 +1526,13 @@ packages: dev: true optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.38.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.46.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.38.0 - eslint-visitor-keys: 3.4.2 - dev: true - - /@eslint-community/eslint-utils@4.4.0(eslint@8.44.0): - resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - dependencies: - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) eslint-visitor-keys: 3.4.2 dev: true @@ -1551,16 +1558,6 @@ packages: - supports-color dev: true - /@eslint/js@8.38.0: - resolution: {integrity: sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - - /@eslint/js@8.44.0: - resolution: {integrity: sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - /@eslint/js@8.46.0: resolution: {integrity: sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2921,28 +2918,28 @@ packages: - webpack dev: false - /@theguild/eslint-config@0.11.0(eslint@8.44.0)(typescript@5.1.6): + /@theguild/eslint-config@0.11.0(eslint@8.46.0)(typescript@5.1.6): resolution: {integrity: sha512-dxKcEb0uKZvkKBp9KwcKe/npuHZw789vrQPUJGJksz9ghjvAQOc9Kx4PMJTTrVWOzg/1lzFB9s070V9yviYkHg==} peerDependencies: eslint: ^8.24.0 dependencies: '@rushstack/eslint-patch': 1.3.2 - '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.44.0)(typescript@5.1.6) - '@typescript-eslint/parser': 5.62.0(eslint@8.44.0)(typescript@5.1.6) - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) - eslint-config-prettier: 8.9.0(eslint@8.44.0) - eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.28.0)(eslint@8.44.0) - eslint-plugin-import: 2.28.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.44.0) - eslint-plugin-jsonc: 2.9.0(eslint@8.44.0) - eslint-plugin-jsx-a11y: 6.7.1(eslint@8.44.0) - eslint-plugin-mdx: 2.1.0(eslint@8.44.0) - eslint-plugin-n: 16.0.1(eslint@8.44.0) - eslint-plugin-promise: 6.1.1(eslint@8.44.0) - eslint-plugin-react: 7.33.1(eslint@8.44.0) - eslint-plugin-react-hooks: 4.6.0(eslint@8.44.0) - eslint-plugin-sonarjs: 0.19.0(eslint@8.44.0) - eslint-plugin-unicorn: 47.0.0(eslint@8.44.0) - eslint-plugin-yml: 1.8.0(eslint@8.44.0) + '@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-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) + eslint-plugin-jsonc: 2.9.0(eslint@8.46.0) + eslint-plugin-jsx-a11y: 6.7.1(eslint@8.46.0) + eslint-plugin-mdx: 2.1.0(eslint@8.46.0) + eslint-plugin-n: 16.0.1(eslint@8.46.0) + eslint-plugin-promise: 6.1.1(eslint@8.46.0) + eslint-plugin-react: 7.33.1(eslint@8.46.0) + eslint-plugin-react-hooks: 4.6.0(eslint@8.46.0) + eslint-plugin-sonarjs: 0.19.0(eslint@8.46.0) + eslint-plugin-unicorn: 47.0.0(eslint@8.46.0) + eslint-plugin-yml: 1.8.0(eslint@8.46.0) transitivePeerDependencies: - eslint-import-resolver-node - eslint-import-resolver-webpack @@ -3202,7 +3199,7 @@ packages: '@types/node': 18.17.1 dev: false - /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.44.0)(typescript@5.1.6): + /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.46.0)(typescript@5.1.6): resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3214,12 +3211,12 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.6.2 - '@typescript-eslint/parser': 5.62.0(eslint@8.44.0)(typescript@5.1.6) + '@typescript-eslint/parser': 5.62.0(eslint@8.46.0)(typescript@5.1.6) '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/type-utils': 5.62.0(eslint@8.44.0)(typescript@5.1.6) - '@typescript-eslint/utils': 5.62.0(eslint@8.44.0)(typescript@5.1.6) + '@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.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) graphemer: 1.4.0 ignore: 5.2.4 natural-compare-lite: 1.4.0 @@ -3230,7 +3227,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@5.62.0(eslint@8.44.0)(typescript@5.1.6): + /@typescript-eslint/parser@5.62.0(eslint@8.46.0)(typescript@5.1.6): resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3244,7 +3241,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.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) typescript: 5.1.6 transitivePeerDependencies: - supports-color @@ -3258,7 +3255,7 @@ packages: '@typescript-eslint/visitor-keys': 5.62.0 dev: true - /@typescript-eslint/type-utils@5.62.0(eslint@8.44.0)(typescript@5.1.6): + /@typescript-eslint/type-utils@5.62.0(eslint@8.46.0)(typescript@5.1.6): resolution: {integrity: sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -3269,9 +3266,9 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.1.6) - '@typescript-eslint/utils': 5.62.0(eslint@8.44.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.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) tsutils: 3.21.0(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: @@ -3304,19 +3301,19 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@5.62.0(eslint@8.44.0)(typescript@5.1.6): + /@typescript-eslint/utils@5.62.0(eslint@8.46.0)(typescript@5.1.6): resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.44.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) '@types/json-schema': 7.0.12 '@types/semver': 7.5.0 '@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.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) eslint-scope: 5.1.1 semver: 7.5.4 transitivePeerDependencies: @@ -5767,22 +5764,13 @@ packages: engines: {node: '>=12'} dev: false - /eslint-config-prettier@8.9.0(eslint@8.38.0): + /eslint-config-prettier@8.9.0(eslint@8.46.0): resolution: {integrity: sha512-+sbni7NfVXnOpnRadUA8S28AUlsZt9GjgFvABIRL9Hkn8KqNzOp+7Lw4QWtrwn20KzU3wqu1QoOj2m+7rKRqkA==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.38.0 - dev: true - - /eslint-config-prettier@8.9.0(eslint@8.44.0): - resolution: {integrity: sha512-+sbni7NfVXnOpnRadUA8S28AUlsZt9GjgFvABIRL9Hkn8KqNzOp+7Lw4QWtrwn20KzU3wqu1QoOj2m+7rKRqkA==} - hasBin: true - peerDependencies: - eslint: '>=7.0.0' - dependencies: - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) dev: true /eslint-import-resolver-node@0.3.7: @@ -5795,7 +5783,7 @@ packages: - supports-color dev: true - /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.28.0)(eslint@8.44.0): + /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.28.0)(eslint@8.46.0): resolution: {integrity: sha512-TdJqPHs2lW5J9Zpe17DZNQuDnox4xo2o+0tE7Pggain9Rbc19ik8kFtXdxZ250FVx2kF4vlt2RSf4qlUpG7bhw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -5804,9 +5792,9 @@ packages: dependencies: debug: 4.3.4 enhanced-resolve: 5.15.0 - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) - 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.44.0) - eslint-plugin-import: 2.28.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.44.0) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + 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 globby: 13.2.2 is-core-module: 2.12.1 @@ -5819,7 +5807,7 @@ packages: - supports-color dev: true - /eslint-mdx@2.1.0(eslint@8.44.0): + /eslint-mdx@2.1.0(eslint@8.46.0): resolution: {integrity: sha512-dVLHDcpCFJRXZhxEQx8nKc68KT1qm+9JOeMD+j1/WW2h+oco1j7Qq+CLrX2kP64LI3fF9TUtj7a0AvncHUME6w==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} peerDependencies: @@ -5827,7 +5815,7 @@ packages: dependencies: acorn: 8.10.0 acorn-jsx: 5.3.2(acorn@8.10.0) - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) espree: 9.6.1 estree-util-visit: 1.2.1 remark-mdx: 2.3.0 @@ -5844,7 +5832,7 @@ packages: - supports-color dev: true - /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.44.0): + /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): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -5865,39 +5853,39 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.44.0)(typescript@5.1.6) + '@typescript-eslint/parser': 5.62.0(eslint@8.46.0)(typescript@5.1.6) debug: 3.2.7 - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) 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.44.0) + eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.62.0)(eslint-plugin-import@2.28.0)(eslint@8.46.0) transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-es-x@7.2.0(eslint@8.44.0): + /eslint-plugin-es-x@7.2.0(eslint@8.46.0): resolution: {integrity: sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: eslint: '>=8' dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.44.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) '@eslint-community/regexpp': 4.6.2 - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) dev: true - /eslint-plugin-eslint-plugin@5.0.7(patch_hash=cdhdgvmsbh3fbusrlxsl6de2he)(eslint@8.44.0): + /eslint-plugin-eslint-plugin@5.0.7(patch_hash=cdhdgvmsbh3fbusrlxsl6de2he)(eslint@8.46.0): resolution: {integrity: sha512-hcz4Bze1ECwv3Q/Bi/ZMZZNiuvI2YclNuxjnczkblQ0skrlPhdO83rSM7felf5n+7ZJOZi4GS8y8gNiRtvI0hA==} engines: {node: ^14.17.0 || ^16.0.0 || >= 18.0.0} peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) - eslint-utils: 3.0.0(eslint@8.44.0) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint-utils: 3.0.0(eslint@8.46.0) estraverse: 5.3.0 dev: true patched: true - /eslint-plugin-import@2.28.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.44.0): + /eslint-plugin-import@2.28.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.46.0): resolution: {integrity: sha512-B8s/n+ZluN7sxj9eUf7/pRFERX0r5bnFA2dCaLHy2ZeaQEAz0k+ZZkFWRFHJAqxfxQDx6KLv9LeIki7cFdwW+Q==} engines: {node: '>=4'} peerDependencies: @@ -5907,16 +5895,16 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.44.0)(typescript@5.1.6) + '@typescript-eslint/parser': 5.62.0(eslint@8.46.0)(typescript@5.1.6) array-includes: 3.1.6 array.prototype.findlastindex: 1.2.2 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 debug: 3.2.7 doctrine: 2.1.0 - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) 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.44.0) + 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 is-core-module: 2.12.1 is-glob: 4.0.3 @@ -5933,19 +5921,19 @@ packages: - supports-color dev: true - /eslint-plugin-jsonc@2.9.0(eslint@8.44.0): + /eslint-plugin-jsonc@2.9.0(eslint@8.46.0): resolution: {integrity: sha512-RK+LeONVukbLwT2+t7/OY54NJRccTXh/QbnXzPuTLpFMVZhPuq1C9E07+qWenGx7rrQl0kAalAWl7EmB+RjpGA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.44.0) - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) jsonc-eslint-parser: 2.3.0 natural-compare: 1.4.0 dev: true - /eslint-plugin-jsx-a11y@6.7.1(eslint@8.44.0): + /eslint-plugin-jsx-a11y@6.7.1(eslint@8.46.0): resolution: {integrity: sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==} engines: {node: '>=4.0'} peerDependencies: @@ -5960,7 +5948,7 @@ packages: axobject-query: 3.2.1 damerau-levenshtein: 1.0.8 emoji-regex: 9.2.2 - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) has: 1.0.3 jsx-ast-utils: 3.3.5 language-tags: 1.0.5 @@ -5970,27 +5958,27 @@ packages: semver: 6.3.1 dev: true - /eslint-plugin-markdown@3.0.1(eslint@8.44.0): + /eslint-plugin-markdown@3.0.1(eslint@8.46.0): resolution: {integrity: sha512-8rqoc148DWdGdmYF6WSQFT3uQ6PO7zXYgeBpHAOAakX/zpq+NvFYbDA/H7PYzHajwtmaOzAwfxyl++x0g1/N9A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) mdast-util-from-markdown: 0.8.5 transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-mdx@2.1.0(eslint@8.44.0): + /eslint-plugin-mdx@2.1.0(eslint@8.46.0): resolution: {integrity: sha512-Q8P1JXv+OrD+xhWT95ZyV30MMdnqJ1voKtXfxWrJJ2XihJRI15gPmXbIWY9t8CjA8C//isfzNOmnVY9e3GTL0g==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} peerDependencies: eslint: '>=8.0.0' dependencies: - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) - eslint-mdx: 2.1.0(eslint@8.44.0) - eslint-plugin-markdown: 3.0.1(eslint@8.44.0) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint-mdx: 2.1.0(eslint@8.46.0) + eslint-plugin-markdown: 3.0.1(eslint@8.46.0) remark-mdx: 2.3.0 remark-parse: 10.0.2 remark-stringify: 10.0.3 @@ -6001,16 +5989,16 @@ packages: - supports-color dev: true - /eslint-plugin-n@16.0.1(eslint@8.44.0): + /eslint-plugin-n@16.0.1(eslint@8.46.0): resolution: {integrity: sha512-CDmHegJN0OF3L5cz5tATH84RPQm9kG+Yx39wIqIwPR2C0uhBGMWfbbOtetR83PQjjidA5aXMu+LEFw1jaSwvTA==} engines: {node: '>=16.0.0'} peerDependencies: eslint: '>=7.0.0' dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.44.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) builtins: 5.0.1 - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) - eslint-plugin-es-x: 7.2.0(eslint@8.44.0) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint-plugin-es-x: 7.2.0(eslint@8.46.0) ignore: 5.2.4 is-core-module: 2.12.1 minimatch: 3.1.2 @@ -6018,7 +6006,7 @@ packages: semver: 7.5.4 dev: true - /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.9.0)(eslint@8.38.0)(prettier@2.8.8): + /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.9.0)(eslint@8.46.0)(prettier@2.8.8): resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} engines: {node: '>=12.0.0'} peerDependencies: @@ -6029,31 +6017,31 @@ packages: eslint-config-prettier: optional: true dependencies: - eslint: 8.38.0 - eslint-config-prettier: 8.9.0(eslint@8.38.0) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) + eslint-config-prettier: 8.9.0(eslint@8.46.0) prettier: 2.8.8 prettier-linter-helpers: 1.0.0 dev: true - /eslint-plugin-promise@6.1.1(eslint@8.44.0): + /eslint-plugin-promise@6.1.1(eslint@8.46.0): resolution: {integrity: sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) dev: true - /eslint-plugin-react-hooks@4.6.0(eslint@8.44.0): + /eslint-plugin-react-hooks@4.6.0(eslint@8.46.0): resolution: {integrity: sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==} engines: {node: '>=10'} peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 dependencies: - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) dev: true - /eslint-plugin-react@7.33.1(eslint@8.44.0): + /eslint-plugin-react@7.33.1(eslint@8.46.0): resolution: {integrity: sha512-L093k0WAMvr6VhNwReB8VgOq5s2LesZmrpPdKz/kZElQDzqS7G7+DnKoqT+w4JwuiGeAhAvHO0fvy0Eyk4ejDA==} engines: {node: '>=4'} peerDependencies: @@ -6063,7 +6051,7 @@ packages: array.prototype.flatmap: 1.3.1 array.prototype.tosorted: 1.1.1 doctrine: 2.1.0 - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) estraverse: 5.3.0 jsx-ast-utils: 3.3.5 minimatch: 3.1.2 @@ -6077,13 +6065,13 @@ packages: string.prototype.matchall: 4.0.8 dev: true - /eslint-plugin-sonarjs@0.19.0(eslint@8.44.0): + /eslint-plugin-sonarjs@0.19.0(eslint@8.46.0): resolution: {integrity: sha512-6+s5oNk5TFtVlbRxqZN7FIGmjdPCYQKaTzFPmqieCmsU1kBYDzndTeQav0xtQNwZJWu5awWfTGe8Srq9xFOGnw==} engines: {node: '>=14'} peerDependencies: eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) dev: true /eslint-plugin-tailwindcss@3.13.0(tailwindcss@3.3.3): @@ -6097,17 +6085,17 @@ packages: tailwindcss: 3.3.3 dev: true - /eslint-plugin-unicorn@47.0.0(eslint@8.44.0): + /eslint-plugin-unicorn@47.0.0(eslint@8.46.0): resolution: {integrity: sha512-ivB3bKk7fDIeWOUmmMm9o3Ax9zbMz1Bsza/R2qm46ufw4T6VBFBaJIR1uN3pCKSmSXm8/9Nri8V+iUut1NhQGA==} engines: {node: '>=16'} peerDependencies: eslint: '>=8.38.0' dependencies: '@babel/helper-validator-identifier': 7.22.5 - '@eslint-community/eslint-utils': 4.4.0(eslint@8.44.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) ci-info: 3.8.0 clean-regexp: 1.0.0 - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) esquery: 1.5.0 indent-string: 4.0.0 is-builtin-module: 3.2.1 @@ -6122,14 +6110,14 @@ packages: strip-indent: 3.0.0 dev: true - /eslint-plugin-yml@1.8.0(eslint@8.44.0): + /eslint-plugin-yml@1.8.0(eslint@8.46.0): resolution: {integrity: sha512-fgBiJvXD0P2IN7SARDJ2J7mx8t0bLdG6Zcig4ufOqW5hOvSiFxeUyc2g5I1uIm8AExbo26NNYCcTGZT0MXTsyg==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' dependencies: debug: 4.3.4 - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) lodash: 4.17.21 natural-compare: 1.4.0 yaml-eslint-parser: 1.2.2 @@ -6161,13 +6149,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils@3.0.0(eslint@8.44.0): + /eslint-utils@3.0.0(eslint@8.46.0): resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq) + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) eslint-visitor-keys: 2.1.0 dev: true @@ -6181,64 +6169,15 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.38.0: - resolution: {integrity: sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - hasBin: true - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.38.0) - '@eslint-community/regexpp': 4.6.2 - '@eslint/eslintrc': 2.1.1 - '@eslint/js': 8.38.0 - '@humanwhocodes/config-array': 0.11.10 - '@humanwhocodes/module-importer': 1.0.1 - '@nodelib/fs.walk': 1.2.8 - ajv: 6.12.6 - chalk: 4.1.2 - cross-spawn: 7.0.3 - debug: 4.3.4 - doctrine: 3.0.0 - escape-string-regexp: 4.0.0 - eslint-scope: 7.2.2 - eslint-visitor-keys: 3.4.2 - espree: 9.6.1 - esquery: 1.5.0 - esutils: 2.0.3 - fast-deep-equal: 3.1.3 - file-entry-cache: 6.0.1 - find-up: 5.0.0 - glob-parent: 6.0.2 - globals: 13.20.0 - grapheme-splitter: 1.0.4 - ignore: 5.2.4 - import-fresh: 3.3.0 - imurmurhash: 0.1.4 - is-glob: 4.0.3 - is-path-inside: 3.0.3 - js-sdsl: 4.4.2 - js-yaml: 4.1.0 - json-stable-stringify-without-jsonify: 1.0.1 - levn: 0.4.1 - lodash.merge: 4.6.2 - minimatch: 3.1.2 - natural-compare: 1.4.0 - optionator: 0.9.3 - strip-ansi: 6.0.1 - strip-json-comments: 3.1.1 - text-table: 0.2.0 - transitivePeerDependencies: - - supports-color - dev: true - - /eslint@8.44.0(patch_hash=v7lv2hbnxmm2b22qo3sob3rjvq): - resolution: {integrity: sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A==} + /eslint@8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu): + resolution: {integrity: sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.44.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.46.0) '@eslint-community/regexpp': 4.6.2 '@eslint/eslintrc': 2.1.1 - '@eslint/js': 8.44.0 + '@eslint/js': 8.46.0 '@humanwhocodes/config-array': 0.11.10 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 @@ -6260,7 +6199,6 @@ packages: globals: 13.20.0 graphemer: 1.4.0 ignore: 5.2.4 - import-fresh: 3.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 @@ -6272,7 +6210,6 @@ packages: natural-compare: 1.4.0 optionator: 0.9.3 strip-ansi: 6.0.1 - strip-json-comments: 3.1.1 text-table: 0.2.0 transitivePeerDependencies: - supports-color @@ -7863,10 +7800,6 @@ packages: engines: {node: '>=10'} dev: true - /js-sdsl@4.4.2: - resolution: {integrity: sha512-dwXFwByc/ajSV6m5bcKAPwe4yDDF6D614pxmIi5odytzxRlwqF6nwoiCek80Ixc7Cvma5awClxrzFtxCQvcM8w==} - dev: true - /js-string-escape@1.0.1: resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} engines: {node: '>= 0.8'} @@ -9750,7 +9683,7 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} dependencies: - '@babel/code-frame': 7.18.6 + '@babel/code-frame': 7.22.5 error-ex: 1.3.2 json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 @@ -12138,6 +12071,67 @@ packages: yargs: 17.7.2 dev: true + /turbo-darwin-64@1.10.12: + resolution: {integrity: sha512-vmDfGVPl5/aFenAbOj3eOx3ePNcWVUyZwYr7taRl0ZBbmv2TzjRiFotO4vrKCiTVnbqjQqAFQWY2ugbqCI1kOQ==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /turbo-darwin-arm64@1.10.12: + resolution: {integrity: sha512-3JliEESLNX2s7g54SOBqqkqJ7UhcOGkS0ywMr5SNuvF6kWVTbuUq7uBU/sVbGq8RwvK1ONlhPvJne5MUqBCTCQ==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /turbo-linux-64@1.10.12: + resolution: {integrity: sha512-siYhgeX0DidIfHSgCR95b8xPee9enKSOjCzx7EjTLmPqPaCiVebRYvbOIYdQWRqiaKh9yfhUtFmtMOMScUf1gg==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /turbo-linux-arm64@1.10.12: + resolution: {integrity: sha512-K/ZhvD9l4SslclaMkTiIrnfcACgos79YcAo4kwc8bnMQaKuUeRpM15sxLpZp3xDjDg8EY93vsKyjaOhdFG2UbA==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /turbo-windows-64@1.10.12: + resolution: {integrity: sha512-7FSgSwvktWDNOqV65l9AbZwcoueAILeE4L7JvjauNASAjjbuzXGCEq5uN8AQU3U5BOFj4TdXrVmO2dX+lLu8Zg==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /turbo-windows-arm64@1.10.12: + resolution: {integrity: sha512-gCNXF52dwom1HLY9ry/cneBPOKTBHhzpqhMylcyvJP0vp9zeMQQkt6yjYv+6QdnmELC92CtKNp2FsNZo+z0pyw==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /turbo@1.10.12: + resolution: {integrity: sha512-WM3+jTfQWnB9W208pmP4oeehZcC6JQNlydb/ZHMRrhmQa+htGhWLCzd6Q9rLe0MwZLPpSPFV2/bN5egCLyoKjQ==} + hasBin: true + requiresBuild: true + optionalDependencies: + turbo-darwin-64: 1.10.12 + turbo-darwin-arm64: 1.10.12 + turbo-linux-64: 1.10.12 + turbo-linux-arm64: 1.10.12 + turbo-windows-64: 1.10.12 + turbo-windows-arm64: 1.10.12 + dev: true + /type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -12772,14 +12766,14 @@ packages: resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==} dev: false - /vue-eslint-parser@9.3.1(eslint@8.38.0): + /vue-eslint-parser@9.3.1(eslint@8.46.0): resolution: {integrity: sha512-Clr85iD2XFZ3lJ52/ppmUDG/spxQu6+MAeHXjjyI4I1NUYZ9xmenQp4N0oaHJhrA8OOxltCVxMRfANGa70vU0g==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' dependencies: debug: 4.3.4 - eslint: 8.38.0 + eslint: 8.46.0(patch_hash=7xckwst2ekw7c3pf6pfwcsuiwu) eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.2 espree: 9.6.1 diff --git a/turbo.json b/turbo.json new file mode 100644 index 00000000000..72490ff6746 --- /dev/null +++ b/turbo.json @@ -0,0 +1,32 @@ +{ + "pipeline": { + "build": { + "outputs": ["dist/**"], + "dependsOn": [ + // Run `build` in workspaces I depend on first + "^build" + ] + }, + "dev": { + "dependsOn": [ + // Run `dev` in workspaces I depend on first + "^dev" + ], + // Never cache anything (including logs) emitted by a `dev` task + "cache": false, + "persistent": true + }, + "typecheck": { + "dependsOn": [ + // Run `build` in workspaces I depend on first + "^build" + ] + }, + "test": { + "dependsOn": [ + // A workspace's `test` command depends on its own `build` commands first being completed + "build" + ] + } + } +}