diff --git a/.changeset/happy-bottles-warn.md b/.changeset/happy-bottles-warn.md new file mode 100644 index 00000000000..e1f077b8bd8 --- /dev/null +++ b/.changeset/happy-bottles-warn.md @@ -0,0 +1,6 @@ +--- +'@graphql-eslint/eslint-plugin': minor +--- + +introduce `forbiddenPattern` and `requiredPattern` options for `naming-convention` rule and +deprecate `forbiddenPrefixes`, `forbiddenSuffixes` and `requiredPrefixes` and `requiredSuffixes` diff --git a/packages/plugin/__tests__/__snapshots__/examples.spec.md b/packages/plugin/__tests__/__snapshots__/examples.spec.md index cab5484eb18..d2be9d53da2 100644 --- a/packages/plugin/__tests__/__snapshots__/examples.spec.md +++ b/packages/plugin/__tests__/__snapshots__/examples.spec.md @@ -10,7 +10,7 @@ exports[`Examples > should work in monorepo 1`] = ` endColumn: 15, endLine: 1, line: 1, - message: Operation "getUsers" should be in PascalCase format, + message: Query "getUsers" should be in PascalCase format, nodeType: Name, ruleId: @graphql-eslint/naming-convention, severity: 2, @@ -198,7 +198,7 @@ exports[`Examples > should work in monorepo 2`] = ` endColumn: 15, endLine: 1, line: 1, - message: Operation "getUsers" should be in PascalCase format, + message: Query "getUsers" should be in PascalCase format, nodeType: Name, ruleId: @graphql-eslint/naming-convention, severity: 2, @@ -583,7 +583,7 @@ exports[`Examples > should work in svelte 1`] = ` { column: 0, line: 1, - message: Operation "UserQuery" should not have "Query" suffix, + message: Query "UserQuery" should not have "Query" suffix, nodeType: Name, ruleId: @graphql-eslint/naming-convention, severity: 2, @@ -610,7 +610,7 @@ exports[`Examples > should work in svelte 2`] = ` { column: 0, line: 1, - message: Operation "UserQuery" should not have "Query" suffix, + message: Query "UserQuery" should not have "Query" suffix, nodeType: Name, ruleId: @graphql-eslint/naming-convention, severity: 2, @@ -675,7 +675,7 @@ exports[`Examples > should work in vue 1`] = ` endColumn: 19, endLine: 16, line: 16, - message: Operation "UserQuery" should not have "Query" suffix, + message: Query "UserQuery" should not have "Query" suffix, nodeType: Name, ruleId: @graphql-eslint/naming-convention, severity: 2, @@ -714,7 +714,7 @@ exports[`Examples > should work in vue 2`] = ` { column: 0, line: 1, - message: Operation "UserQuery" should not have "Query" suffix, + message: Query "UserQuery" should not have "Query" suffix, nodeType: Name, ruleId: @graphql-eslint/naming-convention, severity: 2, @@ -822,7 +822,7 @@ exports[`Examples > should work on \`.js\` files 1`] = ` endColumn: 18, endLine: 12, line: 12, - message: Operation "UserQuery" should not have "Query" suffix, + message: Query "UserQuery" should not have "Query" suffix, nodeType: Name, ruleId: @graphql-eslint/naming-convention, severity: 2, @@ -920,7 +920,7 @@ exports[`Examples > should work on \`.js\` files 2`] = ` endColumn: 18, endLine: 12, line: 12, - message: Operation "UserQuery" should not have "Query" suffix, + message: Query "UserQuery" should not have "Query" suffix, nodeType: Name, ruleId: @graphql-eslint/naming-convention, severity: 2, diff --git a/packages/plugin/src/rules/naming-convention/index.test.ts b/packages/plugin/src/rules/naming-convention/index.test.ts index d7ea9eb403d..a605d20dac9 100644 --- a/packages/plugin/src/rules/naming-convention/index.test.ts +++ b/packages/plugin/src/rules/naming-convention/index.test.ts @@ -259,49 +259,44 @@ ruleTester.run('naming-convention', rule, { ], errors: [ { - message: - 'Input type "_idOperatorsFilterFindManyUserInput" should be in PascalCase format', + message: 'Input "_idOperatorsFilterFindManyUserInput" should be in PascalCase format', }, { - message: 'Input type "_idOperatorsFilterFindOneUserInput" should be in PascalCase format', + message: 'Input "_idOperatorsFilterFindOneUserInput" should be in PascalCase format', }, { - message: - 'Input type "_idOperatorsFilterRemoveManyUserInput" should be in PascalCase format', + message: 'Input "_idOperatorsFilterRemoveManyUserInput" should be in PascalCase format', }, { - message: - 'Input type "_idOperatorsFilterRemoveOneUserInput" should be in PascalCase format', + message: 'Input "_idOperatorsFilterRemoveOneUserInput" should be in PascalCase format', }, { - message: - 'Input type "_idOperatorsFilterUpdateManyUserInput" should be in PascalCase format', + message: 'Input "_idOperatorsFilterUpdateManyUserInput" should be in PascalCase format', }, { - message: - 'Input type "_idOperatorsFilterUpdateOneUserInput" should be in PascalCase format', + message: 'Input "_idOperatorsFilterUpdateOneUserInput" should be in PascalCase format', }, - { message: 'Input type "_idOperatorsFilterUserInput" should be in PascalCase format' }, - { message: 'Enumeration value "male" should be in UPPER_CASE format' }, - { message: 'Enumeration value "female" should be in UPPER_CASE format' }, - { message: 'Enumeration value "ladyboy" should be in UPPER_CASE format' }, - { message: 'Enumeration value "basic" should be in UPPER_CASE format' }, - { message: 'Enumeration value "fluent" should be in UPPER_CASE format' }, - { message: 'Enumeration value "native" should be in UPPER_CASE format' }, - { message: 'Input property "OR" should be in camelCase format' }, - { message: 'Input property "AND" should be in camelCase format' }, - { message: 'Input property "OR" should be in camelCase format' }, - { message: 'Input property "AND" should be in camelCase format' }, - { message: 'Input property "OR" should be in camelCase format' }, - { message: 'Input property "AND" should be in camelCase format' }, - { message: 'Input property "OR" should be in camelCase format' }, - { message: 'Input property "AND" should be in camelCase format' }, - { message: 'Input property "OR" should be in camelCase format' }, - { message: 'Input property "AND" should be in camelCase format' }, - { message: 'Input property "OR" should be in camelCase format' }, - { message: 'Input property "AND" should be in camelCase format' }, - { message: 'Input property "OR" should be in camelCase format' }, - { message: 'Input property "AND" should be in camelCase format' }, + { message: 'Input "_idOperatorsFilterUserInput" should be in PascalCase format' }, + { message: 'Enum value "male" should be in UPPER_CASE format' }, + { message: 'Enum value "female" should be in UPPER_CASE format' }, + { message: 'Enum value "ladyboy" should be in UPPER_CASE format' }, + { message: 'Enum value "basic" should be in UPPER_CASE format' }, + { message: 'Enum value "fluent" should be in UPPER_CASE format' }, + { message: 'Enum value "native" should be in UPPER_CASE format' }, + { message: 'Input value "OR" should be in camelCase format' }, + { message: 'Input value "AND" should be in camelCase format' }, + { message: 'Input value "OR" should be in camelCase format' }, + { message: 'Input value "AND" should be in camelCase format' }, + { message: 'Input value "OR" should be in camelCase format' }, + { message: 'Input value "AND" should be in camelCase format' }, + { message: 'Input value "OR" should be in camelCase format' }, + { message: 'Input value "AND" should be in camelCase format' }, + { message: 'Input value "OR" should be in camelCase format' }, + { message: 'Input value "AND" should be in camelCase format' }, + { message: 'Input value "OR" should be in camelCase format' }, + { message: 'Input value "AND" should be in camelCase format' }, + { message: 'Input value "OR" should be in camelCase format' }, + { message: 'Input value "AND" should be in camelCase format' }, ], }, { @@ -313,16 +308,16 @@ ruleTester.run('naming-convention', rule, { }, ], errors: [ - { message: 'Enumerator "B" should be in camelCase format' }, - { message: 'Enumeration value "test" should be in UPPER_CASE format' }, + { message: 'Enum "B" should be in camelCase format' }, + { message: 'Enum value "test" should be in UPPER_CASE format' }, ], }, { code: 'input test { _Value: String }', options: [{ types: 'PascalCase', InputValueDefinition: 'snake_case' }], errors: [ - { message: 'Input type "test" should be in PascalCase format' }, - { message: 'Input property "_Value" should be in snake_case format' }, + { message: 'Input "test" should be in PascalCase format' }, + { message: 'Input value "_Value" should be in snake_case format' }, { message: 'Leading underscores are not allowed' }, ], }, @@ -338,8 +333,8 @@ ruleTester.run('naming-convention', rule, { errors: [ { message: 'Type "TypeOne" should be in camelCase format' }, { message: 'Field "aField" should have "AAA" suffix' }, - { message: 'Enumeration value "VALUE_ONE" should have "ENUM" suffix' }, - { message: 'Enumeration value "VALUE_TWO" should have "ENUM" suffix' }, + { message: 'Enum value "VALUE_ONE" should have "ENUM" suffix' }, + { message: 'Enum value "VALUE_TWO" should have "ENUM" suffix' }, ], }, { @@ -353,8 +348,8 @@ ruleTester.run('naming-convention', rule, { ], errors: [ { message: 'Field "aField" should have "Field" prefix' }, - { message: 'Enumeration value "A_ENUM_VALUE_ONE" should have "ENUM" prefix' }, - { message: 'Enumeration value "VALUE_TWO" should have "ENUM" prefix' }, + { message: 'Enum value "A_ENUM_VALUE_ONE" should have "ENUM" prefix' }, + { message: 'Enum value "VALUE_TWO" should have "ENUM" prefix' }, ], }, { @@ -385,8 +380,8 @@ ruleTester.run('naming-convention', rule, { code: 'query Foo { foo } query getBar { bar }', options: [{ OperationDefinition: { style: 'camelCase', forbiddenPrefixes: ['get'] } }], errors: [ - { message: 'Operation "Foo" should be in camelCase format' }, - { message: 'Operation "getBar" should not have "get" prefix' }, + { message: 'Query "Foo" should be in camelCase format' }, + { message: 'Query "getBar" should not have "get" prefix' }, ], }, { @@ -448,13 +443,13 @@ ruleTester.run('naming-convention', rule, { `, options: (rule.meta.docs!.configOptions as any).operations, errors: [ - { message: 'Operation "TestQuery" should not have "Query" suffix' }, - { message: 'Operation "QueryTest" should not have "Query" prefix' }, - { message: 'Operation "GetQuery" should not have "Get" prefix' }, - { message: 'Operation "TestMutation" should not have "Mutation" suffix' }, - { message: 'Operation "MutationTest" should not have "Mutation" prefix' }, - { message: 'Operation "TestSubscription" should not have "Subscription" suffix' }, - { message: 'Operation "SubscriptionTest" should not have "Subscription" prefix' }, + { message: 'Query "TestQuery" should not have "Query" suffix' }, + { message: 'Query "QueryTest" should not have "Query" prefix' }, + { message: 'Query "GetQuery" should not have "Get" prefix' }, + { message: 'Mutation "TestMutation" should not have "Mutation" suffix' }, + { message: 'Mutation "MutationTest" should not have "Mutation" prefix' }, + { message: 'Subscription "TestSubscription" should not have "Subscription" suffix' }, + { message: 'Subscription "SubscriptionTest" should not have "Subscription" prefix' }, { message: 'Fragment "TestFragment" should not have "Fragment" suffix' }, { message: 'Fragment "FragmentTest" should not have "Fragment" prefix' }, ], @@ -531,5 +526,24 @@ ruleTester.run('naming-convention', rule, { ], errors: 2, }, + { + name: 'forbiddenPattern', + code: 'query queryFoo { foo } query getBar { bar }', + options: [{ OperationDefinition: { forbiddenPattern: [/^(get|query)/] } }], + errors: 2, + }, + { + name: 'requiredPattern', + code: 'type Test { enabled: Boolean! }', + options: [ + { + 'FieldDefinition[gqlType.gqlType.name.value=Boolean]': { + style: 'camelCase', + requiredPattern: [/^(is|has)/], + }, + }, + ], + errors: 1, + }, ], }); diff --git a/packages/plugin/src/rules/naming-convention/index.ts b/packages/plugin/src/rules/naming-convention/index.ts index 8917e23dfee..5d2068d3f2f 100644 --- a/packages/plugin/src/rules/naming-convention/index.ts +++ b/packages/plugin/src/rules/naming-convention/index.ts @@ -5,6 +5,7 @@ import { GraphQLESLintRule, GraphQLESLintRuleListener, ValueOf } from '../../typ import { ARRAY_DEFAULT_OPTIONS, convertCase, + displayNodeName, englishJoinWords, truthy, TYPES_KINDS, @@ -47,6 +48,11 @@ const schemaOption = { oneOf: [{ $ref: '#/definitions/asString' }, { $ref: '#/definitions/asObject' }], } as const; +const descriptionPrefixesSuffixes = (name: 'forbiddenPattern' | 'requiredPattern') => + `> [!WARNING] +> +> This option is deprecated and will be removed in the next major release. Use [\`${name}\`](#${name.toLowerCase()}-array) instead.`; + const schema = { definitions: { asString: { @@ -60,10 +66,36 @@ const schema = { style: { enum: ALLOWED_STYLES }, prefix: { type: 'string' }, suffix: { type: 'string' }, - forbiddenPrefixes: ARRAY_DEFAULT_OPTIONS, - forbiddenSuffixes: ARRAY_DEFAULT_OPTIONS, - requiredPrefixes: ARRAY_DEFAULT_OPTIONS, - requiredSuffixes: ARRAY_DEFAULT_OPTIONS, + forbiddenPattern: { + ...ARRAY_DEFAULT_OPTIONS, + items: { + type: 'object', + }, + description: 'Should be of instance of `RegEx`', + }, + requiredPattern: { + ...ARRAY_DEFAULT_OPTIONS, + items: { + type: 'object', + }, + description: 'Should be of instance of `RegEx`', + }, + forbiddenPrefixes: { + ...ARRAY_DEFAULT_OPTIONS, + description: descriptionPrefixesSuffixes('forbiddenPattern'), + }, + forbiddenSuffixes: { + ...ARRAY_DEFAULT_OPTIONS, + description: descriptionPrefixesSuffixes('forbiddenPattern'), + }, + requiredPrefixes: { + ...ARRAY_DEFAULT_OPTIONS, + description: descriptionPrefixesSuffixes('requiredPattern'), + }, + requiredSuffixes: { + ...ARRAY_DEFAULT_OPTIONS, + description: descriptionPrefixesSuffixes('requiredPattern'), + }, ignorePattern: { type: 'string', description: 'Option to skip validation of some words, e.g. acronyms', @@ -118,6 +150,8 @@ type PropertySchema = { style?: AllowedStyle; suffix?: string; prefix?: string; + forbiddenPattern?: RegExp[]; + requiredPattern?: RegExp[]; forbiddenPrefixes?: string[]; forbiddenSuffixes?: string[]; requiredPrefixes?: string[]; @@ -341,8 +375,9 @@ export const rule: GraphQLESLintRule = { ignorePattern, requiredPrefixes, requiredSuffixes, + forbiddenPattern, + requiredPattern, } = normalisePropertyOption(selector); - const nodeType = KindToDisplayName[n.kind] || n.kind; const nodeName = node.value; const error = getError(); if (error) { @@ -352,7 +387,12 @@ export const rule: GraphQLESLintRule = { const suggestedNames = renameToNames.map( renameToName => leadingUnderscores + renameToName + trailingUnderscores, ); - report(node, `${nodeType} "${nodeName}" should ${errorMessage}`, suggestedNames); + const name = displayNodeName(n); + report( + node, + `${name[0].toUpperCase()}${name.slice(1)} should ${errorMessage}`, + suggestedNames, + ); } function getError(): { @@ -375,6 +415,19 @@ export const rule: GraphQLESLintRule = { renameToNames: [name + suffix], }; } + const forbidden = forbiddenPattern?.find(pattern => pattern.test(name)); + if (forbidden) { + return { + errorMessage: `not contain the forbidden pattern "${forbidden}"`, + renameToNames: [name.replace(forbidden, '')], + }; + } + if (requiredPattern && !requiredPattern.some(pattern => pattern.test(name))) { + return { + errorMessage: `contain the required pattern: ${englishJoinWords(requiredPattern.map(re => re.source))}`, + renameToNames: [], + }; + } const forbiddenPrefix = forbiddenPrefixes?.find(prefix => name.startsWith(prefix)); if (forbiddenPrefix) { return { diff --git a/packages/plugin/src/rules/naming-convention/snapshot.md b/packages/plugin/src/rules/naming-convention/snapshot.md index efd3190bf74..13075e5ba5f 100644 --- a/packages/plugin/src/rules/naming-convention/snapshot.md +++ b/packages/plugin/src/rules/naming-convention/snapshot.md @@ -98,7 +98,7 @@ exports[`naming-convention > invalid > Invalid #5 1`] = ` #### ❌ Error 1/2 > 1 | enum B { test } - | ^ Enumerator "B" should be in camelCase format + | ^ Enum "B" should be in camelCase format #### 💡 Suggestion: Rename to \`b\` @@ -107,7 +107,7 @@ exports[`naming-convention > invalid > Invalid #5 1`] = ` #### ❌ Error 2/2 > 1 | enum B { test } - | ^^^^ Enumeration value "test" should be in UPPER_CASE format + | ^^^^ Enum value "test" should be in UPPER_CASE format #### 💡 Suggestion: Rename to \`TEST\` @@ -129,7 +129,7 @@ exports[`naming-convention > invalid > Invalid #6 1`] = ` #### ❌ Error 1/3 > 1 | input test { _Value: String } - | ^^^^ Input type "test" should be in PascalCase format + | ^^^^ Input "test" should be in PascalCase format #### 💡 Suggestion: Rename to \`Test\` @@ -138,7 +138,7 @@ exports[`naming-convention > invalid > Invalid #6 1`] = ` #### ❌ Error 2/3 > 1 | input test { _Value: String } - | ^^^^^^ Input property "_Value" should be in snake_case format + | ^^^^^^ Input value "_Value" should be in snake_case format #### 💡 Suggestion: Rename to \`_value\` @@ -196,7 +196,7 @@ exports[`naming-convention > invalid > Invalid #7 1`] = ` #### ❌ Error 3/4 > 1 | type TypeOne { aField: String } enum Z { VALUE_ONE VALUE_TWO } - | ^^^^^^^^^ Enumeration value "VALUE_ONE" should have "ENUM" suffix + | ^^^^^^^^^ Enum value "VALUE_ONE" should have "ENUM" suffix #### 💡 Suggestion: Rename to \`VALUE_ONEENUM\` @@ -205,7 +205,7 @@ exports[`naming-convention > invalid > Invalid #7 1`] = ` #### ❌ Error 4/4 > 1 | type TypeOne { aField: String } enum Z { VALUE_ONE VALUE_TWO } - | ^^^^^^^^^ Enumeration value "VALUE_TWO" should have "ENUM" suffix + | ^^^^^^^^^ Enum value "VALUE_TWO" should have "ENUM" suffix #### 💡 Suggestion: Rename to \`VALUE_TWOENUM\` @@ -245,7 +245,7 @@ exports[`naming-convention > invalid > Invalid #8 1`] = ` #### ❌ Error 2/3 > 1 | type One { aField: String } enum Z { A_ENUM_VALUE_ONE VALUE_TWO } - | ^^^^^^^^^^^^^^^^ Enumeration value "A_ENUM_VALUE_ONE" should have "ENUM" prefix + | ^^^^^^^^^^^^^^^^ Enum value "A_ENUM_VALUE_ONE" should have "ENUM" prefix #### 💡 Suggestion: Rename to \`ENUMA_ENUM_VALUE_ONE\` @@ -254,7 +254,7 @@ exports[`naming-convention > invalid > Invalid #8 1`] = ` #### ❌ Error 3/3 > 1 | type One { aField: String } enum Z { A_ENUM_VALUE_ONE VALUE_TWO } - | ^^^^^^^^^ Enumeration value "VALUE_TWO" should have "ENUM" prefix + | ^^^^^^^^^ Enum value "VALUE_TWO" should have "ENUM" prefix #### 💡 Suggestion: Rename to \`ENUMVALUE_TWO\` @@ -359,7 +359,7 @@ exports[`naming-convention > invalid > Invalid #10 1`] = ` #### ❌ Error 1/2 > 1 | query Foo { foo } query getBar { bar } - | ^^^ Operation "Foo" should be in camelCase format + | ^^^ Query "Foo" should be in camelCase format #### 💡 Suggestion: Rename to \`foo\` @@ -368,13 +368,47 @@ exports[`naming-convention > invalid > Invalid #10 1`] = ` #### ❌ Error 2/2 > 1 | query Foo { foo } query getBar { bar } - | ^^^^^^ Operation "getBar" should not have "get" prefix + | ^^^^^^ Query "getBar" should not have "get" prefix #### 💡 Suggestion: Rename to \`Bar\` 1 | query Foo { foo } query Bar { bar } `; +exports[`naming-convention > invalid > forbiddenPattern 1`] = ` +#### ⌨️ Code + + 1 | query queryFoo { foo } query getBar { bar } + +#### ⚙️ Options + + { + "OperationDefinition": { + "forbiddenPattern": [ + "/^(get|query)/" + ] + } + } + +#### ❌ Error 1/2 + + > 1 | query queryFoo { foo } query getBar { bar } + | ^^^^^^^^ Query "queryFoo" should not contain the forbidden pattern "/^(get|query)/" + +#### 💡 Suggestion: Rename to \`Foo\` + + 1 | query Foo { foo } query getBar { bar } + +#### ❌ Error 2/2 + + > 1 | query queryFoo { foo } query getBar { bar } + | ^^^^^^ Query "getBar" should not contain the forbidden pattern "/^(get|query)/" + +#### 💡 Suggestion: Rename to \`Bar\` + + 1 | query queryFoo { foo } query Bar { bar } +`; + exports[`naming-convention > invalid > large graphql file 1`] = ` #### ⌨️ Code @@ -1501,189 +1535,189 @@ exports[`naming-convention > invalid > large graphql file 1`] = ` #### ❌ Error 1/27 > 1 | input _idOperatorsFilterFindManyUserInput { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input type "_idOperatorsFilterFindManyUserInput" should be in PascalCase format + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input "_idOperatorsFilterFindManyUserInput" should be in PascalCase format 2 | gt: MongoID #### ❌ Error 2/27 10 | > 11 | input _idOperatorsFilterFindOneUserInput { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input type "_idOperatorsFilterFindOneUserInput" should be in PascalCase format + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input "_idOperatorsFilterFindOneUserInput" should be in PascalCase format 12 | gt: MongoID #### ❌ Error 3/27 20 | > 21 | input _idOperatorsFilterRemoveManyUserInput { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input type "_idOperatorsFilterRemoveManyUserInput" should be in PascalCase format + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input "_idOperatorsFilterRemoveManyUserInput" should be in PascalCase format 22 | gt: MongoID #### ❌ Error 4/27 30 | > 31 | input _idOperatorsFilterRemoveOneUserInput { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input type "_idOperatorsFilterRemoveOneUserInput" should be in PascalCase format + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input "_idOperatorsFilterRemoveOneUserInput" should be in PascalCase format 32 | gt: MongoID #### ❌ Error 5/27 40 | > 41 | input _idOperatorsFilterUpdateManyUserInput { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input type "_idOperatorsFilterUpdateManyUserInput" should be in PascalCase format + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input "_idOperatorsFilterUpdateManyUserInput" should be in PascalCase format 42 | gt: MongoID #### ❌ Error 6/27 50 | > 51 | input _idOperatorsFilterUpdateOneUserInput { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input type "_idOperatorsFilterUpdateOneUserInput" should be in PascalCase format + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input "_idOperatorsFilterUpdateOneUserInput" should be in PascalCase format 52 | gt: MongoID #### ❌ Error 7/27 60 | > 61 | input _idOperatorsFilterUserInput { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input type "_idOperatorsFilterUserInput" should be in PascalCase format + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Input "_idOperatorsFilterUserInput" should be in PascalCase format 62 | gt: MongoID #### ❌ Error 8/27 207 | enum EnumUserGender { > 208 | male - | ^^^^ Enumeration value "male" should be in UPPER_CASE format + | ^^^^ Enum value "male" should be in UPPER_CASE format 209 | female #### ❌ Error 9/27 208 | male > 209 | female - | ^^^^^^ Enumeration value "female" should be in UPPER_CASE format + | ^^^^^^ Enum value "female" should be in UPPER_CASE format 210 | ladyboy #### ❌ Error 10/27 209 | female > 210 | ladyboy - | ^^^^^^^ Enumeration value "ladyboy" should be in UPPER_CASE format + | ^^^^^^^ Enum value "ladyboy" should be in UPPER_CASE format 211 | } #### ❌ Error 11/27 213 | enum EnumUserLanguagesSkill { > 214 | basic - | ^^^^^ Enumeration value "basic" should be in UPPER_CASE format + | ^^^^^ Enum value "basic" should be in UPPER_CASE format 215 | fluent #### ❌ Error 12/27 214 | basic > 215 | fluent - | ^^^^^^ Enumeration value "fluent" should be in UPPER_CASE format + | ^^^^^^ Enum value "fluent" should be in UPPER_CASE format 216 | native #### ❌ Error 13/27 215 | fluent > 216 | native - | ^^^^^^ Enumeration value "native" should be in UPPER_CASE format + | ^^^^^^ Enum value "native" should be in UPPER_CASE format 217 | } #### ❌ Error 14/27 238 | _operators: OperatorsFilterFindManyUserInput > 239 | OR: [FilterFindManyUserInput!] - | ^^ Input property "OR" should be in camelCase format + | ^^ Input value "OR" should be in camelCase format 240 | AND: [FilterFindManyUserInput!] #### ❌ Error 15/27 239 | OR: [FilterFindManyUserInput!] > 240 | AND: [FilterFindManyUserInput!] - | ^^^ Input property "AND" should be in camelCase format + | ^^^ Input value "AND" should be in camelCase format 241 | #### ❌ Error 16/27 267 | _operators: OperatorsFilterFindOneUserInput > 268 | OR: [FilterFindOneUserInput!] - | ^^ Input property "OR" should be in camelCase format + | ^^ Input value "OR" should be in camelCase format 269 | AND: [FilterFindOneUserInput!] #### ❌ Error 17/27 268 | OR: [FilterFindOneUserInput!] > 269 | AND: [FilterFindOneUserInput!] - | ^^^ Input property "AND" should be in camelCase format + | ^^^ Input value "AND" should be in camelCase format 270 | } #### ❌ Error 18/27 291 | _operators: OperatorsFilterRemoveManyUserInput > 292 | OR: [FilterRemoveManyUserInput!] - | ^^ Input property "OR" should be in camelCase format + | ^^ Input value "OR" should be in camelCase format 293 | AND: [FilterRemoveManyUserInput!] #### ❌ Error 19/27 292 | OR: [FilterRemoveManyUserInput!] > 293 | AND: [FilterRemoveManyUserInput!] - | ^^^ Input property "AND" should be in camelCase format + | ^^^ Input value "AND" should be in camelCase format 294 | } #### ❌ Error 20/27 315 | _operators: OperatorsFilterRemoveOneUserInput > 316 | OR: [FilterRemoveOneUserInput!] - | ^^ Input property "OR" should be in camelCase format + | ^^ Input value "OR" should be in camelCase format 317 | AND: [FilterRemoveOneUserInput!] #### ❌ Error 21/27 316 | OR: [FilterRemoveOneUserInput!] > 317 | AND: [FilterRemoveOneUserInput!] - | ^^^ Input property "AND" should be in camelCase format + | ^^^ Input value "AND" should be in camelCase format 318 | } #### ❌ Error 22/27 339 | _operators: OperatorsFilterUpdateManyUserInput > 340 | OR: [FilterUpdateManyUserInput!] - | ^^ Input property "OR" should be in camelCase format + | ^^ Input value "OR" should be in camelCase format 341 | AND: [FilterUpdateManyUserInput!] #### ❌ Error 23/27 340 | OR: [FilterUpdateManyUserInput!] > 341 | AND: [FilterUpdateManyUserInput!] - | ^^^ Input property "AND" should be in camelCase format + | ^^^ Input value "AND" should be in camelCase format 342 | } #### ❌ Error 24/27 363 | _operators: OperatorsFilterUpdateOneUserInput > 364 | OR: [FilterUpdateOneUserInput!] - | ^^ Input property "OR" should be in camelCase format + | ^^ Input value "OR" should be in camelCase format 365 | AND: [FilterUpdateOneUserInput!] #### ❌ Error 25/27 364 | OR: [FilterUpdateOneUserInput!] > 365 | AND: [FilterUpdateOneUserInput!] - | ^^^ Input property "AND" should be in camelCase format + | ^^^ Input value "AND" should be in camelCase format 366 | } #### ❌ Error 26/27 387 | _operators: OperatorsFilterUserInput > 388 | OR: [FilterUserInput!] - | ^^ Input property "OR" should be in camelCase format + | ^^ Input value "OR" should be in camelCase format 389 | AND: [FilterUserInput!] #### ❌ Error 27/27 388 | OR: [FilterUserInput!] > 389 | AND: [FilterUserInput!] - | ^^^ Input property "AND" should be in camelCase format + | ^^^ Input value "AND" should be in camelCase format 390 | } `; @@ -1736,7 +1770,7 @@ exports[`naming-convention > invalid > operations-recommended config 1`] = ` #### ❌ Error 1/9 > 1 | query TestQuery { test } - | ^^^^^^^^^ Operation "TestQuery" should not have "Query" suffix + | ^^^^^^^^^ Query "TestQuery" should not have "Query" suffix 2 | query QueryTest { test } #### 💡 Suggestion: Rename to \`Test\` @@ -1759,7 +1793,7 @@ exports[`naming-convention > invalid > operations-recommended config 1`] = ` 1 | query TestQuery { test } > 2 | query QueryTest { test } - | ^^^^^^^^^ Operation "QueryTest" should not have "Query" prefix + | ^^^^^^^^^ Query "QueryTest" should not have "Query" prefix 3 | query GetQuery { test } #### 💡 Suggestion: Rename to \`Test\` @@ -1782,7 +1816,7 @@ exports[`naming-convention > invalid > operations-recommended config 1`] = ` 2 | query QueryTest { test } > 3 | query GetQuery { test } - | ^^^^^^^^ Operation "GetQuery" should not have "Get" prefix + | ^^^^^^^^ Query "GetQuery" should not have "Get" prefix 4 | query Test { test(CONTROLLED_BY_SCHEMA: 0) } #### 💡 Suggestion: Rename to \`Query\` @@ -1805,7 +1839,7 @@ exports[`naming-convention > invalid > operations-recommended config 1`] = ` 5 | > 6 | mutation TestMutation { test } - | ^^^^^^^^^^^^ Operation "TestMutation" should not have "Mutation" suffix + | ^^^^^^^^^^^^ Mutation "TestMutation" should not have "Mutation" suffix 7 | mutation MutationTest { test } #### 💡 Suggestion: Rename to \`Test\` @@ -1828,7 +1862,7 @@ exports[`naming-convention > invalid > operations-recommended config 1`] = ` 6 | mutation TestMutation { test } > 7 | mutation MutationTest { test } - | ^^^^^^^^^^^^ Operation "MutationTest" should not have "Mutation" prefix + | ^^^^^^^^^^^^ Mutation "MutationTest" should not have "Mutation" prefix 8 | #### 💡 Suggestion: Rename to \`Test\` @@ -1851,7 +1885,7 @@ exports[`naming-convention > invalid > operations-recommended config 1`] = ` 8 | > 9 | subscription TestSubscription { test } - | ^^^^^^^^^^^^^^^^ Operation "TestSubscription" should not have "Subscription" suffix + | ^^^^^^^^^^^^^^^^ Subscription "TestSubscription" should not have "Subscription" suffix 10 | subscription SubscriptionTest { test } #### 💡 Suggestion: Rename to \`Test\` @@ -1874,7 +1908,7 @@ exports[`naming-convention > invalid > operations-recommended config 1`] = ` 9 | subscription TestSubscription { test } > 10 | subscription SubscriptionTest { test } - | ^^^^^^^^^^^^^^^^ Operation "SubscriptionTest" should not have "Subscription" prefix + | ^^^^^^^^^^^^^^^^ Subscription "SubscriptionTest" should not have "Subscription" prefix 11 | #### 💡 Suggestion: Rename to \`Test\` @@ -1939,6 +1973,28 @@ exports[`naming-convention > invalid > operations-recommended config 1`] = ` 13 | fragment Test on Test { id } `; +exports[`naming-convention > invalid > requiredPattern 1`] = ` +#### ⌨️ Code + + 1 | type Test { enabled: Boolean! } + +#### ⚙️ Options + + { + "FieldDefinition[gqlType.gqlType.name.value=Boolean]": { + "style": "camelCase", + "requiredPattern": [ + "/^(is|has)/" + ] + } + } + +#### ❌ Error + + > 1 | type Test { enabled: Boolean! } + | ^^^^^^^ Field "enabled" should contain the required pattern: ^(is|has) +`; + exports[`naming-convention > invalid > schema-recommended config 1`] = ` #### ⌨️ Code @@ -2349,7 +2405,7 @@ exports[`naming-convention > invalid > schema-recommended config 1`] = ` 16 | > 17 | enum TestEnum - | ^^^^^^^^ Enumerator "TestEnum" should not have "Enum" suffix + | ^^^^^^^^ Enum "TestEnum" should not have "Enum" suffix 18 | extend enum EnumTest { #### 💡 Suggestion: Rename to \`Test\` @@ -2392,7 +2448,7 @@ exports[`naming-convention > invalid > schema-recommended config 1`] = ` 17 | enum TestEnum > 18 | extend enum EnumTest { - | ^^^^^^^^ EnumTypeExtension "EnumTest" should not have "Enum" prefix + | ^^^^^^^^ Enum "EnumTest" should not have "Enum" prefix 19 | A #### 💡 Suggestion: Rename to \`Test\` @@ -2478,7 +2534,7 @@ exports[`naming-convention > invalid > schema-recommended config 1`] = ` 22 | interface TestInterface > 23 | extend interface InterfaceTest { - | ^^^^^^^^^^^^^ InterfaceTypeExtension "InterfaceTest" should not have "Interface" prefix + | ^^^^^^^^^^^^^ Interface "InterfaceTest" should not have "Interface" prefix 24 | id: ID #### 💡 Suggestion: Rename to \`Test\` @@ -2564,7 +2620,7 @@ exports[`naming-convention > invalid > schema-recommended config 1`] = ` 27 | union TestUnion > 28 | extend union UnionTest = TestInterface - | ^^^^^^^^^ UnionTypeExtension "UnionTest" should not have "Union" prefix + | ^^^^^^^^^ Union "UnionTest" should not have "Union" prefix 29 | #### 💡 Suggestion: Rename to \`Test\` @@ -2650,7 +2706,7 @@ exports[`naming-convention > invalid > schema-recommended config 1`] = ` 30 | type TestType > 31 | extend type TypeTest { - | ^^^^^^^^ ObjectTypeExtension "TypeTest" should not have "Type" prefix + | ^^^^^^^^ Type "TypeTest" should not have "Type" prefix 32 | id: ID #### 💡 Suggestion: Rename to \`Test\` diff --git a/packages/plugin/tsup.config.ts b/packages/plugin/tsup.config.ts index da16ef437e3..07684a9ee6f 100644 --- a/packages/plugin/tsup.config.ts +++ b/packages/plugin/tsup.config.ts @@ -63,6 +63,7 @@ export default defineConfig([ dts: false, bundle: true, env: { + ...opts.env, NODE_ENV: 'production', }, esbuildOptions(options, _context) { diff --git a/packages/rule-tester/src/index.ts b/packages/rule-tester/src/index.ts index 77816ed883a..bb315a22240 100644 --- a/packages/rule-tester/src/index.ts +++ b/packages/rule-tester/src/index.ts @@ -25,6 +25,11 @@ function applyFix(code: string, { range, text }: Rule.Fix): string { return [code.slice(0, range[0]), text, code.slice(range[1])].join(''); } +// @ts-expect-error -- Extend RegExp with a custom toJSON method +RegExp.prototype.toJSON = function() { + return `/${this.source}/${this.flags}` +}; + export class RuleTester extends ESLintRuleTester { fromMockFile(path: string): string { return readFileSync(resolve(__dirname, `../../plugin/__tests__/mocks/${path}`), 'utf-8'); diff --git a/website/content/docs/usage/js.mdx b/website/content/docs/usage/js.mdx index c608d974f17..14340a85b39 100644 --- a/website/content/docs/usage/js.mdx +++ b/website/content/docs/usage/js.mdx @@ -37,7 +37,7 @@ export default [ > Under the hood, the processor extracts schema and operation files from `files: ['**/*.js']` and > treats them as virtual GraphQL documents with `.graphql` extensions. This enables the overrides > you define for `.graphql` files, under `files: ['**/*.graphql']`, to be applied to the definitions -> within your code files[^1]. +> within your code files. --- diff --git a/website/content/rules/alphabetize.mdx b/website/content/rules/alphabetize.mdx index 87ea8c86de2..cae85338b8c 100644 --- a/website/content/rules/alphabetize.mdx +++ b/website/content/rules/alphabetize.mdx @@ -180,5 +180,5 @@ Additional restrictions: ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/alphabetize.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/alphabetize.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/alphabetize.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/alphabetize.spec.ts) diff --git a/website/content/rules/description-style.mdx b/website/content/rules/description-style.mdx index 57573d08029..60d7ebf2c06 100644 --- a/website/content/rules/description-style.mdx +++ b/website/content/rules/description-style.mdx @@ -58,5 +58,5 @@ Default: `"block"` ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/description-style.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/description-style.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/description-style.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/description-style.spec.ts) diff --git a/website/content/rules/input-name.mdx b/website/content/rules/input-name.mdx index c42fdf1caf3..d680be83379 100644 --- a/website/content/rules/input-name.mdx +++ b/website/content/rules/input-name.mdx @@ -83,5 +83,5 @@ Default: `true` ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/input-name.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/input-name.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/input-name.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/input-name.spec.ts) diff --git a/website/content/rules/lone-executable-definition.mdx b/website/content/rules/lone-executable-definition.mdx index 7bc00983809..344f098bcc7 100644 --- a/website/content/rules/lone-executable-definition.mdx +++ b/website/content/rules/lone-executable-definition.mdx @@ -61,5 +61,5 @@ Additional restrictions: ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/lone-executable-definition.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/lone-executable-definition.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/lone-executable-definition.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/lone-executable-definition.spec.ts) diff --git a/website/content/rules/match-document-filename.mdx b/website/content/rules/match-document-filename.mdx index b1c12f4c4ac..b5d0df00537 100644 --- a/website/content/rules/match-document-filename.mdx +++ b/website/content/rules/match-document-filename.mdx @@ -182,5 +182,5 @@ This element must be one of the following enum values: ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/match-document-filename.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/match-document-filename.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/match-document-filename.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/match-document-filename.spec.ts) diff --git a/website/content/rules/naming-convention.mdx b/website/content/rules/naming-convention.mdx index ed9bef931f5..e63bfbc6ef6 100644 --- a/website/content/rules/naming-convention.mdx +++ b/website/content/rules/naming-convention.mdx @@ -321,8 +321,39 @@ This element must be one of the following enum values: ### `suffix` (string) +### `forbiddenPattern` (array) + +Should be of instance of `RegEx` + +The object is an array with all elements of the type `object`. + +The array object has the following properties: + +Additional restrictions: + +- Minimum items: `1` +- Unique items: `true` + +### `requiredPattern` (array) + +Should be of instance of `RegEx` + +The object is an array with all elements of the type `object`. + +The array object has the following properties: + +Additional restrictions: + +- Minimum items: `1` +- Unique items: `true` + ### `forbiddenPrefixes` (array) +> [!WARNING] +> +> This option is deprecated and will be removed in the next major release. Use +> [`forbiddenPattern`](#forbiddenpattern-array) instead. + The object is an array with all elements of the type `string`. Additional restrictions: @@ -332,6 +363,11 @@ Additional restrictions: ### `forbiddenSuffixes` (array) +> [!WARNING] +> +> This option is deprecated and will be removed in the next major release. Use +> [`forbiddenPattern`](#forbiddenpattern-array) instead. + The object is an array with all elements of the type `string`. Additional restrictions: @@ -341,6 +377,11 @@ Additional restrictions: ### `requiredPrefixes` (array) +> [!WARNING] +> +> This option is deprecated and will be removed in the next major release. Use +> [`requiredPattern`](#requiredpattern-array) instead. + The object is an array with all elements of the type `string`. Additional restrictions: @@ -350,6 +391,11 @@ Additional restrictions: ### `requiredSuffixes` (array) +> [!WARNING] +> +> This option is deprecated and will be removed in the next major release. Use +> [`requiredPattern`](#requiredpattern-array) instead. + The object is an array with all elements of the type `string`. Additional restrictions: @@ -363,5 +409,5 @@ Option to skip validation of some words, e.g. acronyms ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/naming-convention.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/naming-convention.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/naming-convention.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/naming-convention.spec.ts) diff --git a/website/content/rules/no-anonymous-operations.mdx b/website/content/rules/no-anonymous-operations.mdx index fc8494ad7ca..9225096ac5c 100644 --- a/website/content/rules/no-anonymous-operations.mdx +++ b/website/content/rules/no-anonymous-operations.mdx @@ -45,5 +45,5 @@ query user { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-anonymous-operations.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-anonymous-operations.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-anonymous-operations.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-anonymous-operations.spec.ts) diff --git a/website/content/rules/no-deprecated.mdx b/website/content/rules/no-deprecated.mdx index 7a88388bbd5..759103f0f81 100644 --- a/website/content/rules/no-deprecated.mdx +++ b/website/content/rules/no-deprecated.mdx @@ -89,5 +89,5 @@ query user { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-deprecated.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-deprecated.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-deprecated.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-deprecated.spec.ts) diff --git a/website/content/rules/no-duplicate-fields.mdx b/website/content/rules/no-duplicate-fields.mdx index 6eed8cd92f3..1dd9f8e1b99 100644 --- a/website/content/rules/no-duplicate-fields.mdx +++ b/website/content/rules/no-duplicate-fields.mdx @@ -71,5 +71,5 @@ query ( ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-duplicate-fields.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-duplicate-fields.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-duplicate-fields.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-duplicate-fields.spec.ts) diff --git a/website/content/rules/no-hashtag-description.mdx b/website/content/rules/no-hashtag-description.mdx index d0c3474bd6b..8ea8a3f5ef9 100644 --- a/website/content/rules/no-hashtag-description.mdx +++ b/website/content/rules/no-hashtag-description.mdx @@ -63,5 +63,5 @@ type User { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-hashtag-description.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-hashtag-description.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-hashtag-description.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-hashtag-description.spec.ts) diff --git a/website/content/rules/no-one-place-fragments.mdx b/website/content/rules/no-one-place-fragments.mdx index a119a6b2308..6086f0f1904 100644 --- a/website/content/rules/no-one-place-fragments.mdx +++ b/website/content/rules/no-one-place-fragments.mdx @@ -52,5 +52,5 @@ fragment UserFields on User { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-one-place-fragments.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-one-place-fragments.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-one-place-fragments.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-one-place-fragments.spec.ts) diff --git a/website/content/rules/no-root-type.mdx b/website/content/rules/no-root-type.mdx index 6cc46449556..764e43786ac 100644 --- a/website/content/rules/no-root-type.mdx +++ b/website/content/rules/no-root-type.mdx @@ -56,5 +56,5 @@ Additional restrictions: ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-root-type.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-root-type.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-root-type.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-root-type.spec.ts) diff --git a/website/content/rules/no-scalar-result-type-on-mutation.mdx b/website/content/rules/no-scalar-result-type-on-mutation.mdx index 4c7725b4f7a..8da736402cc 100644 --- a/website/content/rules/no-scalar-result-type-on-mutation.mdx +++ b/website/content/rules/no-scalar-result-type-on-mutation.mdx @@ -40,5 +40,5 @@ type Mutation { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-scalar-result-type-on-mutation.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-scalar-result-type-on-mutation.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-scalar-result-type-on-mutation.spec.ts) diff --git a/website/content/rules/no-typename-prefix.mdx b/website/content/rules/no-typename-prefix.mdx index dcada3c9bf7..37cd748e525 100644 --- a/website/content/rules/no-typename-prefix.mdx +++ b/website/content/rules/no-typename-prefix.mdx @@ -44,5 +44,5 @@ type User { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-typename-prefix.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-typename-prefix.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-typename-prefix.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-typename-prefix.spec.ts) diff --git a/website/content/rules/no-unreachable-types.mdx b/website/content/rules/no-unreachable-types.mdx index aba5bf3e28d..faaf0396cb7 100644 --- a/website/content/rules/no-unreachable-types.mdx +++ b/website/content/rules/no-unreachable-types.mdx @@ -53,5 +53,5 @@ type Query { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-unreachable-types.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-unreachable-types.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-unreachable-types.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-unreachable-types.spec.ts) diff --git a/website/content/rules/no-unused-fields.mdx b/website/content/rules/no-unused-fields.mdx index 472efac05a0..7b386958e50 100644 --- a/website/content/rules/no-unused-fields.mdx +++ b/website/content/rules/no-unused-fields.mdx @@ -159,5 +159,5 @@ Additional restrictions: ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/no-unused-fields.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/no-unused-fields.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/no-unused-fields.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/no-unused-fields.spec.ts) diff --git a/website/content/rules/relay-arguments.mdx b/website/content/rules/relay-arguments.mdx index 480d9384913..09c8ec32f26 100644 --- a/website/content/rules/relay-arguments.mdx +++ b/website/content/rules/relay-arguments.mdx @@ -60,5 +60,5 @@ Default: `true` ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/relay-arguments.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/relay-arguments.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/relay-arguments.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/relay-arguments.spec.ts) diff --git a/website/content/rules/relay-connection-types.mdx b/website/content/rules/relay-connection-types.mdx index 7a1c680b46f..23c984a6585 100644 --- a/website/content/rules/relay-connection-types.mdx +++ b/website/content/rules/relay-connection-types.mdx @@ -44,5 +44,5 @@ type UserConnection { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/relay-connection-types.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/relay-connection-types.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/relay-connection-types.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/relay-connection-types.spec.ts) diff --git a/website/content/rules/relay-edge-types.mdx b/website/content/rules/relay-edge-types.mdx index d063c5e48fd..554e502c0aa 100644 --- a/website/content/rules/relay-edge-types.mdx +++ b/website/content/rules/relay-edge-types.mdx @@ -61,5 +61,5 @@ Default: `true` ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/relay-edge-types.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/relay-edge-types.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/relay-edge-types.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/relay-edge-types.spec.ts) diff --git a/website/content/rules/relay-page-info.mdx b/website/content/rules/relay-page-info.mdx index c7a7686db96..acd709ae50b 100644 --- a/website/content/rules/relay-page-info.mdx +++ b/website/content/rules/relay-page-info.mdx @@ -35,5 +35,5 @@ type PageInfo { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/relay-page-info.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/relay-page-info.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/relay-page-info.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/relay-page-info.spec.ts) diff --git a/website/content/rules/require-deprecation-date.mdx b/website/content/rules/require-deprecation-date.mdx index b6c2ef3923f..dd7e121600a 100644 --- a/website/content/rules/require-deprecation-date.mdx +++ b/website/content/rules/require-deprecation-date.mdx @@ -61,5 +61,5 @@ The schema defines the following properties: ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-deprecation-date.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-deprecation-date.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/require-deprecation-date.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/require-deprecation-date.spec.ts) diff --git a/website/content/rules/require-deprecation-reason.mdx b/website/content/rules/require-deprecation-reason.mdx index da498a42524..12e82444023 100644 --- a/website/content/rules/require-deprecation-reason.mdx +++ b/website/content/rules/require-deprecation-reason.mdx @@ -50,5 +50,5 @@ type MyType { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-deprecation-reason.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-deprecation-reason.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/require-deprecation-reason.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/require-deprecation-reason.spec.ts) diff --git a/website/content/rules/require-description.mdx b/website/content/rules/require-description.mdx index 70d65778547..aeb29a45aad 100644 --- a/website/content/rules/require-description.mdx +++ b/website/content/rules/require-description.mdx @@ -148,5 +148,5 @@ Read more about this kind on ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-description.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-description.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/require-description.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/require-description.spec.ts) diff --git a/website/content/rules/require-field-of-type-query-in-mutation-result.mdx b/website/content/rules/require-field-of-type-query-in-mutation-result.mdx index b7e24493887..e6ce0ddd5e3 100644 --- a/website/content/rules/require-field-of-type-query-in-mutation-result.mdx +++ b/website/content/rules/require-field-of-type-query-in-mutation-result.mdx @@ -53,5 +53,5 @@ type Mutation { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/require-field-of-type-query-in-mutation-result.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/require-field-of-type-query-in-mutation-result.spec.ts) diff --git a/website/content/rules/require-import-fragment.mdx b/website/content/rules/require-import-fragment.mdx index afd00181cb2..e7dd11740a3 100644 --- a/website/content/rules/require-import-fragment.mdx +++ b/website/content/rules/require-import-fragment.mdx @@ -71,5 +71,5 @@ query { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-import-fragment.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-import-fragment.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/require-import-fragment.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/require-import-fragment.spec.ts) diff --git a/website/content/rules/require-nullable-fields-with-oneof.mdx b/website/content/rules/require-nullable-fields-with-oneof.mdx index 906f08c211c..69d02b58e83 100644 --- a/website/content/rules/require-nullable-fields-with-oneof.mdx +++ b/website/content/rules/require-nullable-fields-with-oneof.mdx @@ -39,5 +39,5 @@ input Input @oneOf { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-nullable-fields-with-oneof.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-nullable-fields-with-oneof.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/require-nullable-fields-with-oneof.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/require-nullable-fields-with-oneof.spec.ts) diff --git a/website/content/rules/require-nullable-result-in-root.mdx b/website/content/rules/require-nullable-result-in-root.mdx index 5fed6be84ad..688dca13b39 100644 --- a/website/content/rules/require-nullable-result-in-root.mdx +++ b/website/content/rules/require-nullable-result-in-root.mdx @@ -42,5 +42,5 @@ type Query { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-nullable-result-in-root.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-nullable-result-in-root.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/require-nullable-result-in-root.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/require-nullable-result-in-root.spec.ts) diff --git a/website/content/rules/require-selections.mdx b/website/content/rules/require-selections.mdx index ceb780fabbb..26ea95a5c94 100644 --- a/website/content/rules/require-selections.mdx +++ b/website/content/rules/require-selections.mdx @@ -98,5 +98,5 @@ conflict with another Relay rule: `relay/unused-fields`. ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-selections.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-selections.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/require-selections.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/require-selections.spec.ts) diff --git a/website/content/rules/require-type-pattern-with-oneof.mdx b/website/content/rules/require-type-pattern-with-oneof.mdx index 3b31c26d82f..30e28c6c0ff 100644 --- a/website/content/rules/require-type-pattern-with-oneof.mdx +++ b/website/content/rules/require-type-pattern-with-oneof.mdx @@ -40,5 +40,5 @@ type DoSomethingSuccess { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/require-type-pattern-with-oneof.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/require-type-pattern-with-oneof.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/require-type-pattern-with-oneof.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/require-type-pattern-with-oneof.spec.ts) diff --git a/website/content/rules/selection-set-depth.mdx b/website/content/rules/selection-set-depth.mdx index af52b220f63..30d68058d2d 100644 --- a/website/content/rules/selection-set-depth.mdx +++ b/website/content/rules/selection-set-depth.mdx @@ -89,5 +89,5 @@ Additional restrictions: ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/selection-set-depth.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/selection-set-depth.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/selection-set-depth.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/selection-set-depth.spec.ts) diff --git a/website/content/rules/strict-id-in-types.mdx b/website/content/rules/strict-id-in-types.mdx index 57328c68c8a..cff446c9a88 100644 --- a/website/content/rules/strict-id-in-types.mdx +++ b/website/content/rules/strict-id-in-types.mdx @@ -131,5 +131,5 @@ Additional restrictions: ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/strict-id-in-types.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/strict-id-in-types.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/strict-id-in-types.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/strict-id-in-types.spec.ts) diff --git a/website/content/rules/unique-enum-value-names.mdx b/website/content/rules/unique-enum-value-names.mdx index 9d1b49e8f2d..2f3c712c472 100644 --- a/website/content/rules/unique-enum-value-names.mdx +++ b/website/content/rules/unique-enum-value-names.mdx @@ -49,5 +49,5 @@ enum MyEnum { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/unique-enum-value-names.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/unique-enum-value-names.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/unique-enum-value-names.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/unique-enum-value-names.spec.ts) diff --git a/website/content/rules/unique-fragment-name.mdx b/website/content/rules/unique-fragment-name.mdx index 0bc3ac3eaff..04d5a7620b7 100644 --- a/website/content/rules/unique-fragment-name.mdx +++ b/website/content/rules/unique-fragment-name.mdx @@ -56,5 +56,5 @@ fragment UserFields on User { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/unique-fragment-name.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/unique-fragment-name.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/unique-fragment-name.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/unique-fragment-name.spec.ts) diff --git a/website/content/rules/unique-operation-name.mdx b/website/content/rules/unique-operation-name.mdx index 4999ff0ed31..4ef2c02e6a4 100644 --- a/website/content/rules/unique-operation-name.mdx +++ b/website/content/rules/unique-operation-name.mdx @@ -60,5 +60,5 @@ query me { ## Resources -- [Rule source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/src/rules/unique-operation-name.ts) -- [Test source](https://github.com/B2o5T/graphql-eslint/tree/master/packages/plugin/__tests__/unique-operation-name.spec.ts) +- [Rule source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/src/rules/unique-operation-name.ts) +- [Test source](https://github.com/dimaMachina/graphql-eslint/tree/master/packages/plugin/__tests__/unique-operation-name.spec.ts)