@graphql-eslint/eslint-plugin
Version:
GraphQL plugin for ESLint
1,065 lines (1,054 loc) • 63.8 kB
TypeScript
import * as graphql from 'graphql';
import { ASTNode, TypeNode, TypeInfo, DocumentNode, DefinitionNode, EnumValueDefinitionNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, InputValueDefinitionNode, DirectiveDefinitionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InterfaceTypeDefinitionNode, InterfaceTypeExtensionNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, SelectionSetNode, ExecutableDefinitionNode, FieldNode, InlineFragmentNode, SelectionNode, NameNode, DirectiveNode, VariableNode, VariableDefinitionNode, ArgumentNode, FragmentSpreadNode, NamedTypeNode, TypeDefinitionNode, TypeExtensionNode, ListTypeNode, NonNullTypeNode, OperationTypeDefinitionNode, FragmentDefinitionNode, OperationDefinitionNode, OperationTypeNode, GraphQLSchema, ASTKindToNode } from 'graphql';
import * as eslint from 'eslint';
import { AST, Linter, Rule } from 'eslint';
import { IGraphQLConfig } from 'graphql-config';
export { IGraphQLConfig } from 'graphql-config';
import { SourceLocation, Comment } from 'estree';
export { GraphQLTagPluckOptions } from '@graphql-tools/graphql-tag-pluck';
type SafeGraphQLType<T extends ASTNode> = T extends {
type: TypeNode;
} ? Omit<T, 'loc' | 'type'> & {
gqlType: T['type'];
} : Omit<T, 'loc'>;
type Writeable<T> = {
-readonly [K in keyof T]: T[K];
};
type TypeInformation = {
argument: ReturnType<TypeInfo['getArgument']>;
defaultValue: ReturnType<TypeInfo['getDefaultValue']>;
directive: ReturnType<TypeInfo['getDirective']>;
enumValue: ReturnType<TypeInfo['getEnumValue']>;
fieldDef: ReturnType<TypeInfo['getFieldDef']>;
inputType: ReturnType<TypeInfo['getInputType']>;
parentInputType: ReturnType<TypeInfo['getParentInputType']>;
parentType: ReturnType<TypeInfo['getParentType']>;
gqlType: ReturnType<TypeInfo['getType']>;
};
type NodeWithName = ArgumentNode | DirectiveDefinitionNode | EnumValueDefinitionNode | ExecutableDefinitionNode | FieldDefinitionNode | FieldNode | FragmentSpreadNode | NamedTypeNode | TypeDefinitionNode | TypeExtensionNode | VariableNode;
type NodeWithType = FieldDefinitionNode | InputValueDefinitionNode | ListTypeNode | NonNullTypeNode | OperationTypeDefinitionNode | VariableDefinitionNode;
type ParentNode<T> = T extends DocumentNode ? AST.Program : T extends DefinitionNode ? DocumentNode : T extends EnumValueDefinitionNode ? EnumTypeDefinitionNode | EnumTypeExtensionNode : T extends InputValueDefinitionNode ? DirectiveDefinitionNode | FieldDefinitionNode | InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode : T extends FieldDefinitionNode ? InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode | ObjectTypeDefinitionNode | ObjectTypeExtensionNode : T extends SelectionSetNode ? ExecutableDefinitionNode | FieldNode | InlineFragmentNode : T extends SelectionNode ? SelectionSetNode : T extends TypeNode ? NodeWithType : T extends NameNode ? NodeWithName : T extends DirectiveNode ? InputObjectTypeDefinitionNode | ObjectTypeDefinitionNode : T extends VariableNode ? VariableDefinitionNode : unknown;
type Node<T extends ASTNode, WithTypeInfo extends boolean> = Writeable<SafeGraphQLType<T>> & {
type: T['kind'];
loc: SourceLocation;
range: AST.Range;
leadingComments: Comment[];
typeInfo: () => WithTypeInfo extends true ? TypeInformation : Record<string, never>;
rawNode: () => T;
parent: GraphQLESTreeNode<ParentNode<T>>;
};
type GraphQLESTreeNode<T, W extends boolean = false> = T extends ASTNode ? {
[K in keyof Node<T, W>]: Node<T, W>[K] extends ReadonlyArray<infer ArrayItem> | undefined ? GraphQLESTreeNode<ArrayItem, W>[] : GraphQLESTreeNode<Node<T, W>[K], W>;
} : T extends AST.Program ? T & {
parent: null;
} : T;
type FragmentSource = {
filePath: string;
document: FragmentDefinitionNode;
};
type OperationSource = {
filePath: string;
document: OperationDefinitionNode;
};
type SiblingOperations = {
available: boolean;
getFragment(fragmentName: string): FragmentSource[];
getFragments(): FragmentSource[];
getFragmentByType(typeName: string): FragmentSource[];
getFragmentsInUse(baseOperation: FragmentDefinitionNode | OperationDefinitionNode | SelectionSetNode, recursive?: boolean): FragmentDefinitionNode[];
getOperation(operationName: string): OperationSource[];
getOperations(): OperationSource[];
getOperationByType(operationType: OperationTypeNode): OperationSource[];
};
type Schema = GraphQLSchema | null;
type Pointer = string | string[];
interface ParserOptions {
graphQLConfig?: IGraphQLConfig;
filePath: string;
}
type ParserServices = {
schema: Schema;
siblingOperations: SiblingOperations;
};
type GraphQLESLintParseResult = Linter.ESLintParseResult & {
services: ParserServices;
};
type ReportDescriptorLocation = any;
type ReportDescriptor = ReportDescriptorLocation & Rule.ReportDescriptorMessage & Rule.ReportDescriptorOptions;
type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'options' | 'report'> & {
options: Options;
report(descriptor: ReportDescriptor): void;
};
type CategoryType = 'schema' | 'operations' | 'schema-and-operations';
type RuleMetaDataDocs = Required<Rule.RuleMetaData>['docs'];
type RuleDocsInfo<T> = Omit<RuleMetaDataDocs, 'category' | 'suggestion'> & {
category?: string;
requiresSchema?: true;
requiresSiblings?: true;
examples?: {
title: string;
code: string;
usage?: T;
}[];
configOptions?: T | {
schema?: T;
operations?: T;
};
graphQLJSRuleName?: string;
isDisabledForAllConfig?: true;
whenNotToUseIt?: string;
};
type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = Record<string, any> & {
[K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void;
};
type GraphQLESLintRule<Options = [], WithTypeInfo extends boolean = false> = {
meta?: Omit<Rule.RuleMetaData, 'docs'> & {
docs?: RuleDocsInfo<Options>;
};
create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
};
type ValueOf<T> = T[keyof T];
type Id<T> = {
[P in keyof T]: T[P];
} & {};
type OmitDistributive<T, K extends PropertyKey> = T extends object ? Id<OmitRecursively<T, K>> : T;
type OmitRecursively<T extends object, K extends PropertyKey> = Omit<{
[P in keyof T]: OmitDistributive<T[P], K>;
}, K>;
type ConfigName = 'operations-all' | 'operations-recommended' | 'schema-all' | 'schema-recommended' | 'schema-relay';
declare function requireGraphQLOperations(ruleId: string, context: GraphQLESLintRuleContext): SiblingOperations | never;
declare function requireGraphQLSchema(ruleId: string, context: GraphQLESLintRuleContext): GraphQLSchema | never;
type CaseStyle = 'camelCase' | 'kebab-case' | 'PascalCase' | 'snake_case' | 'UPPER_CASE';
type Block = Linter.ProcessorFile & {
lineOffset: number;
offset: number;
};
declare const configs: {
'schema-recommended': {
parser: string;
plugins: string[];
rules: {
'@graphql-eslint/description-style': "error";
'@graphql-eslint/known-argument-names': "error";
'@graphql-eslint/known-directives': "error";
'@graphql-eslint/known-type-names': "error";
'@graphql-eslint/lone-schema-definition': "error";
'@graphql-eslint/naming-convention': ["error", {
types: string;
FieldDefinition: string;
InputValueDefinition: string;
Argument: string;
DirectiveDefinition: string;
EnumValueDefinition: string;
'FieldDefinition[parent.name.value=Query]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'FieldDefinition[parent.name.value=Mutation]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'FieldDefinition[parent.name.value=Subscription]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'EnumTypeDefinition,EnumTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'InterfaceTypeDefinition,InterfaceTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'UnionTypeDefinition,UnionTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'ObjectTypeDefinition,ObjectTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
}];
'@graphql-eslint/no-hashtag-description': "error";
'@graphql-eslint/no-typename-prefix': "error";
'@graphql-eslint/no-unreachable-types': "error";
'@graphql-eslint/possible-type-extension': "error";
'@graphql-eslint/provided-required-arguments': "error";
'@graphql-eslint/require-deprecation-reason': "error";
'@graphql-eslint/require-description': ["error", {
types: boolean;
DirectiveDefinition: boolean;
rootField: boolean;
}];
'@graphql-eslint/strict-id-in-types': "error";
'@graphql-eslint/unique-directive-names': "error";
'@graphql-eslint/unique-directive-names-per-location': "error";
'@graphql-eslint/unique-enum-value-names': "error";
'@graphql-eslint/unique-field-definition-names': "error";
'@graphql-eslint/unique-operation-types': "error";
'@graphql-eslint/unique-type-names': "error";
};
};
'schema-all': {
extends: string;
rules: {
'@graphql-eslint/alphabetize': ["error", {
definitions: boolean;
fields: string[];
values: boolean;
arguments: string[];
groups: string[];
}];
'@graphql-eslint/input-name': "error";
'@graphql-eslint/no-root-type': ["error", {
disallow: string[];
}];
'@graphql-eslint/no-scalar-result-type-on-mutation': "error";
'@graphql-eslint/require-deprecation-date': "error";
'@graphql-eslint/require-field-of-type-query-in-mutation-result': "error";
'@graphql-eslint/require-nullable-fields-with-oneof': "error";
'@graphql-eslint/require-nullable-result-in-root': "error";
'@graphql-eslint/require-type-pattern-with-oneof': "error";
};
};
'schema-relay': {
parser: string;
plugins: string[];
rules: {
'@graphql-eslint/relay-arguments': "error";
'@graphql-eslint/relay-connection-types': "error";
'@graphql-eslint/relay-edge-types': "error";
'@graphql-eslint/relay-page-info': "error";
};
};
'operations-recommended': {
parser: string;
plugins: string[];
rules: {
'@graphql-eslint/executable-definitions': "error";
'@graphql-eslint/fields-on-correct-type': "error";
'@graphql-eslint/fragments-on-composite-type': "error";
'@graphql-eslint/known-argument-names': "error";
'@graphql-eslint/known-directives': "error";
'@graphql-eslint/known-fragment-names': "error";
'@graphql-eslint/known-type-names': "error";
'@graphql-eslint/lone-anonymous-operation': "error";
'@graphql-eslint/naming-convention': ["error", {
VariableDefinition: string;
OperationDefinition: {
style: string;
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
FragmentDefinition: {
style: string;
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
}];
'@graphql-eslint/no-anonymous-operations': "error";
'@graphql-eslint/no-deprecated': "error";
'@graphql-eslint/no-duplicate-fields': "error";
'@graphql-eslint/no-fragment-cycles': "error";
'@graphql-eslint/no-undefined-variables': "error";
'@graphql-eslint/no-unused-fragments': "error";
'@graphql-eslint/no-unused-variables': "error";
'@graphql-eslint/one-field-subscriptions': "error";
'@graphql-eslint/overlapping-fields-can-be-merged': "error";
'@graphql-eslint/possible-fragment-spread': "error";
'@graphql-eslint/provided-required-arguments': "error";
'@graphql-eslint/require-selections': "error";
'@graphql-eslint/scalar-leafs': "error";
'@graphql-eslint/selection-set-depth': ["error", {
maxDepth: number;
}];
'@graphql-eslint/unique-argument-names': "error";
'@graphql-eslint/unique-directive-names-per-location': "error";
'@graphql-eslint/unique-fragment-name': "error";
'@graphql-eslint/unique-input-field-names': "error";
'@graphql-eslint/unique-operation-name': "error";
'@graphql-eslint/unique-variable-names': "error";
'@graphql-eslint/value-literals-of-correct-type': "error";
'@graphql-eslint/variables-are-input-types': "error";
'@graphql-eslint/variables-in-allowed-position': "error";
};
};
'operations-all': {
extends: string;
rules: {
'@graphql-eslint/alphabetize': ["error", {
definitions: boolean;
selections: string[];
variables: boolean;
arguments: string[];
groups: string[];
}];
'@graphql-eslint/lone-executable-definition': "error";
'@graphql-eslint/match-document-filename': ["error", {
query: string;
mutation: string;
subscription: string;
fragment: string;
}];
'@graphql-eslint/no-one-place-fragments': "error";
'@graphql-eslint/require-import-fragment': "error";
};
};
'flat/schema-recommended': {
rules: {
'@graphql-eslint/description-style': "error";
'@graphql-eslint/known-argument-names': "error";
'@graphql-eslint/known-directives': "error";
'@graphql-eslint/known-type-names': "error";
'@graphql-eslint/lone-schema-definition': "error";
'@graphql-eslint/naming-convention': ["error", {
types: string;
FieldDefinition: string;
InputValueDefinition: string;
Argument: string;
DirectiveDefinition: string;
EnumValueDefinition: string;
'FieldDefinition[parent.name.value=Query]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'FieldDefinition[parent.name.value=Mutation]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'FieldDefinition[parent.name.value=Subscription]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'EnumTypeDefinition,EnumTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'InterfaceTypeDefinition,InterfaceTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'UnionTypeDefinition,UnionTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'ObjectTypeDefinition,ObjectTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
}];
'@graphql-eslint/no-hashtag-description': "error";
'@graphql-eslint/no-typename-prefix': "error";
'@graphql-eslint/no-unreachable-types': "error";
'@graphql-eslint/possible-type-extension': "error";
'@graphql-eslint/provided-required-arguments': "error";
'@graphql-eslint/require-deprecation-reason': "error";
'@graphql-eslint/require-description': ["error", {
types: boolean;
DirectiveDefinition: boolean;
rootField: boolean;
}];
'@graphql-eslint/strict-id-in-types': "error";
'@graphql-eslint/unique-directive-names': "error";
'@graphql-eslint/unique-directive-names-per-location': "error";
'@graphql-eslint/unique-enum-value-names': "error";
'@graphql-eslint/unique-field-definition-names': "error";
'@graphql-eslint/unique-operation-types': "error";
'@graphql-eslint/unique-type-names': "error";
};
};
'flat/schema-all': {
rules: {
'@graphql-eslint/alphabetize': ["error", {
definitions: boolean;
fields: string[];
values: boolean;
arguments: string[];
groups: string[];
}];
'@graphql-eslint/input-name': "error";
'@graphql-eslint/no-root-type': ["error", {
disallow: string[];
}];
'@graphql-eslint/no-scalar-result-type-on-mutation': "error";
'@graphql-eslint/require-deprecation-date': "error";
'@graphql-eslint/require-field-of-type-query-in-mutation-result': "error";
'@graphql-eslint/require-nullable-fields-with-oneof': "error";
'@graphql-eslint/require-nullable-result-in-root': "error";
'@graphql-eslint/require-type-pattern-with-oneof': "error";
'@graphql-eslint/description-style': "error";
'@graphql-eslint/known-argument-names': "error";
'@graphql-eslint/known-directives': "error";
'@graphql-eslint/known-type-names': "error";
'@graphql-eslint/lone-schema-definition': "error";
'@graphql-eslint/naming-convention': ["error", {
types: string;
FieldDefinition: string;
InputValueDefinition: string;
Argument: string;
DirectiveDefinition: string;
EnumValueDefinition: string;
'FieldDefinition[parent.name.value=Query]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'FieldDefinition[parent.name.value=Mutation]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'FieldDefinition[parent.name.value=Subscription]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'EnumTypeDefinition,EnumTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'InterfaceTypeDefinition,InterfaceTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'UnionTypeDefinition,UnionTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'ObjectTypeDefinition,ObjectTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
}];
'@graphql-eslint/no-hashtag-description': "error";
'@graphql-eslint/no-typename-prefix': "error";
'@graphql-eslint/no-unreachable-types': "error";
'@graphql-eslint/possible-type-extension': "error";
'@graphql-eslint/provided-required-arguments': "error";
'@graphql-eslint/require-deprecation-reason': "error";
'@graphql-eslint/require-description': ["error", {
types: boolean;
DirectiveDefinition: boolean;
rootField: boolean;
}];
'@graphql-eslint/strict-id-in-types': "error";
'@graphql-eslint/unique-directive-names': "error";
'@graphql-eslint/unique-directive-names-per-location': "error";
'@graphql-eslint/unique-enum-value-names': "error";
'@graphql-eslint/unique-field-definition-names': "error";
'@graphql-eslint/unique-operation-types': "error";
'@graphql-eslint/unique-type-names': "error";
};
};
'flat/schema-relay': {
rules: {
'@graphql-eslint/relay-arguments': "error";
'@graphql-eslint/relay-connection-types': "error";
'@graphql-eslint/relay-edge-types': "error";
'@graphql-eslint/relay-page-info': "error";
};
};
'flat/operations-recommended': {
rules: {
'@graphql-eslint/executable-definitions': "error";
'@graphql-eslint/fields-on-correct-type': "error";
'@graphql-eslint/fragments-on-composite-type': "error";
'@graphql-eslint/known-argument-names': "error";
'@graphql-eslint/known-directives': "error";
'@graphql-eslint/known-fragment-names': "error";
'@graphql-eslint/known-type-names': "error";
'@graphql-eslint/lone-anonymous-operation': "error";
'@graphql-eslint/naming-convention': ["error", {
VariableDefinition: string;
OperationDefinition: {
style: string;
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
FragmentDefinition: {
style: string;
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
}];
'@graphql-eslint/no-anonymous-operations': "error";
'@graphql-eslint/no-deprecated': "error";
'@graphql-eslint/no-duplicate-fields': "error";
'@graphql-eslint/no-fragment-cycles': "error";
'@graphql-eslint/no-undefined-variables': "error";
'@graphql-eslint/no-unused-fragments': "error";
'@graphql-eslint/no-unused-variables': "error";
'@graphql-eslint/one-field-subscriptions': "error";
'@graphql-eslint/overlapping-fields-can-be-merged': "error";
'@graphql-eslint/possible-fragment-spread': "error";
'@graphql-eslint/provided-required-arguments': "error";
'@graphql-eslint/require-selections': "error";
'@graphql-eslint/scalar-leafs': "error";
'@graphql-eslint/selection-set-depth': ["error", {
maxDepth: number;
}];
'@graphql-eslint/unique-argument-names': "error";
'@graphql-eslint/unique-directive-names-per-location': "error";
'@graphql-eslint/unique-fragment-name': "error";
'@graphql-eslint/unique-input-field-names': "error";
'@graphql-eslint/unique-operation-name': "error";
'@graphql-eslint/unique-variable-names': "error";
'@graphql-eslint/value-literals-of-correct-type': "error";
'@graphql-eslint/variables-are-input-types': "error";
'@graphql-eslint/variables-in-allowed-position': "error";
};
};
'flat/operations-all': {
rules: {
'@graphql-eslint/alphabetize': ["error", {
definitions: boolean;
selections: string[];
variables: boolean;
arguments: string[];
groups: string[];
}];
'@graphql-eslint/lone-executable-definition': "error";
'@graphql-eslint/match-document-filename': ["error", {
query: string;
mutation: string;
subscription: string;
fragment: string;
}];
'@graphql-eslint/no-one-place-fragments': "error";
'@graphql-eslint/require-import-fragment': "error";
'@graphql-eslint/executable-definitions': "error";
'@graphql-eslint/fields-on-correct-type': "error";
'@graphql-eslint/fragments-on-composite-type': "error";
'@graphql-eslint/known-argument-names': "error";
'@graphql-eslint/known-directives': "error";
'@graphql-eslint/known-fragment-names': "error";
'@graphql-eslint/known-type-names': "error";
'@graphql-eslint/lone-anonymous-operation': "error";
'@graphql-eslint/naming-convention': ["error", {
VariableDefinition: string;
OperationDefinition: {
style: string;
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
FragmentDefinition: {
style: string;
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
}];
'@graphql-eslint/no-anonymous-operations': "error";
'@graphql-eslint/no-deprecated': "error";
'@graphql-eslint/no-duplicate-fields': "error";
'@graphql-eslint/no-fragment-cycles': "error";
'@graphql-eslint/no-undefined-variables': "error";
'@graphql-eslint/no-unused-fragments': "error";
'@graphql-eslint/no-unused-variables': "error";
'@graphql-eslint/one-field-subscriptions': "error";
'@graphql-eslint/overlapping-fields-can-be-merged': "error";
'@graphql-eslint/possible-fragment-spread': "error";
'@graphql-eslint/provided-required-arguments': "error";
'@graphql-eslint/require-selections': "error";
'@graphql-eslint/scalar-leafs': "error";
'@graphql-eslint/selection-set-depth': ["error", {
maxDepth: number;
}];
'@graphql-eslint/unique-argument-names': "error";
'@graphql-eslint/unique-directive-names-per-location': "error";
'@graphql-eslint/unique-fragment-name': "error";
'@graphql-eslint/unique-input-field-names': "error";
'@graphql-eslint/unique-operation-name': "error";
'@graphql-eslint/unique-variable-names': "error";
'@graphql-eslint/value-literals-of-correct-type': "error";
'@graphql-eslint/variables-are-input-types': "error";
'@graphql-eslint/variables-in-allowed-position': "error";
};
};
};
declare function parseForESLint(code: string, options: ParserOptions): GraphQLESLintParseResult;
declare const parser: {
parseForESLint: typeof parseForESLint;
meta: {
name: string;
version: string | undefined;
};
};
declare const rules: {
alphabetize: GraphQLESLintRule<{
values?: boolean | undefined;
definitions?: boolean | undefined;
fields?: ("InputObjectTypeDefinition" | "InterfaceTypeDefinition" | "ObjectTypeDefinition")[] | undefined;
selections?: ("FragmentDefinition" | "OperationDefinition")[] | undefined;
variables?: boolean | undefined;
arguments?: ("Directive" | "DirectiveDefinition" | "Field" | "FieldDefinition")[] | undefined;
groups?: string[] | undefined;
}[]>;
'description-style': GraphQLESLintRule<{
style: "block" | "inline";
}[]>;
'input-name': GraphQLESLintRule<{
checkInputType?: boolean | undefined;
caseSensitiveInputType?: boolean | undefined;
checkQueries?: boolean | undefined;
checkMutations?: boolean | undefined;
}[]>;
'lone-executable-definition': GraphQLESLintRule<{
ignore?: ("fragment" | graphql.OperationTypeNode)[] | undefined;
}[]>;
'match-document-filename': GraphQLESLintRule<{
fragment?: (CaseStyle | "matchDocumentStyle") | {
style?: (CaseStyle | "matchDocumentStyle") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
} | undefined;
fileExtension?: ".gql" | ".graphql" | undefined;
query?: (CaseStyle | "matchDocumentStyle") | {
style?: (CaseStyle | "matchDocumentStyle") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
} | undefined;
mutation?: (CaseStyle | "matchDocumentStyle") | {
style?: (CaseStyle | "matchDocumentStyle") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
} | undefined;
subscription?: (CaseStyle | "matchDocumentStyle") | {
style?: (CaseStyle | "matchDocumentStyle") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
} | undefined;
}[]>;
'naming-convention': GraphQLESLintRule<{
[x: string]: unknown;
allowLeadingUnderscore?: boolean | undefined;
allowTrailingUnderscore?: boolean | undefined;
types?: ("camelCase" | "PascalCase" | "snake_case" | "UPPER_CASE") | {
style?: ("camelCase" | "PascalCase" | "snake_case" | "UPPER_CASE") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
forbiddenPatterns?: {
[x: string]: unknown;
}[] | undefined;
requiredPattern?: {
[x: string]: unknown;
} | undefined;
forbiddenPrefixes?: string[] | undefined;
forbiddenSuffixes?: string[] | undefined;
requiredPrefixes?: string[] | undefined;
requiredSuffixes?: string[] | undefined;
ignorePattern?: string | undefined;
} | undefined;
}[]>;
'no-anonymous-operations': GraphQLESLintRule;
'no-deprecated': GraphQLESLintRule<[], true>;
'no-duplicate-fields': GraphQLESLintRule;
'no-hashtag-description': GraphQLESLintRule;
'no-one-place-fragments': GraphQLESLintRule;
'no-root-type': GraphQLESLintRule<{
disallow: ("mutation" | "subscription")[];
}[]>;
'no-scalar-result-type-on-mutation': GraphQLESLintRule;
'no-typename-prefix': GraphQLESLintRule;
'no-unreachable-types': GraphQLESLintRule;
'no-unused-fields': GraphQLESLintRule<{
ignoredFieldSelectors?: string[] | undefined;
}[]>;
'relay-arguments': GraphQLESLintRule<{
includeBoth: boolean;
}[], true>;
'relay-connection-types': GraphQLESLintRule;
'relay-edge-types': GraphQLESLintRule<{
withEdgeSuffix?: boolean | undefined;
shouldImplementNode?: boolean | undefined;
listTypeCanWrapOnlyEdgeType?: boolean | undefined;
}[], true>;
'relay-page-info': GraphQLESLintRule;
'require-deprecation-date': GraphQLESLintRule<{
argumentName?: string | undefined;
}[]>;
'require-deprecation-reason': GraphQLESLintRule;
'require-description': GraphQLESLintRule<{
OperationDefinition?: boolean | undefined;
ScalarTypeDefinition?: boolean | undefined;
ObjectTypeDefinition?: boolean | undefined;
FieldDefinition?: boolean | undefined;
InputValueDefinition?: boolean | undefined;
InterfaceTypeDefinition?: boolean | undefined;
UnionTypeDefinition?: boolean | undefined;
EnumTypeDefinition?: boolean | undefined;
EnumValueDefinition?: boolean | undefined;
InputObjectTypeDefinition?: boolean | undefined;
DirectiveDefinition?: boolean | undefined;
types?: true | undefined;
rootField?: true | undefined;
ignoredSelectors?: string[] | undefined;
}[]>;
'require-field-of-type-query-in-mutation-result': GraphQLESLintRule;
'require-import-fragment': GraphQLESLintRule;
'require-nullable-fields-with-oneof': GraphQLESLintRule;
'require-nullable-result-in-root': GraphQLESLintRule;
'require-selections': GraphQLESLintRule<{
requireAllFields?: boolean | undefined;
fieldName: string | string[];
}[], true>;
'require-type-pattern-with-oneof': GraphQLESLintRule;
'selection-set-depth': GraphQLESLintRule<{
ignore?: string[] | undefined;
maxDepth: number;
}[]>;
'strict-id-in-types': GraphQLESLintRule<{
acceptedIdNames?: string[] | undefined;
acceptedIdTypes?: string[] | undefined;
exceptions?: {
types?: string[] | undefined;
suffixes?: string[] | undefined;
} | undefined;
}[]>;
'unique-enum-value-names': GraphQLESLintRule;
'unique-fragment-name': GraphQLESLintRule;
'unique-operation-name': GraphQLESLintRule;
};
declare const processors: {
graphql: {
meta: {
name: string;
version: string | undefined;
};
supportsAutofix: true;
preprocess(code: string, filePath: string): (string | Block)[];
postprocess(messages: eslint.Linter.LintMessage[][], filePath: string): eslint.Linter.LintMessage[];
};
};
declare const _default: {
parser: {
parseForESLint: typeof parseForESLint;
meta: {
name: string;
version: string | undefined;
};
};
processor: {
meta: {
name: string;
version: string | undefined;
};
supportsAutofix: true;
preprocess(code: string, filePath: string): (string | Block)[];
postprocess(messages: eslint.Linter.LintMessage[][], filePath: string): eslint.Linter.LintMessage[];
};
rules: {
alphabetize: GraphQLESLintRule<{
values?: boolean | undefined;
definitions?: boolean | undefined;
fields?: ("InputObjectTypeDefinition" | "InterfaceTypeDefinition" | "ObjectTypeDefinition")[] | undefined;
selections?: ("FragmentDefinition" | "OperationDefinition")[] | undefined;
variables?: boolean | undefined;
arguments?: ("Directive" | "DirectiveDefinition" | "Field" | "FieldDefinition")[] | undefined;
groups?: string[] | undefined;
}[]>;
'description-style': GraphQLESLintRule<{
style: "block" | "inline";
}[]>;
'input-name': GraphQLESLintRule<{
checkInputType?: boolean | undefined;
caseSensitiveInputType?: boolean | undefined;
checkQueries?: boolean | undefined;
checkMutations?: boolean | undefined;
}[]>;
'lone-executable-definition': GraphQLESLintRule<{
ignore?: ("fragment" | graphql.OperationTypeNode)[] | undefined;
}[]>;
'match-document-filename': GraphQLESLintRule<{
fragment?: (CaseStyle | "matchDocumentStyle") | {
style?: (CaseStyle | "matchDocumentStyle") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
} | undefined;
fileExtension?: ".gql" | ".graphql" | undefined;
query?: (CaseStyle | "matchDocumentStyle") | {
style?: (CaseStyle | "matchDocumentStyle") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
} | undefined;
mutation?: (CaseStyle | "matchDocumentStyle") | {
style?: (CaseStyle | "matchDocumentStyle") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
} | undefined;
subscription?: (CaseStyle | "matchDocumentStyle") | {
style?: (CaseStyle | "matchDocumentStyle") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
} | undefined;
}[]>;
'naming-convention': GraphQLESLintRule<{
[x: string]: unknown;
allowLeadingUnderscore?: boolean | undefined;
allowTrailingUnderscore?: boolean | undefined;
types?: ("camelCase" | "PascalCase" | "snake_case" | "UPPER_CASE") | {
style?: ("camelCase" | "PascalCase" | "snake_case" | "UPPER_CASE") | undefined;
suffix?: string | undefined;
prefix?: string | undefined;
forbiddenPatterns?: {
[x: string]: unknown;
}[] | undefined;
requiredPattern?: {
[x: string]: unknown;
} | undefined;
forbiddenPrefixes?: string[] | undefined;
forbiddenSuffixes?: string[] | undefined;
requiredPrefixes?: string[] | undefined;
requiredSuffixes?: string[] | undefined;
ignorePattern?: string | undefined;
} | undefined;
}[]>;
'no-anonymous-operations': GraphQLESLintRule;
'no-deprecated': GraphQLESLintRule<[], true>;
'no-duplicate-fields': GraphQLESLintRule;
'no-hashtag-description': GraphQLESLintRule;
'no-one-place-fragments': GraphQLESLintRule;
'no-root-type': GraphQLESLintRule<{
disallow: ("mutation" | "subscription")[];
}[]>;
'no-scalar-result-type-on-mutation': GraphQLESLintRule;
'no-typename-prefix': GraphQLESLintRule;
'no-unreachable-types': GraphQLESLintRule;
'no-unused-fields': GraphQLESLintRule<{
ignoredFieldSelectors?: string[] | undefined;
}[]>;
'relay-arguments': GraphQLESLintRule<{
includeBoth: boolean;
}[], true>;
'relay-connection-types': GraphQLESLintRule;
'relay-edge-types': GraphQLESLintRule<{
withEdgeSuffix?: boolean | undefined;
shouldImplementNode?: boolean | undefined;
listTypeCanWrapOnlyEdgeType?: boolean | undefined;
}[], true>;
'relay-page-info': GraphQLESLintRule;
'require-deprecation-date': GraphQLESLintRule<{
argumentName?: string | undefined;
}[]>;
'require-deprecation-reason': GraphQLESLintRule;
'require-description': GraphQLESLintRule<{
OperationDefinition?: boolean | undefined;
ScalarTypeDefinition?: boolean | undefined;
ObjectTypeDefinition?: boolean | undefined;
FieldDefinition?: boolean | undefined;
InputValueDefinition?: boolean | undefined;
InterfaceTypeDefinition?: boolean | undefined;
UnionTypeDefinition?: boolean | undefined;
EnumTypeDefinition?: boolean | undefined;
EnumValueDefinition?: boolean | undefined;
InputObjectTypeDefinition?: boolean | undefined;
DirectiveDefinition?: boolean | undefined;
types?: true | undefined;
rootField?: true | undefined;
ignoredSelectors?: string[] | undefined;
}[]>;
'require-field-of-type-query-in-mutation-result': GraphQLESLintRule;
'require-import-fragment': GraphQLESLintRule;
'require-nullable-fields-with-oneof': GraphQLESLintRule;
'require-nullable-result-in-root': GraphQLESLintRule;
'require-selections': GraphQLESLintRule<{
requireAllFields?: boolean | undefined;
fieldName: string | string[];
}[], true>;
'require-type-pattern-with-oneof': GraphQLESLintRule;
'selection-set-depth': GraphQLESLintRule<{
ignore?: string[] | undefined;
maxDepth: number;
}[]>;
'strict-id-in-types': GraphQLESLintRule<{
acceptedIdNames?: string[] | undefined;
acceptedIdTypes?: string[] | undefined;
exceptions?: {
types?: string[] | undefined;
suffixes?: string[] | undefined;
} | undefined;
}[]>;
'unique-enum-value-names': GraphQLESLintRule;
'unique-fragment-name': GraphQLESLintRule;
'unique-operation-name': GraphQLESLintRule;
};
configs: {
'schema-recommended': {
parser: string;
plugins: string[];
rules: {
'@graphql-eslint/description-style': "error";
'@graphql-eslint/known-argument-names': "error";
'@graphql-eslint/known-directives': "error";
'@graphql-eslint/known-type-names': "error";
'@graphql-eslint/lone-schema-definition': "error";
'@graphql-eslint/naming-convention': ["error", {
types: string;
FieldDefinition: string;
InputValueDefinition: string;
Argument: string;
DirectiveDefinition: string;
EnumValueDefinition: string;
'FieldDefinition[parent.name.value=Query]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'FieldDefinition[parent.name.value=Mutation]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'FieldDefinition[parent.name.value=Subscription]': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'EnumTypeDefinition,EnumTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'InterfaceTypeDefinition,InterfaceTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'UnionTypeDefinition,UnionTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
'ObjectTypeDefinition,ObjectTypeExtension': {
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
}];
'@graphql-eslint/no-hashtag-description': "error";
'@graphql-eslint/no-typename-prefix': "error";
'@graphql-eslint/no-unreachable-types': "error";
'@graphql-eslint/possible-type-extension': "error";
'@graphql-eslint/provided-required-arguments': "error";
'@graphql-eslint/require-deprecation-reason': "error";
'@graphql-eslint/require-description': ["error", {
types: boolean;
DirectiveDefinition: boolean;
rootField: boolean;
}];
'@graphql-eslint/strict-id-in-types': "error";
'@graphql-eslint/unique-directive-names': "error";
'@graphql-eslint/unique-directive-names-per-location': "error";
'@graphql-eslint/unique-enum-value-names': "error";
'@graphql-eslint/unique-field-definition-names': "error";
'@graphql-eslint/unique-operation-types': "error";
'@graphql-eslint/unique-type-names': "error";
};
};
'schema-all': {
extends: string;
rules: {
'@graphql-eslint/alphabetize': ["error", {
definitions: boolean;
fields: string[];
values: boolean;
arguments: string[];
groups: string[];
}];
'@graphql-eslint/input-name': "error";
'@graphql-eslint/no-root-type': ["error", {
disallow: string[];
}];
'@graphql-eslint/no-scalar-result-type-on-mutation': "error";
'@graphql-eslint/require-deprecation-date': "error";
'@graphql-eslint/require-field-of-type-query-in-mutation-result': "error";
'@graphql-eslint/require-nullable-fields-with-oneof': "error";
'@graphql-eslint/require-nullable-result-in-root': "error";
'@graphql-eslint/require-type-pattern-with-oneof': "error";
};
};
'schema-relay': {
parser: string;
plugins: string[];
rules: {
'@graphql-eslint/relay-arguments': "error";
'@graphql-eslint/relay-connection-types': "error";
'@graphql-eslint/relay-edge-types': "error";
'@graphql-eslint/relay-page-info': "error";
};
};
'operations-recommended': {
parser: string;
plugins: string[];
rules: {
'@graphql-eslint/executable-definitions': "error";
'@graphql-eslint/fields-on-correct-type': "error";
'@graphql-eslint/fragments-on-composite-type': "error";
'@graphql-eslint/known-argument-names': "error";
'@graphql-eslint/known-directives': "error";
'@graphql-eslint/known-fragment-names': "error";
'@graphql-eslint/known-type-names': "error";
'@graphql-eslint/lone-anonymous-operation': "error";
'@graphql-eslint/naming-convention': ["error", {
VariableDefinition: string;
OperationDefinition: {
style: string;
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
FragmentDefinition: {
style: string;
forbiddenPrefixes: string[];
forbiddenSuffixes: string[];
};
}];
'@graphql-eslint/no-anonymous-operations': "error";
'@graphql-eslint/no-deprecated': "error";
'@graphql-eslint/no-duplicate-fields': "error";
'@graphql-eslint/no-fragment-cycles': "error";
'@graphql-eslint/no-undefined-variables': "error";
'@graphql-eslint/no-unused-fragments': "error";
'@graphql-eslint/no-unused-variables': "error";
'@graphql-eslint/one-field-subscriptions': "error";
'@graphql-eslint/overlapping-fields-can-be-merged': "error";
'@graphql-eslint/possible-fragment-spread': "error";
'@graphql-eslint/provided-required-arguments': "error";
'@graphql-eslint/require-selections': "error";
'@graphql-eslint/scalar-leafs': "error";
'@graphql-eslint/selection-set-depth': ["error", {
maxDepth: number;
}];
'@graphql-eslint/unique-argument-names': "error";
'@graphql-eslint/unique-directive-names-per-location': "error";
'@graphql-eslint/unique-fragment-name': "error";
'@graphql-eslint/unique-input-field-names': "error";
'@graphql-eslint/unique-operation-name': "error";
'@graphql-eslint/unique-variable-names': "error";
'@graphql-eslint/value-literals-of-correct-type': "error";
'@graphql-eslint/variables-are-input-types': "error";
'@graphql-eslint/variables-in-allowed-position': "error";
};
};
'operations-all': {
extends: string;
rules: {
'@graphql-eslint/alphabetize': ["error", {
definitions: boolean;
selections: string[];
variables: boolean;
arguments: string[];
groups: string[];
}];
'@graphql-eslint/lone-executable-definition': "error";
'@graphql-eslint/match-document-filename': ["error", {
query: string;
mutation: string;
subscription: string;
fragment: string;
}];
'@graphql-eslint/no-one-place-fragments': "error";
'@graphql-eslint/require-import-fragment': "error";
};
};
'flat/schema-recommended': {
rules: {
'@graphql-eslint/description-style': "error";
'@graphql-eslint/known-argument-names': "error";
'@graphql-eslint/known-directives': "error";
'@graphql-eslint/known-type-names': "error";
'@graphql-eslint/lone-schema-definition': "error";
'@graphql-eslint/naming-convention': ["error", {
types: string;
FieldDefinition: string;
InputValueDefinition: string;
Argument: string;
DirectiveDefinition: s