Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0261839
add new docs
dimaMachina Aug 11, 2024
a35c18b
more
dimaMachina Aug 11, 2024
9b44466
more
dimaMachina Aug 11, 2024
97e2435
add
dimaMachina Aug 11, 2024
b344cb5
more
dimaMachina Aug 11, 2024
01cedbe
more
dimaMachina Aug 11, 2024
91a608f
more
dimaMachina Aug 11, 2024
5a5ccf4
more
dimaMachina Aug 11, 2024
0aeb05b
more
dimaMachina Aug 11, 2024
c9aa432
fix generate docs prettier, incorrectly formatted _meta.ts
dimaMachina Aug 16, 2024
e59b5d8
add baseUrl
dimaMachina Aug 16, 2024
24b0a85
Merge branch 'master' into new-docs
dimaMachina Aug 16, 2024
c2921f9
update eslint patch
dimaMachina Aug 16, 2024
84dc3a0
Merge branch 'master' into new-docs
dimaMachina Aug 16, 2024
ed6f00a
fix snapshots
dimaMachina Aug 16, 2024
9ee2db8
fix lint
dimaMachina Aug 16, 2024
30d8858
move
dimaMachina Aug 16, 2024
df1febd
more
dimaMachina Aug 17, 2024
03d10cd
more
dimaMachina Aug 17, 2024
6f33b00
more
dimaMachina Aug 17, 2024
84a348f
more
dimaMachina Aug 17, 2024
e38826f
more
dimaMachina Aug 17, 2024
6073694
prettier
dimaMachina Aug 17, 2024
1b585fe
more
dimaMachina Aug 17, 2024
63cfd35
more
dimaMachina Aug 17, 2024
5d62d4e
more
dimaMachina Aug 17, 2024
f1b3929
prettier
dimaMachina Aug 17, 2024
e93e0a1
more
dimaMachina Aug 17, 2024
5286a44
prettier
dimaMachina Aug 17, 2024
a4fb171
more
dimaMachina Aug 17, 2024
d45155c
more
dimaMachina Aug 17, 2024
9a15829
more
dimaMachina Aug 17, 2024
a8e264f
prettier
dimaMachina Aug 17, 2024
e080b15
fix for generate-configs
dimaMachina Aug 17, 2024
5f81914
Merge branch 'master' into new-structure
dimaMachina Nov 13, 2024
3a2bbc4
pnpm dedupe
dimaMachina Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/eslint-directives.spec.ts
Original file line number Diff line number Diff line change
@@ -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, {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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 "
Expand Down
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
68 changes: 34 additions & 34 deletions packages/plugin/src/rules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<RuleOptions>('input-name', rule, {
valid: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -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<RuleOptions>('lone-executable-definition', rule, {
valid: [
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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<RuleOptions>('match-document-filename', rule, {
valid: [
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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<RuleOptions>('naming-convention', rule, {
valid: [
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }'],
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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: [
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -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'),
},
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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: [
Expand Down
Loading
Loading