diff --git a/.prettierignore b/.prettierignore index d05a97bbc29..6bcb973bc78 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ packages/plugin/__tests__/__snapshots__/ +packages/plugin/src/rules/*/snapshot.md examples/prettier/invalid.graphql examples/prettier/invalid.js pnpm-lock.yaml diff --git a/packages/plugin/__tests__/eslint-directives.spec.ts b/packages/plugin/__tests__/eslint-directives.spec.ts index 96a35a477d6..dc290c129a2 100644 --- a/packages/plugin/__tests__/eslint-directives.spec.ts +++ b/packages/plugin/__tests__/eslint-directives.spec.ts @@ -1,6 +1,6 @@ import { join } from 'node:path'; -import { rule as noAnonymousOperations } from '../src/rules/no-anonymous-operations.js'; -import { rule as noTypenamePrefix } from '../src/rules/no-typename-prefix.js'; +import { rule as noAnonymousOperations } from '@/rules/no-anonymous-operations/index.js'; +import { rule as noTypenamePrefix } from '@/rules/no-typename-prefix/index.js'; import { ruleTester } from './test-utils.js'; ruleTester.run('no-typename-prefix', noTypenamePrefix, { diff --git a/packages/plugin/__tests__/alphabetize.spec.ts b/packages/plugin/src/rules/alphabetize/index.test.ts similarity index 99% rename from packages/plugin/__tests__/alphabetize.spec.ts rename to packages/plugin/src/rules/alphabetize/index.test.ts index e071c587063..446559062ab 100644 --- a/packages/plugin/__tests__/alphabetize.spec.ts +++ b/packages/plugin/src/rules/alphabetize/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/alphabetize.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; const GROUP_ORDER_TEST = /* GraphQL */ ` type User { diff --git a/packages/plugin/src/rules/alphabetize.ts b/packages/plugin/src/rules/alphabetize/index.ts similarity index 99% rename from packages/plugin/src/rules/alphabetize.ts rename to packages/plugin/src/rules/alphabetize/index.ts index f61fe91ed65..da73fbcd578 100644 --- a/packages/plugin/src/rules/alphabetize.ts +++ b/packages/plugin/src/rules/alphabetize/index.ts @@ -20,9 +20,9 @@ import { } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; import lowerCase from 'lodash.lowercase'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule, GraphQLESLintRuleListener } from '../types.js'; -import { ARRAY_DEFAULT_OPTIONS, displayNodeName, truthy } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.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/__tests__/__snapshots__/alphabetize.spec.md b/packages/plugin/src/rules/alphabetize/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/alphabetize.spec.md rename to packages/plugin/src/rules/alphabetize/snapshot.md diff --git a/packages/plugin/__tests__/description-style.spec.ts b/packages/plugin/src/rules/description-style/index.test.ts similarity index 85% rename from packages/plugin/__tests__/description-style.spec.ts rename to packages/plugin/src/rules/description-style/index.test.ts index b0acb2d2dfc..060bc8b515b 100644 --- a/packages/plugin/__tests__/description-style.spec.ts +++ b/packages/plugin/src/rules/description-style/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/description-style.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; const INLINE_SDL = /* GraphQL */ ` " Test " diff --git a/packages/plugin/src/rules/description-style.ts b/packages/plugin/src/rules/description-style/index.ts similarity index 93% rename from packages/plugin/src/rules/description-style.ts rename to packages/plugin/src/rules/description-style/index.ts index 93138fc42e2..154964e0855 100644 --- a/packages/plugin/src/rules/description-style.ts +++ b/packages/plugin/src/rules/description-style/index.ts @@ -1,8 +1,8 @@ import { StringValueNode } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getNodeName } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getNodeName } from '../../utils.js'; const schema = { type: 'array', diff --git a/packages/plugin/__tests__/__snapshots__/description-style.spec.md b/packages/plugin/src/rules/description-style/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/description-style.spec.md rename to packages/plugin/src/rules/description-style/snapshot.md diff --git a/packages/plugin/src/rules/index.ts b/packages/plugin/src/rules/index.ts index 975ffe48992..ba65ab3701b 100644 --- a/packages/plugin/src/rules/index.ts +++ b/packages/plugin/src/rules/index.ts @@ -2,41 +2,41 @@ * 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs` */ -import { rule as alphabetize } from './alphabetize.js'; -import { rule as descriptionStyle } from './description-style.js'; +import { rule as alphabetize } from './alphabetize/index.js'; +import { rule as descriptionStyle } from './description-style/index.js'; import { GRAPHQL_JS_VALIDATIONS } from './graphql-js-validation.js'; -import { rule as inputName } from './input-name.js'; -import { rule as loneExecutableDefinition } from './lone-executable-definition.js'; -import { rule as matchDocumentFilename } from './match-document-filename.js'; -import { rule as namingConvention } from './naming-convention.js'; -import { rule as noAnonymousOperations } from './no-anonymous-operations.js'; -import { rule as noDeprecated } from './no-deprecated.js'; -import { rule as noDuplicateFields } from './no-duplicate-fields.js'; -import { rule as noHashtagDescription } from './no-hashtag-description.js'; -import { rule as noOnePlaceFragments } from './no-one-place-fragments.js'; -import { rule as noRootType } from './no-root-type.js'; -import { rule as noScalarResultTypeOnMutation } from './no-scalar-result-type-on-mutation.js'; -import { rule as noTypenamePrefix } from './no-typename-prefix.js'; -import { rule as noUnreachableTypes } from './no-unreachable-types.js'; -import { rule as noUnusedFields } from './no-unused-fields.js'; -import { rule as relayArguments } from './relay-arguments.js'; -import { rule as relayConnectionTypes } from './relay-connection-types.js'; -import { rule as relayEdgeTypes } from './relay-edge-types.js'; -import { rule as relayPageInfo } from './relay-page-info.js'; -import { rule as requireDeprecationDate } from './require-deprecation-date.js'; -import { rule as requireDeprecationReason } from './require-deprecation-reason.js'; -import { rule as requireDescription } from './require-description.js'; -import { rule as requireFieldOfTypeQueryInMutationResult } from './require-field-of-type-query-in-mutation-result.js'; -import { rule as requireImportFragment } from './require-import-fragment.js'; -import { rule as requireNullableFieldsWithOneof } from './require-nullable-fields-with-oneof.js'; -import { rule as requireNullableResultInRoot } from './require-nullable-result-in-root.js'; -import { rule as requireSelections } from './require-selections.js'; -import { rule as requireTypePatternWithOneof } from './require-type-pattern-with-oneof.js'; -import { rule as selectionSetDepth } from './selection-set-depth.js'; -import { rule as strictIdInTypes } from './strict-id-in-types.js'; -import { rule as uniqueEnumValueNames } from './unique-enum-value-names.js'; -import { rule as uniqueFragmentName } from './unique-fragment-name.js'; -import { rule as uniqueOperationName } from './unique-operation-name.js'; +import { rule as inputName } from './input-name/index.js'; +import { rule as loneExecutableDefinition } from './lone-executable-definition/index.js'; +import { rule as matchDocumentFilename } from './match-document-filename/index.js'; +import { rule as namingConvention } from './naming-convention/index.js'; +import { rule as noAnonymousOperations } from './no-anonymous-operations/index.js'; +import { rule as noDeprecated } from './no-deprecated/index.js'; +import { rule as noDuplicateFields } from './no-duplicate-fields/index.js'; +import { rule as noHashtagDescription } from './no-hashtag-description/index.js'; +import { rule as noOnePlaceFragments } from './no-one-place-fragments/index.js'; +import { rule as noRootType } from './no-root-type/index.js'; +import { rule as noScalarResultTypeOnMutation } from './no-scalar-result-type-on-mutation/index.js'; +import { rule as noTypenamePrefix } from './no-typename-prefix/index.js'; +import { rule as noUnreachableTypes } from './no-unreachable-types/index.js'; +import { rule as noUnusedFields } from './no-unused-fields/index.js'; +import { rule as relayArguments } from './relay-arguments/index.js'; +import { rule as relayConnectionTypes } from './relay-connection-types/index.js'; +import { rule as relayEdgeTypes } from './relay-edge-types/index.js'; +import { rule as relayPageInfo } from './relay-page-info/index.js'; +import { rule as requireDeprecationDate } from './require-deprecation-date/index.js'; +import { rule as requireDeprecationReason } from './require-deprecation-reason/index.js'; +import { rule as requireDescription } from './require-description/index.js'; +import { rule as requireFieldOfTypeQueryInMutationResult } from './require-field-of-type-query-in-mutation-result/index.js'; +import { rule as requireImportFragment } from './require-import-fragment/index.js'; +import { rule as requireNullableFieldsWithOneof } from './require-nullable-fields-with-oneof/index.js'; +import { rule as requireNullableResultInRoot } from './require-nullable-result-in-root/index.js'; +import { rule as requireSelections } from './require-selections/index.js'; +import { rule as requireTypePatternWithOneof } from './require-type-pattern-with-oneof/index.js'; +import { rule as selectionSetDepth } from './selection-set-depth/index.js'; +import { rule as strictIdInTypes } from './strict-id-in-types/index.js'; +import { rule as uniqueEnumValueNames } from './unique-enum-value-names/index.js'; +import { rule as uniqueFragmentName } from './unique-fragment-name/index.js'; +import { rule as uniqueOperationName } from './unique-operation-name/index.js'; export const rules = { ...GRAPHQL_JS_VALIDATIONS, diff --git a/packages/plugin/__tests__/input-name.spec.ts b/packages/plugin/src/rules/input-name/index.test.ts similarity index 97% rename from packages/plugin/__tests__/input-name.spec.ts rename to packages/plugin/src/rules/input-name/index.test.ts index d1074a1012a..11228ac134d 100644 --- a/packages/plugin/__tests__/input-name.spec.ts +++ b/packages/plugin/src/rules/input-name/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/input-name.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; ruleTester.run('input-name', rule, { valid: [ diff --git a/packages/plugin/src/rules/input-name.ts b/packages/plugin/src/rules/input-name/index.ts similarity index 98% rename from packages/plugin/src/rules/input-name.ts rename to packages/plugin/src/rules/input-name/index.ts index 8d0b30c1a39..e8da9f0a74d 100644 --- a/packages/plugin/src/rules/input-name.ts +++ b/packages/plugin/src/rules/input-name/index.ts @@ -9,8 +9,8 @@ import { ObjectTypeExtensionNode, } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule, GraphQLESLintRuleListener } from '../types.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule, GraphQLESLintRuleListener } from '../../types.js'; const schema = { type: 'array', diff --git a/packages/plugin/__tests__/__snapshots__/input-name.spec.md b/packages/plugin/src/rules/input-name/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/input-name.spec.md rename to packages/plugin/src/rules/input-name/snapshot.md diff --git a/packages/plugin/__tests__/lone-executable-definition.spec.ts b/packages/plugin/src/rules/lone-executable-definition/index.test.ts similarity index 96% rename from packages/plugin/__tests__/lone-executable-definition.spec.ts rename to packages/plugin/src/rules/lone-executable-definition/index.test.ts index dac92883f73..d7e662e2b5e 100644 --- a/packages/plugin/__tests__/lone-executable-definition.spec.ts +++ b/packages/plugin/src/rules/lone-executable-definition/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/lone-executable-definition.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; ruleTester.run('lone-executable-definition', rule, { valid: [ diff --git a/packages/plugin/src/rules/lone-executable-definition.ts b/packages/plugin/src/rules/lone-executable-definition/index.ts similarity index 95% rename from packages/plugin/src/rules/lone-executable-definition.ts rename to packages/plugin/src/rules/lone-executable-definition/index.ts index 8396d4833f3..8533da94786 100644 --- a/packages/plugin/src/rules/lone-executable-definition.ts +++ b/packages/plugin/src/rules/lone-executable-definition/index.ts @@ -1,8 +1,8 @@ import { ExecutableDefinitionNode, OperationTypeNode } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { ARRAY_DEFAULT_OPTIONS, getLocation, pascalCase } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { ARRAY_DEFAULT_OPTIONS, getLocation, pascalCase } from '../../utils.js'; const RULE_ID = 'lone-executable-definition'; diff --git a/packages/plugin/__tests__/__snapshots__/lone-executable-definition.spec.md b/packages/plugin/src/rules/lone-executable-definition/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/lone-executable-definition.spec.md rename to packages/plugin/src/rules/lone-executable-definition/snapshot.md diff --git a/packages/plugin/__tests__/match-document-filename.spec.ts b/packages/plugin/src/rules/match-document-filename/index.test.ts similarity index 96% rename from packages/plugin/__tests__/match-document-filename.spec.ts rename to packages/plugin/src/rules/match-document-filename/index.test.ts index edcc83c9483..d4286831ecc 100644 --- a/packages/plugin/__tests__/match-document-filename.spec.ts +++ b/packages/plugin/src/rules/match-document-filename/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/match-document-filename.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; ruleTester.run('match-document-filename', rule, { valid: [ diff --git a/packages/plugin/src/rules/match-document-filename.ts b/packages/plugin/src/rules/match-document-filename/index.ts similarity index 97% rename from packages/plugin/src/rules/match-document-filename.ts rename to packages/plugin/src/rules/match-document-filename/index.ts index 25bf39bb44a..282de79f2aa 100644 --- a/packages/plugin/src/rules/match-document-filename.ts +++ b/packages/plugin/src/rules/match-document-filename/index.ts @@ -1,14 +1,14 @@ import { basename, extname } from 'node:path'; import { FragmentDefinitionNode, Kind, OperationDefinitionNode } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; import { CaseStyle as _CaseStyle, convertCase, REPORT_ON_FIRST_CHARACTER, VIRTUAL_DOCUMENT_REGEX, -} from '../utils.js'; +} from '../../utils.js'; type CaseStyle = _CaseStyle | 'matchDocumentStyle'; diff --git a/packages/plugin/__tests__/__snapshots__/match-document-filename.spec.md b/packages/plugin/src/rules/match-document-filename/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/match-document-filename.spec.md rename to packages/plugin/src/rules/match-document-filename/snapshot.md diff --git a/packages/plugin/__tests__/naming-convention.spec.ts b/packages/plugin/src/rules/naming-convention/index.test.ts similarity index 99% rename from packages/plugin/__tests__/naming-convention.spec.ts rename to packages/plugin/src/rules/naming-convention/index.test.ts index e0944c0de20..3bdceff48b1 100644 --- a/packages/plugin/__tests__/naming-convention.spec.ts +++ b/packages/plugin/src/rules/naming-convention/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/naming-convention.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; ruleTester.run('naming-convention', rule, { valid: [ diff --git a/packages/plugin/src/rules/naming-convention.ts b/packages/plugin/src/rules/naming-convention/index.ts similarity index 99% rename from packages/plugin/src/rules/naming-convention.ts rename to packages/plugin/src/rules/naming-convention/index.ts index 0cbcbf42662..09911d3718a 100644 --- a/packages/plugin/src/rules/naming-convention.ts +++ b/packages/plugin/src/rules/naming-convention/index.ts @@ -1,14 +1,14 @@ import { ASTKindToNode, Kind, NameNode } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule, GraphQLESLintRuleListener, ValueOf } from '../types.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule, GraphQLESLintRuleListener, ValueOf } from '../../types.js'; import { ARRAY_DEFAULT_OPTIONS, convertCase, englishJoinWords, truthy, TYPES_KINDS, -} from '../utils.js'; +} from '../../utils.js'; const KindToDisplayName = { // types diff --git a/packages/plugin/__tests__/__snapshots__/naming-convention.spec.md b/packages/plugin/src/rules/naming-convention/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/naming-convention.spec.md rename to packages/plugin/src/rules/naming-convention/snapshot.md diff --git a/packages/plugin/__tests__/no-anonymous-operations.spec.ts b/packages/plugin/src/rules/no-anonymous-operations/index.test.ts similarity index 74% rename from packages/plugin/__tests__/no-anonymous-operations.spec.ts rename to packages/plugin/src/rules/no-anonymous-operations/index.test.ts index bd81d61f178..24cf74bf1de 100644 --- a/packages/plugin/__tests__/no-anonymous-operations.spec.ts +++ b/packages/plugin/src/rules/no-anonymous-operations/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/no-anonymous-operations.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('no-anonymous-operations', rule, { valid: ['query myQuery { a }', 'mutation doSomething { a }', 'subscription myData { a }'], diff --git a/packages/plugin/src/rules/no-anonymous-operations.ts b/packages/plugin/src/rules/no-anonymous-operations/index.ts similarity index 93% rename from packages/plugin/src/rules/no-anonymous-operations.ts rename to packages/plugin/src/rules/no-anonymous-operations/index.ts index fae6301a28c..b53c69d0567 100644 --- a/packages/plugin/src/rules/no-anonymous-operations.ts +++ b/packages/plugin/src/rules/no-anonymous-operations/index.ts @@ -1,7 +1,7 @@ import { Kind, OperationDefinitionNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getLocation } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getLocation } from '../../utils.js'; const RULE_ID = 'no-anonymous-operations'; diff --git a/packages/plugin/__tests__/__snapshots__/no-anonymous-operations.spec.md b/packages/plugin/src/rules/no-anonymous-operations/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-anonymous-operations.spec.md rename to packages/plugin/src/rules/no-anonymous-operations/snapshot.md diff --git a/packages/plugin/__tests__/no-deprecated.spec.ts b/packages/plugin/src/rules/no-deprecated/index.test.ts similarity index 92% rename from packages/plugin/__tests__/no-deprecated.spec.ts rename to packages/plugin/src/rules/no-deprecated/index.test.ts index 240c56c6c84..f6ef7609327 100644 --- a/packages/plugin/__tests__/no-deprecated.spec.ts +++ b/packages/plugin/src/rules/no-deprecated/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/no-deprecated.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; const TEST_SCHEMA = /* GraphQL */ ` type Query { diff --git a/packages/plugin/src/rules/no-deprecated.ts b/packages/plugin/src/rules/no-deprecated/index.ts similarity index 94% rename from packages/plugin/src/rules/no-deprecated.ts rename to packages/plugin/src/rules/no-deprecated/index.ts index d1c454f2935..94023d8250a 100644 --- a/packages/plugin/src/rules/no-deprecated.ts +++ b/packages/plugin/src/rules/no-deprecated/index.ts @@ -1,7 +1,7 @@ import { EnumValueNode, FieldNode, Kind } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { requireGraphQLSchemaFromContext } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { requireGraphQLSchemaFromContext } from '../../utils.js'; const RULE_ID = 'no-deprecated'; diff --git a/packages/plugin/__tests__/__snapshots__/no-deprecated.spec.md b/packages/plugin/src/rules/no-deprecated/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-deprecated.spec.md rename to packages/plugin/src/rules/no-deprecated/snapshot.md diff --git a/packages/plugin/__tests__/no-duplicate-fields.spec.ts b/packages/plugin/src/rules/no-duplicate-fields/index.test.ts similarity index 90% rename from packages/plugin/__tests__/no-duplicate-fields.spec.ts rename to packages/plugin/src/rules/no-duplicate-fields/index.test.ts index 23037c2abe4..362b56d237b 100644 --- a/packages/plugin/__tests__/no-duplicate-fields.spec.ts +++ b/packages/plugin/src/rules/no-duplicate-fields/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/no-duplicate-fields.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('no-duplicate-fields', rule, { valid: [], diff --git a/packages/plugin/src/rules/no-duplicate-fields.ts b/packages/plugin/src/rules/no-duplicate-fields/index.ts similarity index 96% rename from packages/plugin/src/rules/no-duplicate-fields.ts rename to packages/plugin/src/rules/no-duplicate-fields/index.ts index 654ff387567..a0c004d8266 100644 --- a/packages/plugin/src/rules/no-duplicate-fields.ts +++ b/packages/plugin/src/rules/no-duplicate-fields/index.ts @@ -1,6 +1,6 @@ import { Kind, NameNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; const RULE_ID = 'no-duplicate-fields'; diff --git a/packages/plugin/__tests__/__snapshots__/no-duplicate-fields.spec.md b/packages/plugin/src/rules/no-duplicate-fields/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-duplicate-fields.spec.md rename to packages/plugin/src/rules/no-duplicate-fields/snapshot.md diff --git a/packages/plugin/__tests__/no-hashtag-description.spec.ts b/packages/plugin/src/rules/no-hashtag-description/index.test.ts similarity index 94% rename from packages/plugin/__tests__/no-hashtag-description.spec.ts rename to packages/plugin/src/rules/no-hashtag-description/index.test.ts index d0b46da4e7f..96313e17e24 100644 --- a/packages/plugin/__tests__/no-hashtag-description.spec.ts +++ b/packages/plugin/src/rules/no-hashtag-description/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RULE_ID } from '../src/rules/no-hashtag-description.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RULE_ID } from './index.js'; ruleTester.run('no-hashtag-description', rule, { valid: [ diff --git a/packages/plugin/src/rules/no-hashtag-description.ts b/packages/plugin/src/rules/no-hashtag-description/index.ts similarity index 95% rename from packages/plugin/src/rules/no-hashtag-description.ts rename to packages/plugin/src/rules/no-hashtag-description/index.ts index d6c43f042b8..53d8f4b7564 100644 --- a/packages/plugin/src/rules/no-hashtag-description.ts +++ b/packages/plugin/src/rules/no-hashtag-description/index.ts @@ -1,7 +1,7 @@ import { DocumentNode, Token, TokenKind } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getNodeName } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getNodeName } from '../../utils.js'; export const RULE_ID = 'HASHTAG_COMMENT'; diff --git a/packages/plugin/__tests__/__snapshots__/no-hashtag-description.spec.md b/packages/plugin/src/rules/no-hashtag-description/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-hashtag-description.spec.md rename to packages/plugin/src/rules/no-hashtag-description/snapshot.md diff --git a/packages/plugin/__tests__/no-one-place-fragments.spec.ts b/packages/plugin/src/rules/no-one-place-fragments/index.test.ts similarity index 78% rename from packages/plugin/__tests__/no-one-place-fragments.spec.ts rename to packages/plugin/src/rules/no-one-place-fragments/index.test.ts index 021a9bd4e63..01ace44e07d 100644 --- a/packages/plugin/__tests__/no-one-place-fragments.spec.ts +++ b/packages/plugin/src/rules/no-one-place-fragments/index.test.ts @@ -1,6 +1,7 @@ import { join } from 'node:path'; -import { rule } from '../src/rules/no-one-place-fragments.js'; -import { ruleTester } from './test-utils.js'; +import { CWD } from '@/utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('no-one-place-fragments', rule, { valid: [ @@ -9,7 +10,7 @@ ruleTester.run('no-one-place-fragments', rule, { code: ruleTester.fromMockFile('no-one-place-fragments.graphql'), parserOptions: { graphQLConfig: { - documents: join(__dirname, 'mocks/no-one-place-fragments.graphql'), + documents: join(CWD, '__tests__/mocks/no-one-place-fragments.graphql'), }, }, }, diff --git a/packages/plugin/src/rules/no-one-place-fragments.ts b/packages/plugin/src/rules/no-one-place-fragments/index.ts similarity index 92% rename from packages/plugin/src/rules/no-one-place-fragments.ts rename to packages/plugin/src/rules/no-one-place-fragments/index.ts index df4684e7870..6664c5d0829 100644 --- a/packages/plugin/src/rules/no-one-place-fragments.ts +++ b/packages/plugin/src/rules/no-one-place-fragments/index.ts @@ -1,8 +1,8 @@ import { relative } from 'node:path'; import { NameNode, visit } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { CWD, requireSiblingsOperations } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { CWD, requireSiblingsOperations } from '../../utils.js'; const RULE_ID = 'no-one-place-fragments'; diff --git a/packages/plugin/__tests__/__snapshots__/no-one-place-fragments.spec.md b/packages/plugin/src/rules/no-one-place-fragments/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-one-place-fragments.spec.md rename to packages/plugin/src/rules/no-one-place-fragments/snapshot.md diff --git a/packages/plugin/__tests__/no-root-type.spec.ts b/packages/plugin/src/rules/no-root-type/index.test.ts similarity index 90% rename from packages/plugin/__tests__/no-root-type.spec.ts rename to packages/plugin/src/rules/no-root-type/index.test.ts index a37bad5b63a..d66b8a01684 100644 --- a/packages/plugin/__tests__/no-root-type.spec.ts +++ b/packages/plugin/src/rules/no-root-type/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/no-root-type.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; const useSchema = (code: string, schema = '') => ({ code, diff --git a/packages/plugin/src/rules/no-root-type.ts b/packages/plugin/src/rules/no-root-type/index.ts similarity index 94% rename from packages/plugin/src/rules/no-root-type.ts rename to packages/plugin/src/rules/no-root-type/index.ts index 7f45238eba0..4d549aa8d61 100644 --- a/packages/plugin/src/rules/no-root-type.ts +++ b/packages/plugin/src/rules/no-root-type/index.ts @@ -1,8 +1,8 @@ import { NameNode } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { ARRAY_DEFAULT_OPTIONS, requireGraphQLSchemaFromContext, truthy } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { ARRAY_DEFAULT_OPTIONS, requireGraphQLSchemaFromContext, truthy } from '../../utils.js'; const schema = { type: 'array', diff --git a/packages/plugin/__tests__/__snapshots__/no-root-type.spec.md b/packages/plugin/src/rules/no-root-type/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-root-type.spec.md rename to packages/plugin/src/rules/no-root-type/snapshot.md diff --git a/packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts b/packages/plugin/src/rules/no-scalar-result-type-on-mutation/index.test.ts similarity index 92% rename from packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts rename to packages/plugin/src/rules/no-scalar-result-type-on-mutation/index.test.ts index 37c58aa42e8..cdb7bf72f1e 100644 --- a/packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts +++ b/packages/plugin/src/rules/no-scalar-result-type-on-mutation/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/no-scalar-result-type-on-mutation.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; const useSchema = (code: string) => ({ code, diff --git a/packages/plugin/src/rules/no-scalar-result-type-on-mutation.ts b/packages/plugin/src/rules/no-scalar-result-type-on-mutation/index.ts similarity index 93% rename from packages/plugin/src/rules/no-scalar-result-type-on-mutation.ts rename to packages/plugin/src/rules/no-scalar-result-type-on-mutation/index.ts index 4f0b5c699e1..5c52f386521 100644 --- a/packages/plugin/src/rules/no-scalar-result-type-on-mutation.ts +++ b/packages/plugin/src/rules/no-scalar-result-type-on-mutation/index.ts @@ -1,7 +1,7 @@ import { isScalarType, Kind, NameNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getNodeName, requireGraphQLSchemaFromContext } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getNodeName, requireGraphQLSchemaFromContext } from '../../utils.js'; const RULE_ID = 'no-scalar-result-type-on-mutation'; diff --git a/packages/plugin/__tests__/__snapshots__/no-scalar-result-type-on-mutation.spec.md b/packages/plugin/src/rules/no-scalar-result-type-on-mutation/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-scalar-result-type-on-mutation.spec.md rename to packages/plugin/src/rules/no-scalar-result-type-on-mutation/snapshot.md diff --git a/packages/plugin/__tests__/no-typename-prefix.spec.ts b/packages/plugin/src/rules/no-typename-prefix/index.test.ts similarity index 90% rename from packages/plugin/__tests__/no-typename-prefix.spec.ts rename to packages/plugin/src/rules/no-typename-prefix/index.test.ts index d2a9ae8f862..836dd8378ea 100644 --- a/packages/plugin/__tests__/no-typename-prefix.spec.ts +++ b/packages/plugin/src/rules/no-typename-prefix/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/no-typename-prefix.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('no-typename-prefix', rule, { valid: [ diff --git a/packages/plugin/src/rules/no-typename-prefix.ts b/packages/plugin/src/rules/no-typename-prefix/index.ts similarity index 95% rename from packages/plugin/src/rules/no-typename-prefix.ts rename to packages/plugin/src/rules/no-typename-prefix/index.ts index a98de5ba831..0d5d37f2580 100644 --- a/packages/plugin/src/rules/no-typename-prefix.ts +++ b/packages/plugin/src/rules/no-typename-prefix/index.ts @@ -4,8 +4,8 @@ import { ObjectTypeDefinitionNode, ObjectTypeExtensionNode, } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; const NO_TYPENAME_PREFIX = 'NO_TYPENAME_PREFIX'; diff --git a/packages/plugin/__tests__/__snapshots__/no-typename-prefix.spec.md b/packages/plugin/src/rules/no-typename-prefix/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-typename-prefix.spec.md rename to packages/plugin/src/rules/no-typename-prefix/snapshot.md diff --git a/packages/plugin/__tests__/no-unreachable-types.spec.ts b/packages/plugin/src/rules/no-unreachable-types/index.test.ts similarity index 98% rename from packages/plugin/__tests__/no-unreachable-types.spec.ts rename to packages/plugin/src/rules/no-unreachable-types/index.test.ts index 628557e201a..7bc14453e52 100644 --- a/packages/plugin/__tests__/no-unreachable-types.spec.ts +++ b/packages/plugin/src/rules/no-unreachable-types/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/no-unreachable-types.js'; -import { ruleTester, withSchema } from './test-utils.js'; +import { ruleTester, withSchema } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('no-unreachable-types', rule, { valid: [ diff --git a/packages/plugin/src/rules/no-unreachable-types.ts b/packages/plugin/src/rules/no-unreachable-types/index.ts similarity index 96% rename from packages/plugin/src/rules/no-unreachable-types.ts rename to packages/plugin/src/rules/no-unreachable-types/index.ts index 6c5cdfdfa44..f771437f053 100644 --- a/packages/plugin/src/rules/no-unreachable-types.ts +++ b/packages/plugin/src/rules/no-unreachable-types/index.ts @@ -10,10 +10,10 @@ import { } from 'graphql'; import { GraphQLProjectConfig } from 'graphql-config'; import lowerCase from 'lodash.lowercase'; -import { ModuleCache } from '../cache.js'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getTypeName, requireGraphQLSchemaFromContext } from '../utils.js'; +import { ModuleCache } from '../../cache.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getTypeName, requireGraphQLSchemaFromContext } from '../../utils.js'; const RULE_ID = 'no-unreachable-types'; diff --git a/packages/plugin/__tests__/__snapshots__/no-unreachable-types.spec.md b/packages/plugin/src/rules/no-unreachable-types/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-unreachable-types.spec.md rename to packages/plugin/src/rules/no-unreachable-types/snapshot.md diff --git a/packages/plugin/__tests__/no-unused-fields.spec.ts b/packages/plugin/src/rules/no-unused-fields/index.test.ts similarity index 95% rename from packages/plugin/__tests__/no-unused-fields.spec.ts rename to packages/plugin/src/rules/no-unused-fields/index.test.ts index b20964c9eb9..59815616764 100644 --- a/packages/plugin/__tests__/no-unused-fields.spec.ts +++ b/packages/plugin/src/rules/no-unused-fields/index.test.ts @@ -1,6 +1,6 @@ import { RuleTester } from '@theguild/eslint-rule-tester'; -import { rule } from '../src/rules/no-unused-fields.js'; -import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils.js'; +import { DEFAULT_CONFIG, ParserOptionsForTests } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; const SCHEMA = /* GraphQL */ ` type User { diff --git a/packages/plugin/src/rules/no-unused-fields.ts b/packages/plugin/src/rules/no-unused-fields/index.ts similarity index 95% rename from packages/plugin/src/rules/no-unused-fields.ts rename to packages/plugin/src/rules/no-unused-fields/index.ts index 06228f77707..f2d0a7d895c 100644 --- a/packages/plugin/src/rules/no-unused-fields.ts +++ b/packages/plugin/src/rules/no-unused-fields/index.ts @@ -1,9 +1,9 @@ import { GraphQLSchema, TypeInfo, visit, visitWithTypeInfo } from 'graphql'; import { GraphQLProjectConfig } from 'graphql-config'; -import { ModuleCache } from '../cache.js'; -import { SiblingOperations } from '../siblings.js'; -import { GraphQLESLintRule } from '../types.js'; -import { requireGraphQLSchemaFromContext, requireSiblingsOperations } from '../utils.js'; +import { ModuleCache } from '../../cache.js'; +import { SiblingOperations } from '../../siblings.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { requireGraphQLSchemaFromContext, requireSiblingsOperations } from '../../utils.js'; const RULE_ID = 'no-unused-fields'; diff --git a/packages/plugin/__tests__/__snapshots__/no-unused-fields.spec.md b/packages/plugin/src/rules/no-unused-fields/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/no-unused-fields.spec.md rename to packages/plugin/src/rules/no-unused-fields/snapshot.md diff --git a/packages/plugin/__tests__/relay-arguments.spec.ts b/packages/plugin/src/rules/relay-arguments/index.test.ts similarity index 92% rename from packages/plugin/__tests__/relay-arguments.spec.ts rename to packages/plugin/src/rules/relay-arguments/index.test.ts index 7e783de61ba..584e7aff656 100644 --- a/packages/plugin/__tests__/relay-arguments.spec.ts +++ b/packages/plugin/src/rules/relay-arguments/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/relay-arguments.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; function useSchema(code: string) { return { diff --git a/packages/plugin/src/rules/relay-arguments.ts b/packages/plugin/src/rules/relay-arguments/index.ts similarity index 96% rename from packages/plugin/src/rules/relay-arguments.ts rename to packages/plugin/src/rules/relay-arguments/index.ts index ae7ec6c24c4..db28e447f30 100644 --- a/packages/plugin/src/rules/relay-arguments.ts +++ b/packages/plugin/src/rules/relay-arguments/index.ts @@ -1,8 +1,8 @@ import { FieldDefinitionNode, isScalarType, Kind, NameNode } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { requireGraphQLSchemaFromContext } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { requireGraphQLSchemaFromContext } from '../../utils.js'; const RULE_ID = 'relay-arguments'; const MISSING_ARGUMENTS = 'MISSING_ARGUMENTS'; diff --git a/packages/plugin/__tests__/__snapshots__/relay-arguments.spec.md b/packages/plugin/src/rules/relay-arguments/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/relay-arguments.spec.md rename to packages/plugin/src/rules/relay-arguments/snapshot.md diff --git a/packages/plugin/__tests__/relay-connection-types.spec.ts b/packages/plugin/src/rules/relay-connection-types/index.test.ts similarity index 96% rename from packages/plugin/__tests__/relay-connection-types.spec.ts rename to packages/plugin/src/rules/relay-connection-types/index.test.ts index 5e3d040e9ac..8e8fbcbb254 100644 --- a/packages/plugin/__tests__/relay-connection-types.spec.ts +++ b/packages/plugin/src/rules/relay-connection-types/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/relay-connection-types.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('relay-connection-types', rule, { valid: [ diff --git a/packages/plugin/src/rules/relay-connection-types.ts b/packages/plugin/src/rules/relay-connection-types/index.ts similarity index 97% rename from packages/plugin/src/rules/relay-connection-types.ts rename to packages/plugin/src/rules/relay-connection-types/index.ts index f2d64065e41..cfba5058c90 100644 --- a/packages/plugin/src/rules/relay-connection-types.ts +++ b/packages/plugin/src/rules/relay-connection-types/index.ts @@ -1,6 +1,6 @@ import { Kind, NameNode, ObjectTypeDefinitionNode, TypeNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; const MUST_BE_OBJECT_TYPE = 'MUST_BE_OBJECT_TYPE'; const MUST_CONTAIN_FIELD_EDGES = 'MUST_CONTAIN_FIELD_EDGES'; diff --git a/packages/plugin/__tests__/__snapshots__/relay-connection-types.spec.md b/packages/plugin/src/rules/relay-connection-types/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/relay-connection-types.spec.md rename to packages/plugin/src/rules/relay-connection-types/snapshot.md diff --git a/packages/plugin/__tests__/relay-edge-types.spec.ts b/packages/plugin/src/rules/relay-edge-types/index.test.ts similarity index 97% rename from packages/plugin/__tests__/relay-edge-types.spec.ts rename to packages/plugin/src/rules/relay-edge-types/index.test.ts index e1fcd91992b..067fab25c9d 100644 --- a/packages/plugin/__tests__/relay-edge-types.spec.ts +++ b/packages/plugin/src/rules/relay-edge-types/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/relay-edge-types.js'; -import { ruleTester, withSchema } from './test-utils.js'; +import { ruleTester, withSchema } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; ruleTester.run('relay-edge-types', rule, { valid: [ diff --git a/packages/plugin/src/rules/relay-edge-types.ts b/packages/plugin/src/rules/relay-edge-types/index.ts similarity index 98% rename from packages/plugin/src/rules/relay-edge-types.ts rename to packages/plugin/src/rules/relay-edge-types/index.ts index a688d0221c8..a7614b71f97 100644 --- a/packages/plugin/src/rules/relay-edge-types.ts +++ b/packages/plugin/src/rules/relay-edge-types/index.ts @@ -11,9 +11,9 @@ import { } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; import { getDocumentNodeFromSchema } from '@graphql-tools/utils'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule, GraphQLESLintRuleListener } from '../types.js'; -import { getTypeName, requireGraphQLSchemaFromContext } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule, GraphQLESLintRuleListener } from '../../types.js'; +import { getTypeName, requireGraphQLSchemaFromContext } from '../../utils.js'; const RULE_ID = 'relay-edge-types'; const MESSAGE_MUST_BE_OBJECT_TYPE = 'MESSAGE_MUST_BE_OBJECT_TYPE'; diff --git a/packages/plugin/__tests__/__snapshots__/relay-edge-types.spec.md b/packages/plugin/src/rules/relay-edge-types/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/relay-edge-types.spec.md rename to packages/plugin/src/rules/relay-edge-types/snapshot.md diff --git a/packages/plugin/__tests__/relay-page-info.spec.ts b/packages/plugin/src/rules/relay-page-info/index.test.ts similarity index 95% rename from packages/plugin/__tests__/relay-page-info.spec.ts rename to packages/plugin/src/rules/relay-page-info/index.test.ts index 65d0d3bb219..6306a685839 100644 --- a/packages/plugin/__tests__/relay-page-info.spec.ts +++ b/packages/plugin/src/rules/relay-page-info/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/relay-page-info.js'; -import { ruleTester, withSchema } from './test-utils.js'; +import { ruleTester, withSchema } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('relay-page-info', rule, { valid: [ diff --git a/packages/plugin/src/rules/relay-page-info.ts b/packages/plugin/src/rules/relay-page-info/index.ts similarity index 94% rename from packages/plugin/src/rules/relay-page-info.ts rename to packages/plugin/src/rules/relay-page-info/index.ts index 1b510338445..d748323b505 100644 --- a/packages/plugin/src/rules/relay-page-info.ts +++ b/packages/plugin/src/rules/relay-page-info/index.ts @@ -1,8 +1,8 @@ import { isScalarType, Kind, NameNode, ObjectTypeDefinitionNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { REPORT_ON_FIRST_CHARACTER, requireGraphQLSchemaFromContext } from '../utils.js'; -import { NON_OBJECT_TYPES } from './relay-connection-types.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { REPORT_ON_FIRST_CHARACTER, requireGraphQLSchemaFromContext } from '../../utils.js'; +import { NON_OBJECT_TYPES } from '../relay-connection-types/index.js'; const RULE_ID = 'relay-page-info'; const MESSAGE_MUST_EXIST = 'MESSAGE_MUST_EXIST'; diff --git a/packages/plugin/__tests__/__snapshots__/relay-page-info.spec.md b/packages/plugin/src/rules/relay-page-info/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/relay-page-info.spec.md rename to packages/plugin/src/rules/relay-page-info/snapshot.md diff --git a/packages/plugin/__tests__/require-deprecation-date.spec.ts b/packages/plugin/src/rules/require-deprecation-date/index.test.ts similarity index 90% rename from packages/plugin/__tests__/require-deprecation-date.spec.ts rename to packages/plugin/src/rules/require-deprecation-date/index.test.ts index 9708bf000c3..01c4cf5742c 100644 --- a/packages/plugin/__tests__/require-deprecation-date.spec.ts +++ b/packages/plugin/src/rules/require-deprecation-date/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/require-deprecation-date.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; const now = new Date(); now.setDate(now.getDate() + 1); diff --git a/packages/plugin/src/rules/require-deprecation-date.ts b/packages/plugin/src/rules/require-deprecation-date/index.ts similarity index 95% rename from packages/plugin/src/rules/require-deprecation-date.ts rename to packages/plugin/src/rules/require-deprecation-date/index.ts index 2f1a49b3e8f..31e0fb84163 100644 --- a/packages/plugin/src/rules/require-deprecation-date.ts +++ b/packages/plugin/src/rules/require-deprecation-date/index.ts @@ -1,8 +1,8 @@ import { DirectiveNode } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode, valueFromNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getNodeName } from '../utils.js'; +import { GraphQLESTreeNode, valueFromNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getNodeName } from '../../utils.js'; // eslint-disable-next-line unicorn/better-regex const DATE_REGEX = /^\d{2}\/\d{2}\/\d{4}$/; diff --git a/packages/plugin/__tests__/__snapshots__/require-deprecation-date.spec.md b/packages/plugin/src/rules/require-deprecation-date/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/require-deprecation-date.spec.md rename to packages/plugin/src/rules/require-deprecation-date/snapshot.md diff --git a/packages/plugin/__tests__/require-deprecation-reason.spec.ts b/packages/plugin/src/rules/require-deprecation-reason/index.test.ts similarity index 92% rename from packages/plugin/__tests__/require-deprecation-reason.spec.ts rename to packages/plugin/src/rules/require-deprecation-reason/index.test.ts index 02cd2214e7c..b775e1945ce 100644 --- a/packages/plugin/__tests__/require-deprecation-reason.spec.ts +++ b/packages/plugin/src/rules/require-deprecation-reason/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/require-deprecation-reason.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('require-deprecation-reason', rule, { valid: [ diff --git a/packages/plugin/src/rules/require-deprecation-reason.ts b/packages/plugin/src/rules/require-deprecation-reason/index.ts similarity index 89% rename from packages/plugin/src/rules/require-deprecation-reason.ts rename to packages/plugin/src/rules/require-deprecation-reason/index.ts index b3c7dcbb986..c6c57fa570a 100644 --- a/packages/plugin/src/rules/require-deprecation-reason.ts +++ b/packages/plugin/src/rules/require-deprecation-reason/index.ts @@ -1,7 +1,7 @@ import { ArgumentNode, DirectiveNode } from 'graphql'; -import { GraphQLESTreeNode, valueFromNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getNodeName } from '../utils.js'; +import { GraphQLESTreeNode, valueFromNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getNodeName } from '../../utils.js'; export const rule: GraphQLESLintRule = { meta: { diff --git a/packages/plugin/__tests__/__snapshots__/require-deprecation-reason.spec.md b/packages/plugin/src/rules/require-deprecation-reason/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/require-deprecation-reason.spec.md rename to packages/plugin/src/rules/require-deprecation-reason/snapshot.md diff --git a/packages/plugin/__tests__/require-description.spec.ts b/packages/plugin/src/rules/require-description/index.test.ts similarity index 97% rename from packages/plugin/__tests__/require-description.spec.ts rename to packages/plugin/src/rules/require-description/index.test.ts index 1caf232cb47..dec194889c4 100644 --- a/packages/plugin/__tests__/require-description.spec.ts +++ b/packages/plugin/src/rules/require-description/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RULE_ID, RuleOptions } from '../src/rules/require-description.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RULE_ID, RuleOptions } from './index.js'; const OPERATION = { OperationDefinition: true }; diff --git a/packages/plugin/src/rules/require-description.ts b/packages/plugin/src/rules/require-description/index.ts similarity index 97% rename from packages/plugin/src/rules/require-description.ts rename to packages/plugin/src/rules/require-description/index.ts index 6488527aae5..d669ac90ecb 100644 --- a/packages/plugin/src/rules/require-description.ts +++ b/packages/plugin/src/rules/require-description/index.ts @@ -1,13 +1,13 @@ import { ASTKindToNode, Kind, TokenKind } from 'graphql'; import { getRootTypeNames } from '@graphql-tools/utils'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule, ValueOf } from '../types.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule, ValueOf } from '../../types.js'; import { getLocation, getNodeName, requireGraphQLSchemaFromContext, TYPES_KINDS, -} from '../utils.js'; +} from '../../utils.js'; export const RULE_ID = 'require-description'; diff --git a/packages/plugin/__tests__/__snapshots__/require-description.spec.md b/packages/plugin/src/rules/require-description/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/require-description.spec.md rename to packages/plugin/src/rules/require-description/snapshot.md diff --git a/packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts b/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result/index.test.ts similarity index 93% rename from packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts rename to packages/plugin/src/rules/require-field-of-type-query-in-mutation-result/index.test.ts index b4f40d5eb70..00308c145d9 100644 --- a/packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts +++ b/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/require-field-of-type-query-in-mutation-result.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; const useSchema = (code: string) => ({ code, diff --git a/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result.ts b/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result/index.ts similarity index 94% rename from packages/plugin/src/rules/require-field-of-type-query-in-mutation-result.ts rename to packages/plugin/src/rules/require-field-of-type-query-in-mutation-result/index.ts index 15049a9fcab..874137450e1 100644 --- a/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result.ts +++ b/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result/index.ts @@ -1,7 +1,7 @@ import { isObjectType, NameNode, ObjectTypeDefinitionNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getTypeName, requireGraphQLSchemaFromContext } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getTypeName, requireGraphQLSchemaFromContext } from '../../utils.js'; const RULE_ID = 'require-field-of-type-query-in-mutation-result'; diff --git a/packages/plugin/__tests__/__snapshots__/require-field-of-type-query-in-mutation-result.spec.md b/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/require-field-of-type-query-in-mutation-result.spec.md rename to packages/plugin/src/rules/require-field-of-type-query-in-mutation-result/snapshot.md diff --git a/packages/plugin/__tests__/require-import-fragment.spec.ts b/packages/plugin/src/rules/require-import-fragment/index.test.ts similarity index 60% rename from packages/plugin/__tests__/require-import-fragment.spec.ts rename to packages/plugin/src/rules/require-import-fragment/index.test.ts index 529c48e8c75..6a744d3975f 100644 --- a/packages/plugin/__tests__/require-import-fragment.spec.ts +++ b/packages/plugin/src/rules/require-import-fragment/index.test.ts @@ -1,6 +1,7 @@ import { join } from 'node:path'; -import { rule } from '../src/rules/require-import-fragment.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { CWD } from '@/utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; function withMocks({ name, filename, errors }: { name: string; filename: string; errors?: any }) { return { @@ -11,8 +12,8 @@ function withMocks({ name, filename, errors }: { name: string; filename: string; graphQLConfig: { documents: [ filename, - join(__dirname, 'mocks/import-fragments/foo-fragment.gql'), - join(__dirname, 'mocks/import-fragments/bar-fragment.gql'), + join(CWD, '__tests__/mocks/import-fragments/foo-fragment.gql'), + join(CWD, '__tests__/mocks/import-fragments/bar-fragment.gql'), ], }, } satisfies ParserOptionsForTests, @@ -24,31 +25,31 @@ ruleTester.run('require-import-fragment', rule, { valid: [ withMocks({ name: 'should not report with named import', - filename: join(__dirname, 'mocks/import-fragments/valid-query.gql'), + filename: join(CWD, '__tests__/mocks/import-fragments/valid-query.gql'), }), withMocks({ name: 'should not report with default import', - filename: join(__dirname, 'mocks/import-fragments/valid-query-default.gql'), + filename: join(CWD, '__tests__/mocks/import-fragments/valid-query-default.gql'), }), withMocks({ name: 'should not report fragments from the same file', - filename: join(__dirname, 'mocks/import-fragments/same-file.gql'), + filename: join(CWD, '__tests__/mocks/import-fragments/same-file.gql'), }), ], invalid: [ withMocks({ name: 'should report with named import', - filename: join(__dirname, 'mocks/import-fragments/invalid-query.gql'), + filename: join(CWD, '__tests__/mocks/import-fragments/invalid-query.gql'), errors: [{ message: 'Expected "FooFields" fragment to be imported.' }], }), withMocks({ name: 'should report with default import', - filename: join(__dirname, 'mocks/import-fragments/invalid-query-default.gql'), + filename: join(CWD, '__tests__/mocks/import-fragments/invalid-query-default.gql'), errors: [{ message: 'Expected "FooFields" fragment to be imported.' }], }), withMocks({ name: 'should report fragments when there are no import expressions', - filename: join(__dirname, 'mocks/import-fragments/missing-import.gql'), + filename: join(CWD, '__tests__/mocks/import-fragments/missing-import.gql'), errors: [{ message: 'Expected "FooFields" fragment to be imported.' }], }), ], diff --git a/packages/plugin/src/rules/require-import-fragment.ts b/packages/plugin/src/rules/require-import-fragment/index.ts similarity index 95% rename from packages/plugin/src/rules/require-import-fragment.ts rename to packages/plugin/src/rules/require-import-fragment/index.ts index d1579d86ff3..592e6c21b68 100644 --- a/packages/plugin/src/rules/require-import-fragment.ts +++ b/packages/plugin/src/rules/require-import-fragment/index.ts @@ -1,8 +1,8 @@ import path from 'node:path'; import { NameNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { requireSiblingsOperations } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { requireSiblingsOperations } from '../../utils.js'; const RULE_ID = 'require-import-fragment'; const SUGGESTION_ID = 'add-import-expression'; diff --git a/packages/plugin/__tests__/__snapshots__/require-import-fragment.spec.md b/packages/plugin/src/rules/require-import-fragment/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/require-import-fragment.spec.md rename to packages/plugin/src/rules/require-import-fragment/snapshot.md diff --git a/packages/plugin/__tests__/require-nullable-fields-with-oneof.spec.ts b/packages/plugin/src/rules/require-nullable-fields-with-oneof/index.test.ts similarity index 84% rename from packages/plugin/__tests__/require-nullable-fields-with-oneof.spec.ts rename to packages/plugin/src/rules/require-nullable-fields-with-oneof/index.test.ts index 9513177217c..941d7826a11 100644 --- a/packages/plugin/__tests__/require-nullable-fields-with-oneof.spec.ts +++ b/packages/plugin/src/rules/require-nullable-fields-with-oneof/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/require-nullable-fields-with-oneof.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('require-nullable-fields-with-oneof', rule, { valid: [ diff --git a/packages/plugin/src/rules/require-nullable-fields-with-oneof.ts b/packages/plugin/src/rules/require-nullable-fields-with-oneof/index.ts similarity index 90% rename from packages/plugin/src/rules/require-nullable-fields-with-oneof.ts rename to packages/plugin/src/rules/require-nullable-fields-with-oneof/index.ts index 3c578f1bcf6..44c7f4a5c58 100644 --- a/packages/plugin/src/rules/require-nullable-fields-with-oneof.ts +++ b/packages/plugin/src/rules/require-nullable-fields-with-oneof/index.ts @@ -1,7 +1,7 @@ import { DirectiveNode, Kind } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getNodeName } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getNodeName } from '../../utils.js'; const RULE_ID = 'require-nullable-fields-with-oneof'; diff --git a/packages/plugin/__tests__/__snapshots__/require-nullable-fields-with-oneof.spec.md b/packages/plugin/src/rules/require-nullable-fields-with-oneof/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/require-nullable-fields-with-oneof.spec.md rename to packages/plugin/src/rules/require-nullable-fields-with-oneof/snapshot.md diff --git a/packages/plugin/__tests__/require-nullable-result-in-root.spec.ts b/packages/plugin/src/rules/require-nullable-result-in-root/index.test.ts similarity index 87% rename from packages/plugin/__tests__/require-nullable-result-in-root.spec.ts rename to packages/plugin/src/rules/require-nullable-result-in-root/index.test.ts index b6f08b91e16..164c8298a4c 100644 --- a/packages/plugin/__tests__/require-nullable-result-in-root.spec.ts +++ b/packages/plugin/src/rules/require-nullable-result-in-root/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/require-nullable-result-in-root.js'; -import { ruleTester, withSchema } from './test-utils.js'; +import { ruleTester, withSchema } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('require-nullable-result-in-root', rule, { valid: [ diff --git a/packages/plugin/src/rules/require-nullable-result-in-root.ts b/packages/plugin/src/rules/require-nullable-result-in-root/index.ts similarity index 94% rename from packages/plugin/src/rules/require-nullable-result-in-root.ts rename to packages/plugin/src/rules/require-nullable-result-in-root/index.ts index 8fbb8f8e1ae..b8432663ba9 100644 --- a/packages/plugin/src/rules/require-nullable-result-in-root.ts +++ b/packages/plugin/src/rules/require-nullable-result-in-root/index.ts @@ -1,7 +1,7 @@ import { Kind, ObjectTypeDefinitionNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getNodeName, requireGraphQLSchemaFromContext, truthy } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getNodeName, requireGraphQLSchemaFromContext, truthy } from '../../utils.js'; const RULE_ID = 'require-nullable-result-in-root'; diff --git a/packages/plugin/__tests__/__snapshots__/require-nullable-result-in-root.spec.md b/packages/plugin/src/rules/require-nullable-result-in-root/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/require-nullable-result-in-root.spec.md rename to packages/plugin/src/rules/require-nullable-result-in-root/snapshot.md diff --git a/packages/plugin/__tests__/require-selections.spec.ts b/packages/plugin/src/rules/require-selections/index.test.ts similarity index 98% rename from packages/plugin/__tests__/require-selections.spec.ts rename to packages/plugin/src/rules/require-selections/index.test.ts index 113f5a24c6a..cdb6c8769bd 100644 --- a/packages/plugin/__tests__/require-selections.spec.ts +++ b/packages/plugin/src/rules/require-selections/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/require-selections.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; const TEST_SCHEMA = /* GraphQL */ ` type Query { diff --git a/packages/plugin/src/rules/require-selections.ts b/packages/plugin/src/rules/require-selections/index.ts similarity index 98% rename from packages/plugin/src/rules/require-selections.ts rename to packages/plugin/src/rules/require-selections/index.ts index deabb3ad1f5..12771da5ac9 100644 --- a/packages/plugin/src/rules/require-selections.ts +++ b/packages/plugin/src/rules/require-selections/index.ts @@ -13,14 +13,14 @@ import { } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; import { asArray } from '@graphql-tools/utils'; -import { getBaseType, GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule, OmitRecursively, ReportDescriptor } from '../types.js'; +import { getBaseType, GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule, OmitRecursively, ReportDescriptor } from '../../types.js'; import { ARRAY_DEFAULT_OPTIONS, englishJoinWords, requireGraphQLSchemaFromContext, requireSiblingsOperations, -} from '../utils.js'; +} from '../../utils.js'; const RULE_ID = 'require-selections'; const DEFAULT_ID_FIELD_NAME = 'id'; diff --git a/packages/plugin/__tests__/__snapshots__/require-selections.spec.md b/packages/plugin/src/rules/require-selections/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/require-selections.spec.md rename to packages/plugin/src/rules/require-selections/snapshot.md diff --git a/packages/plugin/__tests__/require-type-pattern-with-oneof.spec.ts b/packages/plugin/src/rules/require-type-pattern-with-oneof/index.test.ts similarity index 88% rename from packages/plugin/__tests__/require-type-pattern-with-oneof.spec.ts rename to packages/plugin/src/rules/require-type-pattern-with-oneof/index.test.ts index 0056bee95a8..257d080860e 100644 --- a/packages/plugin/__tests__/require-type-pattern-with-oneof.spec.ts +++ b/packages/plugin/src/rules/require-type-pattern-with-oneof/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/require-type-pattern-with-oneof.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('require-type-pattern-with-oneof', rule, { valid: [ diff --git a/packages/plugin/src/rules/require-type-pattern-with-oneof.ts b/packages/plugin/src/rules/require-type-pattern-with-oneof/index.ts similarity index 90% rename from packages/plugin/src/rules/require-type-pattern-with-oneof.ts rename to packages/plugin/src/rules/require-type-pattern-with-oneof/index.ts index 4cca46dabb4..0bdf57a4351 100644 --- a/packages/plugin/src/rules/require-type-pattern-with-oneof.ts +++ b/packages/plugin/src/rules/require-type-pattern-with-oneof/index.ts @@ -1,7 +1,7 @@ import { ObjectTypeDefinitionNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { displayNodeName } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { displayNodeName } from '../../utils.js'; const RULE_ID = 'require-type-pattern-with-oneof'; diff --git a/packages/plugin/__tests__/__snapshots__/require-type-pattern-with-oneof.spec.md b/packages/plugin/src/rules/require-type-pattern-with-oneof/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/require-type-pattern-with-oneof.spec.md rename to packages/plugin/src/rules/require-type-pattern-with-oneof/snapshot.md diff --git a/packages/plugin/__tests__/selection-set-depth.spec.ts b/packages/plugin/src/rules/selection-set-depth/index.test.ts similarity index 94% rename from packages/plugin/__tests__/selection-set-depth.spec.ts rename to packages/plugin/src/rules/selection-set-depth/index.test.ts index ce69f26fa27..b23a399edb6 100644 --- a/packages/plugin/__tests__/selection-set-depth.spec.ts +++ b/packages/plugin/src/rules/selection-set-depth/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/selection-set-depth.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; const WITH_SIBLINGS = { parserOptions: { diff --git a/packages/plugin/src/rules/selection-set-depth.ts b/packages/plugin/src/rules/selection-set-depth/index.ts similarity index 95% rename from packages/plugin/src/rules/selection-set-depth.ts rename to packages/plugin/src/rules/selection-set-depth/index.ts index e4984526a0e..20f3461f6ff 100644 --- a/packages/plugin/src/rules/selection-set-depth.ts +++ b/packages/plugin/src/rules/selection-set-depth/index.ts @@ -2,10 +2,10 @@ import { AST } from 'eslint'; import { DocumentNode, ExecutableDefinitionNode, GraphQLError, Kind } from 'graphql'; import depthLimit from 'graphql-depth-limit'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { SiblingOperations } from '../siblings.js'; -import { GraphQLESLintRule } from '../types.js'; -import { ARRAY_DEFAULT_OPTIONS, logger, requireSiblingsOperations } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { SiblingOperations } from '../../siblings.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { ARRAY_DEFAULT_OPTIONS, logger, requireSiblingsOperations } from '../../utils.js'; const RULE_ID = 'selection-set-depth'; diff --git a/packages/plugin/__tests__/__snapshots__/selection-set-depth.spec.md b/packages/plugin/src/rules/selection-set-depth/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/selection-set-depth.spec.md rename to packages/plugin/src/rules/selection-set-depth/snapshot.md diff --git a/packages/plugin/__tests__/strict-id-in-types.spec.ts b/packages/plugin/src/rules/strict-id-in-types/index.test.ts similarity index 97% rename from packages/plugin/__tests__/strict-id-in-types.spec.ts rename to packages/plugin/src/rules/strict-id-in-types/index.test.ts index 79e60f2164e..ad76fe45327 100644 --- a/packages/plugin/__tests__/strict-id-in-types.spec.ts +++ b/packages/plugin/src/rules/strict-id-in-types/index.test.ts @@ -1,5 +1,5 @@ -import { rule, RuleOptions } from '../src/rules/strict-id-in-types.js'; -import { ruleTester, withSchema } from './test-utils.js'; +import { ruleTester, withSchema } from '../../../__tests__/test-utils.js'; +import { rule, RuleOptions } from './index.js'; ruleTester.run('strict-id-in-types', rule, { valid: [ diff --git a/packages/plugin/src/rules/strict-id-in-types.ts b/packages/plugin/src/rules/strict-id-in-types/index.ts similarity index 97% rename from packages/plugin/src/rules/strict-id-in-types.ts rename to packages/plugin/src/rules/strict-id-in-types/index.ts index ee64dde83d8..a9584924f7d 100644 --- a/packages/plugin/src/rules/strict-id-in-types.ts +++ b/packages/plugin/src/rules/strict-id-in-types/index.ts @@ -1,14 +1,14 @@ import { Kind, ObjectTypeDefinitionNode } from 'graphql'; import { FromSchema } from 'json-schema-to-ts'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; import { ARRAY_DEFAULT_OPTIONS, displayNodeName, englishJoinWords, requireGraphQLSchemaFromContext, truthy, -} from '../utils.js'; +} from '../../utils.js'; const RULE_ID = 'strict-id-in-types'; diff --git a/packages/plugin/__tests__/__snapshots__/strict-id-in-types.spec.md b/packages/plugin/src/rules/strict-id-in-types/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/strict-id-in-types.spec.md rename to packages/plugin/src/rules/strict-id-in-types/snapshot.md diff --git a/packages/plugin/__tests__/unique-enum-value-names.spec.ts b/packages/plugin/src/rules/unique-enum-value-names/index.test.ts similarity index 67% rename from packages/plugin/__tests__/unique-enum-value-names.spec.ts rename to packages/plugin/src/rules/unique-enum-value-names/index.test.ts index a1f3517977c..f0a85f66aba 100644 --- a/packages/plugin/__tests__/unique-enum-value-names.spec.ts +++ b/packages/plugin/src/rules/unique-enum-value-names/index.test.ts @@ -1,5 +1,5 @@ -import { rule } from '../src/rules/unique-enum-value-names.js'; -import { ruleTester } from './test-utils.js'; +import { ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; ruleTester.run('unique-enum-value-names', rule, { valid: [], diff --git a/packages/plugin/src/rules/unique-enum-value-names.ts b/packages/plugin/src/rules/unique-enum-value-names/index.ts similarity index 91% rename from packages/plugin/src/rules/unique-enum-value-names.ts rename to packages/plugin/src/rules/unique-enum-value-names/index.ts index 7adb9930e10..de783423d96 100644 --- a/packages/plugin/src/rules/unique-enum-value-names.ts +++ b/packages/plugin/src/rules/unique-enum-value-names/index.ts @@ -1,7 +1,7 @@ import { EnumTypeDefinitionNode, EnumTypeExtensionNode, Kind } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { getNodeName } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { getNodeName } from '../../utils.js'; export const rule: GraphQLESLintRule = { meta: { diff --git a/packages/plugin/__tests__/__snapshots__/unique-enum-value-names.spec.md b/packages/plugin/src/rules/unique-enum-value-names/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/unique-enum-value-names.spec.md rename to packages/plugin/src/rules/unique-enum-value-names/snapshot.md diff --git a/packages/plugin/__tests__/unique-fragment-name.spec.ts b/packages/plugin/src/rules/unique-fragment-name/index.test.ts similarity index 70% rename from packages/plugin/__tests__/unique-fragment-name.spec.ts rename to packages/plugin/src/rules/unique-fragment-name/index.test.ts index 0bbee412f35..6111e436782 100644 --- a/packages/plugin/__tests__/unique-fragment-name.spec.ts +++ b/packages/plugin/src/rules/unique-fragment-name/index.test.ts @@ -1,6 +1,7 @@ import { join } from 'node:path'; -import { rule } from '../src/rules/unique-fragment-name.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { CWD } from '@/utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; const TEST_FRAGMENT = /* GraphQL */ ` fragment HasIdFields on HasId { @@ -25,16 +26,16 @@ ruleTester.run('unique-fragment-name', rule, { { // Assert `skipGraphQLImport` is set to true ...SIBLING_FRAGMENTS( - join(__dirname, 'mocks/user-fields.graphql'), - join(__dirname, 'mocks/user.graphql'), + join(CWD, '__tests__/mocks/user-fields.graphql'), + join(CWD, '__tests__/mocks/user.graphql'), ), - filename: join(__dirname, 'mocks/user-fields.graphql'), + filename: join(CWD, '__tests__/mocks/user-fields.graphql'), code: ruleTester.fromMockFile('user-fields.graphql'), }, { // Compare filepath of code as real instead of virtual with siblings - ...SIBLING_FRAGMENTS(join(__dirname, 'mocks/unique-fragment.js')), - filename: join(__dirname, 'mocks/unique-fragment.js/0_document.graphql'), + ...SIBLING_FRAGMENTS(join(CWD, '__tests__/mocks/unique-fragment.js')), + filename: join(CWD, '__tests__/mocks/unique-fragment.js/0_document.graphql'), code: /* GraphQL */ ` fragment UserFields on User { id diff --git a/packages/plugin/src/rules/unique-fragment-name.ts b/packages/plugin/src/rules/unique-fragment-name/index.ts similarity index 90% rename from packages/plugin/src/rules/unique-fragment-name.ts rename to packages/plugin/src/rules/unique-fragment-name/index.ts index 6c76cd02347..1946ffcdb6d 100644 --- a/packages/plugin/src/rules/unique-fragment-name.ts +++ b/packages/plugin/src/rules/unique-fragment-name/index.ts @@ -1,9 +1,14 @@ import { relative } from 'node:path'; import { ExecutableDefinitionNode, Kind } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { FragmentSource, OperationSource } from '../siblings.js'; -import { GraphQLESLintRule, GraphQLESLintRuleContext } from '../types.js'; -import { CWD, normalizePath, requireSiblingsOperations, VIRTUAL_DOCUMENT_REGEX } from '../utils.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { FragmentSource, OperationSource } from '../../siblings.js'; +import { GraphQLESLintRule, GraphQLESLintRuleContext } from '../../types.js'; +import { + CWD, + normalizePath, + requireSiblingsOperations, + VIRTUAL_DOCUMENT_REGEX, +} from '../../utils.js'; const RULE_ID = 'unique-fragment-name'; diff --git a/packages/plugin/__tests__/__snapshots__/unique-fragment-name.spec.md b/packages/plugin/src/rules/unique-fragment-name/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/unique-fragment-name.spec.md rename to packages/plugin/src/rules/unique-fragment-name/snapshot.md diff --git a/packages/plugin/__tests__/unique-operation-name.spec.ts b/packages/plugin/src/rules/unique-operation-name/index.test.ts similarity index 75% rename from packages/plugin/__tests__/unique-operation-name.spec.ts rename to packages/plugin/src/rules/unique-operation-name/index.test.ts index b6dc02ccd8b..63450f10a45 100644 --- a/packages/plugin/__tests__/unique-operation-name.spec.ts +++ b/packages/plugin/src/rules/unique-operation-name/index.test.ts @@ -1,6 +1,7 @@ import { join } from 'node:path'; -import { rule } from '../src/rules/unique-operation-name.js'; -import { ParserOptionsForTests, ruleTester } from './test-utils.js'; +import { CWD } from '@/utils.js'; +import { ParserOptionsForTests, ruleTester } from '../../../__tests__/test-utils.js'; +import { rule } from './index.js'; const TEST_OPERATION = 'query test { foo }'; @@ -20,8 +21,8 @@ ruleTester.run('unique-operation-name', rule, { }, { // Compare filepath of code as real instead of virtual with siblings - ...SIBLING_OPERATIONS(join(__dirname, 'mocks/unique-fragment.js')), - filename: join(__dirname, 'mocks/unique-fragment.js/1_document.graphql'), + ...SIBLING_OPERATIONS(join(CWD, '__tests__/mocks/unique-fragment.js')), + filename: join(CWD, '__tests__/mocks/unique-fragment.js/1_document.graphql'), code: /* GraphQL */ ` query User { user { diff --git a/packages/plugin/src/rules/unique-operation-name.ts b/packages/plugin/src/rules/unique-operation-name/index.ts similarity index 88% rename from packages/plugin/src/rules/unique-operation-name.ts rename to packages/plugin/src/rules/unique-operation-name/index.ts index e2d33faee0b..3eb27d04e4f 100644 --- a/packages/plugin/src/rules/unique-operation-name.ts +++ b/packages/plugin/src/rules/unique-operation-name/index.ts @@ -1,7 +1,7 @@ import { OperationDefinitionNode } from 'graphql'; -import { GraphQLESTreeNode } from '../estree-converter/index.js'; -import { GraphQLESLintRule } from '../types.js'; -import { checkNode } from './unique-fragment-name.js'; +import { GraphQLESTreeNode } from '../../estree-converter/index.js'; +import { GraphQLESLintRule } from '../../types.js'; +import { checkNode } from '../unique-fragment-name/index.js'; const RULE_ID = 'unique-operation-name'; diff --git a/packages/plugin/__tests__/__snapshots__/unique-operation-name.spec.md b/packages/plugin/src/rules/unique-operation-name/snapshot.md similarity index 100% rename from packages/plugin/__tests__/__snapshots__/unique-operation-name.spec.md rename to packages/plugin/src/rules/unique-operation-name/snapshot.md diff --git a/packages/plugin/tsconfig.json b/packages/plugin/tsconfig.json index 3cbe672f218..10eda907ff3 100644 --- a/packages/plugin/tsconfig.json +++ b/packages/plugin/tsconfig.json @@ -12,6 +12,7 @@ "resolveJsonModule": true, "skipLibCheck": true, "paths": { + "@/*": ["./src/*"], "@graphql-eslint/eslint-plugin": ["./src/index.ts"] } }, diff --git a/packages/plugin/tsup.config.ts b/packages/plugin/tsup.config.ts index ec995dba8c6..68190591cf1 100644 --- a/packages/plugin/tsup.config.ts +++ b/packages/plugin/tsup.config.ts @@ -4,7 +4,7 @@ import { defineConfig, Options } from 'tsup'; import packageJson from './package.json'; const opts: Options = { - entry: ['src/**/*.ts', '!src/index.browser.ts'], + entry: ['src/**/*.ts', '!src/index.browser.ts', '!src/**/*.test.ts'], clean: true, bundle: false, dts: true, diff --git a/packages/plugin/vite.config.ts b/packages/plugin/vite.config.ts index a0ec799790e..61782dbab57 100644 --- a/packages/plugin/vite.config.ts +++ b/packages/plugin/vite.config.ts @@ -7,8 +7,13 @@ const GRAPHQL_PATH = path.join(__dirname, 'node_modules', 'graphql'); export default defineConfig({ test: { globals: true, - resolveSnapshotPath: testPath => - testPath.replace('__tests__/', '__tests__/__snapshots__/').replace(/\.ts$/, '.md'), + resolveSnapshotPath(testPath) { + if (testPath.endsWith('/index.test.ts')) { + return testPath.replace('/index.test.ts', '/snapshot.md'); + } + + return testPath.replace('__tests__/', '__tests__/__snapshots__/').replace(/\.ts$/, '.md'); + }, setupFiles: ['./serializer.ts'], alias: { // fixes Duplicate "graphql" modules cannot be used at the same time since different diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 38d4cbf52ab..468da8c59d5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,7 +27,7 @@ importers: version: 2.27.9 '@graphql-tools/utils': specifier: 10.5.5 - version: 10.5.6(graphql@16.9.0) + version: 10.5.5(graphql@16.9.0) '@theguild/eslint-config': specifier: 0.13.0 version: 0.13.0(eslint@9.9.0(patch_hash=t64n7kxodazs6lnwu42sgf5voe)(jiti@2.4.0))(typescript@5.6.3) @@ -245,7 +245,7 @@ importers: version: 8.3.3(graphql@16.9.0) '@graphql-tools/utils': specifier: ^10.0.0 - version: 10.5.6(graphql@16.9.0) + version: 10.5.5(graphql@16.9.0) debug: specifier: ^4.3.4 version: 4.3.7 @@ -1759,6 +1759,12 @@ packages: peerDependencies: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 + '@graphql-tools/utils@10.5.5': + resolution: {integrity: sha512-LF/UDWmMT0mnobL2UZETwYghV7HYBzNaGj0SAkCYOMy/C3+6sQdbcTksnoFaKR9XIVD78jNXEGfivbB8Zd+cwA==} + engines: {node: '>=16.0.0'} + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 + '@graphql-tools/utils@10.5.6': resolution: {integrity: sha512-JAC44rhbLzXUHiltceyEpWkxmX4e45Dfg19wRFoA9EbDxQVbOzVNF76eEECdg0J1owFsJwfLqCwz7/6xzrovOw==} engines: {node: '>=16.0.0'} @@ -9725,7 +9731,7 @@ snapshots: '@graphql-tools/batch-execute@9.0.5(graphql@16.9.0)': dependencies: - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) dataloader: 2.2.2 graphql: 16.9.0 tslib: 2.8.1 @@ -9747,7 +9753,7 @@ snapshots: '@graphql-tools/batch-execute': 9.0.5(graphql@16.9.0) '@graphql-tools/executor': 1.3.2(graphql@16.9.0) '@graphql-tools/schema': 10.0.7(graphql@16.9.0) - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) '@repeaterjs/repeater': 3.0.6 dataloader: 2.2.2 dset: 3.1.4 @@ -9756,7 +9762,7 @@ snapshots: '@graphql-tools/executor-graphql-ws@1.3.1(graphql@16.9.0)': dependencies: - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) '@types/ws': 8.5.13 graphql: 16.9.0 graphql-ws: 5.16.0(graphql@16.9.0) @@ -9769,7 +9775,7 @@ snapshots: '@graphql-tools/executor-http@1.1.8(@types/node@22.9.0)(graphql@16.9.0)': dependencies: - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) '@repeaterjs/repeater': 3.0.6 '@whatwg-node/fetch': 0.10.1 extract-files: 11.0.0 @@ -9782,7 +9788,7 @@ snapshots: '@graphql-tools/executor-legacy-ws@1.1.1(graphql@16.9.0)': dependencies: - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) '@types/ws': 8.5.13 graphql: 16.9.0 isomorphic-ws: 5.0.0(ws@8.18.0) @@ -9794,7 +9800,7 @@ snapshots: '@graphql-tools/executor@1.3.2(graphql@16.9.0)': dependencies: - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) '@graphql-typed-document-node/core': 3.2.0(graphql@16.9.0) '@repeaterjs/repeater': 3.0.6 graphql: 16.9.0 @@ -9804,7 +9810,7 @@ snapshots: '@graphql-tools/graphql-file-loader@8.0.2(graphql@16.9.0)': dependencies: '@graphql-tools/import': 7.0.2(graphql@16.9.0) - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) globby: 11.1.0 graphql: 16.9.0 tslib: 2.8.1 @@ -9817,7 +9823,7 @@ snapshots: '@babel/plugin-syntax-import-assertions': 7.26.0(@babel/core@7.26.0) '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) graphql: 16.9.0 tslib: 2.8.1 transitivePeerDependencies: @@ -9838,14 +9844,14 @@ snapshots: '@graphql-tools/import@7.0.2(graphql@16.9.0)': dependencies: - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) graphql: 16.9.0 resolve-from: 5.0.0 tslib: 2.8.1 '@graphql-tools/json-file-loader@8.0.2(graphql@16.9.0)': dependencies: - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) globby: 11.1.0 graphql: 16.9.0 tslib: 2.8.1 @@ -9854,21 +9860,21 @@ snapshots: '@graphql-tools/load@8.0.3(graphql@16.9.0)': dependencies: '@graphql-tools/schema': 10.0.7(graphql@16.9.0) - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) graphql: 16.9.0 p-limit: 3.1.0 tslib: 2.8.1 '@graphql-tools/merge@9.0.8(graphql@16.9.0)': dependencies: - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) graphql: 16.9.0 tslib: 2.8.1 '@graphql-tools/schema@10.0.7(graphql@16.9.0)': dependencies: '@graphql-tools/merge': 9.0.8(graphql@16.9.0) - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) graphql: 16.9.0 tslib: 2.8.1 value-or-promise: 1.0.12 @@ -9879,7 +9885,7 @@ snapshots: '@graphql-tools/executor-graphql-ws': 1.3.1(graphql@16.9.0) '@graphql-tools/executor-http': 1.1.8(@types/node@22.9.0)(graphql@16.9.0) '@graphql-tools/executor-legacy-ws': 1.1.1(graphql@16.9.0) - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) '@graphql-tools/wrap': 10.0.15(graphql@16.9.0) '@types/ws': 8.5.13 '@whatwg-node/fetch': 0.10.1 @@ -9894,6 +9900,14 @@ snapshots: - encoding - utf-8-validate + '@graphql-tools/utils@10.5.5(graphql@16.9.0)': + dependencies: + '@graphql-typed-document-node/core': 3.2.0(graphql@16.9.0) + cross-inspect: 1.0.1 + dset: 3.1.4 + graphql: 16.9.0 + tslib: 2.8.1 + '@graphql-tools/utils@10.5.6(graphql@16.9.0)': dependencies: '@graphql-typed-document-node/core': 3.2.0(graphql@16.9.0) @@ -9906,7 +9920,7 @@ snapshots: dependencies: '@graphql-tools/delegate': 10.1.1(graphql@16.9.0) '@graphql-tools/schema': 10.0.7(graphql@16.9.0) - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) graphql: 16.9.0 tslib: 2.8.1 value-or-promise: 1.0.12 @@ -11121,7 +11135,7 @@ snapshots: '@typescript-eslint/eslint-plugin@7.16.1(@typescript-eslint/parser@8.13.0(eslint@9.9.0(patch_hash=t64n7kxodazs6lnwu42sgf5voe)(jiti@2.4.0))(typescript@5.6.3))(eslint@9.9.0(patch_hash=t64n7kxodazs6lnwu42sgf5voe)(jiti@2.4.0))(typescript@5.6.2)': dependencies: - '@eslint-community/regexpp': 4.11.1 + '@eslint-community/regexpp': 4.12.1 '@typescript-eslint/parser': 8.13.0(eslint@9.9.0(patch_hash=t64n7kxodazs6lnwu42sgf5voe)(jiti@2.4.0))(typescript@5.6.3) '@typescript-eslint/scope-manager': 7.16.1 '@typescript-eslint/type-utils': 7.16.1(eslint@9.9.0(patch_hash=t64n7kxodazs6lnwu42sgf5voe)(jiti@2.4.0))(typescript@5.6.2) @@ -13357,7 +13371,7 @@ snapshots: '@graphql-tools/load': 8.0.3(graphql@16.9.0) '@graphql-tools/merge': 9.0.8(graphql@16.9.0) '@graphql-tools/url-loader': 8.0.14(@types/node@22.9.0)(graphql@16.9.0) - '@graphql-tools/utils': 10.5.6(graphql@16.9.0) + '@graphql-tools/utils': 10.5.5(graphql@16.9.0) cosmiconfig: 8.3.6(typescript@5.6.3) graphql: 16.9.0 jiti: 2.4.0 @@ -15473,7 +15487,7 @@ snapshots: refa@0.12.1: dependencies: - '@eslint-community/regexpp': 4.11.1 + '@eslint-community/regexpp': 4.12.1 reflect.getprototypeof@1.0.6: dependencies: @@ -15501,7 +15515,7 @@ snapshots: regexp-ast-analysis@0.7.1: dependencies: - '@eslint-community/regexpp': 4.11.1 + '@eslint-community/regexpp': 4.12.1 refa: 0.12.1 regexp-tree@0.1.27: {} @@ -15789,7 +15803,7 @@ snapshots: scslre@0.3.0: dependencies: - '@eslint-community/regexpp': 4.11.1 + '@eslint-community/regexpp': 4.12.1 refa: 0.12.1 regexp-ast-analysis: 0.7.1 diff --git a/scripts/generate-configs.ts b/scripts/generate-configs.ts index b4490f54206..ce2af7785d3 100644 --- a/scripts/generate-configs.ts +++ b/scripts/generate-configs.ts @@ -42,14 +42,13 @@ export = ${JSON.stringify(code)}`; }; const ruleFilenames = readdirSync(join(SRC_PATH, 'rules')) - .filter(filename => filename.endsWith('.ts') && !IGNORE_FILES.includes(filename)) - .map(filename => filename.replace(/\.ts$/, '')); + .filter(filename => !IGNORE_FILES.includes(filename)) async function generateRules(): Promise { const code = [ "import { GRAPHQL_JS_VALIDATIONS } from './graphql-js-validation.js'", ...ruleFilenames.map( - ruleName => `import { rule as ${camelCase(ruleName)} } from './${ruleName}.js'`, + ruleName => `import { rule as ${camelCase(ruleName)} } from './${ruleName}/index.js'`, ), BR, 'export const rules = {',