@graphql-eslint/eslint-plugin 3.14.4-alpha-20230114194424-0e72698 → 3.14.4-alpha-20230114195716-15de5d3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/siblings.js CHANGED
@@ -77,7 +77,7 @@ function getSiblings(project, documents) {
77
77
  }
78
78
  return cachedOperations;
79
79
  };
80
- const getFragment = (name) => getFragments().filter(f => { var _a; return ((_a = f.document.name) === null || _a === void 0 ? void 0 : _a.value) === name; });
80
+ const getFragment = (name) => getFragments().filter(f => f.document.name.value === name);
81
81
  const collectFragments = (selectable, recursive, collected = new Map()) => {
82
82
  (0, graphql_1.visit)(selectable, {
83
83
  FragmentSpread(spread) {
@@ -101,7 +101,7 @@ function getSiblings(project, documents) {
101
101
  available: true,
102
102
  getFragment,
103
103
  getFragments,
104
- getFragmentByType: typeName => getFragments().filter(f => { var _a, _b; return ((_b = (_a = f.document.typeCondition) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.value) === typeName; }),
104
+ getFragmentByType: typeName => getFragments().filter(f => f.document.typeCondition.name.value === typeName),
105
105
  getFragmentsInUse: (selectable, recursive = true) => Array.from(collectFragments(selectable, recursive).values()),
106
106
  getOperation: name => getOperations().filter(o => { var _a; return ((_a = o.document.name) === null || _a === void 0 ? void 0 : _a.value) === name; }),
107
107
  getOperations,
package/esm/siblings.js CHANGED
@@ -74,7 +74,7 @@ export function getSiblings(project, documents) {
74
74
  }
75
75
  return cachedOperations;
76
76
  };
77
- const getFragment = (name) => getFragments().filter(f => { var _a; return ((_a = f.document.name) === null || _a === void 0 ? void 0 : _a.value) === name; });
77
+ const getFragment = (name) => getFragments().filter(f => f.document.name.value === name);
78
78
  const collectFragments = (selectable, recursive, collected = new Map()) => {
79
79
  visit(selectable, {
80
80
  FragmentSpread(spread) {
@@ -98,7 +98,7 @@ export function getSiblings(project, documents) {
98
98
  available: true,
99
99
  getFragment,
100
100
  getFragments,
101
- getFragmentByType: typeName => getFragments().filter(f => { var _a, _b; return ((_b = (_a = f.document.typeCondition) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.value) === typeName; }),
101
+ getFragmentByType: typeName => getFragments().filter(f => f.document.typeCondition.name.value === typeName),
102
102
  getFragmentsInUse: (selectable, recursive = true) => Array.from(collectFragments(selectable, recursive).values()),
103
103
  getOperation: name => getOperations().filter(o => { var _a; return ((_a = o.document.name) === null || _a === void 0 ? void 0 : _a.value) === name; }),
104
104
  getOperations,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "3.14.4-alpha-20230114194424-0e72698",
3
+ "version": "3.14.4-alpha-20230114195716-15de5d3",
4
4
  "description": "GraphQL plugin for ESLint",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -6,5 +6,5 @@ export declare class ModuleCache<T, K = any> {
6
6
  set(cacheKey: K, result: T): void;
7
7
  get(cacheKey: K, settings?: {
8
8
  lifetime: number;
9
- }): void | T;
9
+ }): T | void;
10
10
  }
@@ -6,5 +6,5 @@ export declare class ModuleCache<T, K = any> {
6
6
  set(cacheKey: K, result: T): void;
7
7
  get(cacheKey: K, settings?: {
8
8
  lifetime: number;
9
- }): void | T;
9
+ }): T | void;
10
10
  }
@@ -20,9 +20,9 @@ export type TypeInformation = {
20
20
  parentType: ReturnType<TypeInfo['getParentType']>;
21
21
  gqlType: ReturnType<TypeInfo['getType']>;
22
22
  };
23
- type NodeWithName = TypeDefinitionNode | TypeExtensionNode | ExecutableDefinitionNode | DirectiveDefinitionNode | FieldDefinitionNode | EnumValueDefinitionNode | FieldNode | FragmentSpreadNode | VariableNode | ArgumentNode | NamedTypeNode;
24
- type NodeWithType = FieldDefinitionNode | InputValueDefinitionNode | OperationTypeDefinitionNode | NonNullTypeNode | ListTypeNode | VariableDefinitionNode;
25
- type ParentNode<T> = T extends DocumentNode ? AST.Program : T extends DefinitionNode ? DocumentNode : T extends EnumValueDefinitionNode ? EnumTypeDefinitionNode | EnumTypeExtensionNode : T extends InputValueDefinitionNode ? InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode | FieldDefinitionNode | DirectiveDefinitionNode : T extends FieldDefinitionNode ? ObjectTypeDefinitionNode | ObjectTypeExtensionNode | InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode : 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;
23
+ type NodeWithName = ArgumentNode | DirectiveDefinitionNode | EnumValueDefinitionNode | ExecutableDefinitionNode | FieldDefinitionNode | FieldNode | FragmentSpreadNode | NamedTypeNode | TypeDefinitionNode | TypeExtensionNode | VariableNode;
24
+ type NodeWithType = FieldDefinitionNode | InputValueDefinitionNode | ListTypeNode | NonNullTypeNode | OperationTypeDefinitionNode | VariableDefinitionNode;
25
+ 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;
26
26
  type Node<T extends ASTNode, WithTypeInfo extends boolean> = Writeable<SafeGraphQLType<T>> & {
27
27
  type: T['kind'];
28
28
  loc: SourceLocation;
@@ -20,9 +20,9 @@ export type TypeInformation = {
20
20
  parentType: ReturnType<TypeInfo['getParentType']>;
21
21
  gqlType: ReturnType<TypeInfo['getType']>;
22
22
  };
23
- type NodeWithName = TypeDefinitionNode | TypeExtensionNode | ExecutableDefinitionNode | DirectiveDefinitionNode | FieldDefinitionNode | EnumValueDefinitionNode | FieldNode | FragmentSpreadNode | VariableNode | ArgumentNode | NamedTypeNode;
24
- type NodeWithType = FieldDefinitionNode | InputValueDefinitionNode | OperationTypeDefinitionNode | NonNullTypeNode | ListTypeNode | VariableDefinitionNode;
25
- type ParentNode<T> = T extends DocumentNode ? AST.Program : T extends DefinitionNode ? DocumentNode : T extends EnumValueDefinitionNode ? EnumTypeDefinitionNode | EnumTypeExtensionNode : T extends InputValueDefinitionNode ? InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode | FieldDefinitionNode | DirectiveDefinitionNode : T extends FieldDefinitionNode ? ObjectTypeDefinitionNode | ObjectTypeExtensionNode | InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode : 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;
23
+ type NodeWithName = ArgumentNode | DirectiveDefinitionNode | EnumValueDefinitionNode | ExecutableDefinitionNode | FieldDefinitionNode | FieldNode | FragmentSpreadNode | NamedTypeNode | TypeDefinitionNode | TypeExtensionNode | VariableNode;
24
+ type NodeWithType = FieldDefinitionNode | InputValueDefinitionNode | ListTypeNode | NonNullTypeNode | OperationTypeDefinitionNode | VariableDefinitionNode;
25
+ 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;
26
26
  type Node<T extends ASTNode, WithTypeInfo extends boolean> = Writeable<SafeGraphQLType<T>> & {
27
27
  type: T['kind'];
28
28
  loc: SourceLocation;
@@ -3,8 +3,8 @@ import { Comment, SourceLocation } from 'estree';
3
3
  import { GraphQLNamedType, GraphQLOutputType, Location, Token } from 'graphql';
4
4
  export declare const valueFromNode: (valueNode: import("graphql").ValueNode, variables?: import("graphql/jsutils/Maybe").Maybe<import("graphql/jsutils/ObjMap").ObjMap<unknown>>) => any;
5
5
  export declare function getBaseType(type: GraphQLOutputType): GraphQLNamedType;
6
- type TokenKindValue = '<SOF>' | '!' | '$' | '&' | '(' | ')' | '...' | ':' | '=' | '@' | '[' | ']' | '{' | '|' | '}' | 'Name' | 'Int' | 'Float' | 'String' | 'BlockString' | 'Comment';
7
- export declare function convertToken<T extends 'Line' | 'Block' | TokenKindValue>(token: Token, type: T): Omit<AST.Token, 'type'> & {
6
+ type TokenKindValue = ':' | '!' | '...' | '(' | ')' | '[' | ']' | '{' | '}' | '@' | '&' | '<SOF>' | '=' | '|' | '$' | 'BlockString' | 'Comment' | 'Float' | 'Int' | 'Name' | 'String';
7
+ export declare function convertToken<T extends TokenKindValue | 'Block' | 'Line'>(token: Token, type: T): Omit<AST.Token, 'type'> & {
8
8
  type: T;
9
9
  };
10
10
  export declare function extractTokens(filePath: string, code: string): AST.Token[];
@@ -3,8 +3,8 @@ import { Comment, SourceLocation } from 'estree';
3
3
  import { GraphQLNamedType, GraphQLOutputType, Location, Token } from 'graphql';
4
4
  export declare const valueFromNode: (valueNode: import("graphql").ValueNode, variables?: import("graphql/jsutils/Maybe").Maybe<import("graphql/jsutils/ObjMap").ObjMap<unknown>>) => any;
5
5
  export declare function getBaseType(type: GraphQLOutputType): GraphQLNamedType;
6
- type TokenKindValue = '<SOF>' | '!' | '$' | '&' | '(' | ')' | '...' | ':' | '=' | '@' | '[' | ']' | '{' | '|' | '}' | 'Name' | 'Int' | 'Float' | 'String' | 'BlockString' | 'Comment';
7
- export declare function convertToken<T extends 'Line' | 'Block' | TokenKindValue>(token: Token, type: T): Omit<AST.Token, 'type'> & {
6
+ type TokenKindValue = ':' | '!' | '...' | '(' | ')' | '[' | ']' | '{' | '}' | '@' | '&' | '<SOF>' | '=' | '|' | '$' | 'BlockString' | 'Comment' | 'Float' | 'Int' | 'Name' | 'String';
7
+ export declare function convertToken<T extends TokenKindValue | 'Block' | 'Line'>(token: Token, type: T): Omit<AST.Token, 'type'> & {
8
8
  type: T;
9
9
  };
10
10
  export declare function extractTokens(filePath: string, code: string): AST.Token[];
@@ -4,10 +4,10 @@ declare const ALLOWED_KINDS: readonly [Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFA
4
4
  type AllowedKind = (typeof ALLOWED_KINDS)[number];
5
5
  export type RuleOptions = [
6
6
  {
7
+ [key in AllowedKind]?: boolean;
8
+ } & {
7
9
  types?: boolean;
8
10
  rootField?: boolean;
9
- } & {
10
- [key in AllowedKind]?: boolean;
11
11
  }
12
12
  ];
13
13
  export declare const rule: GraphQLESLintRule<RuleOptions>;
@@ -4,10 +4,10 @@ declare const ALLOWED_KINDS: readonly [Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFA
4
4
  type AllowedKind = (typeof ALLOWED_KINDS)[number];
5
5
  export type RuleOptions = [
6
6
  {
7
+ [key in AllowedKind]?: boolean;
8
+ } & {
7
9
  types?: boolean;
8
10
  rootField?: boolean;
9
- } & {
10
- [key in AllowedKind]?: boolean;
11
11
  }
12
12
  ];
13
13
  export declare const rule: GraphQLESLintRule<RuleOptions>;
@@ -14,7 +14,7 @@ export type SiblingOperations = {
14
14
  getFragment(fragmentName: string): FragmentSource[];
15
15
  getFragments(): FragmentSource[];
16
16
  getFragmentByType(typeName: string): FragmentSource[];
17
- getFragmentsInUse(baseOperation: OperationDefinitionNode | FragmentDefinitionNode | SelectionSetNode, recursive?: boolean): FragmentDefinitionNode[];
17
+ getFragmentsInUse(baseOperation: FragmentDefinitionNode | OperationDefinitionNode | SelectionSetNode, recursive?: boolean): FragmentDefinitionNode[];
18
18
  getOperation(operationName: string): OperationSource[];
19
19
  getOperations(): OperationSource[];
20
20
  getOperationByType(operationType: OperationTypeNode): OperationSource[];
@@ -14,7 +14,7 @@ export type SiblingOperations = {
14
14
  getFragment(fragmentName: string): FragmentSource[];
15
15
  getFragments(): FragmentSource[];
16
16
  getFragmentByType(typeName: string): FragmentSource[];
17
- getFragmentsInUse(baseOperation: OperationDefinitionNode | FragmentDefinitionNode | SelectionSetNode, recursive?: boolean): FragmentDefinitionNode[];
17
+ getFragmentsInUse(baseOperation: FragmentDefinitionNode | OperationDefinitionNode | SelectionSetNode, recursive?: boolean): FragmentDefinitionNode[];
18
18
  getOperation(operationName: string): OperationSource[];
19
19
  getOperations(): OperationSource[];
20
20
  getOperationByType(operationType: OperationTypeNode): OperationSource[];
@@ -2,15 +2,15 @@ import { RuleTester } from 'eslint';
2
2
  import { ASTKindToNode } from 'graphql';
3
3
  import { GraphQLESTreeNode } from './estree-converter/index.cjs';
4
4
  import { GraphQLESLintRule, ParserOptions } from './types.cjs';
5
- export type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = {
5
+ export type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = Record<string, any> & {
6
6
  [K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void;
7
- } & Record<string, any>;
7
+ };
8
8
  export type GraphQLValidTestCase<Options> = Omit<RuleTester.ValidTestCase, 'options' | 'parserOptions'> & {
9
9
  options?: Options;
10
10
  parserOptions?: Omit<ParserOptions, 'filePath'>;
11
11
  };
12
12
  export type GraphQLInvalidTestCase<T> = GraphQLValidTestCase<T> & {
13
- errors: number | (RuleTester.TestCaseError | string)[];
13
+ errors: (RuleTester.TestCaseError | string)[] | number;
14
14
  output?: string | null;
15
15
  };
16
16
  type RuleTesterConfig = {
@@ -22,7 +22,7 @@ export declare class GraphQLRuleTester extends RuleTester {
22
22
  constructor(parserOptions?: Omit<ParserOptions, 'filePath'>);
23
23
  fromMockFile(path: string): string;
24
24
  runGraphQLTests<Options, WithTypeInfo extends boolean = false>(ruleId: string, rule: GraphQLESLintRule<Options, WithTypeInfo>, tests: {
25
- valid: (string | GraphQLValidTestCase<Options>)[];
25
+ valid: (GraphQLValidTestCase<Options> | string)[];
26
26
  invalid: GraphQLInvalidTestCase<Options>[];
27
27
  }): void;
28
28
  }
@@ -2,15 +2,15 @@ import { RuleTester } from 'eslint';
2
2
  import { ASTKindToNode } from 'graphql';
3
3
  import { GraphQLESTreeNode } from './estree-converter/index.js';
4
4
  import { GraphQLESLintRule, ParserOptions } from './types.js';
5
- export type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = {
5
+ export type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = Record<string, any> & {
6
6
  [K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void;
7
- } & Record<string, any>;
7
+ };
8
8
  export type GraphQLValidTestCase<Options> = Omit<RuleTester.ValidTestCase, 'options' | 'parserOptions'> & {
9
9
  options?: Options;
10
10
  parserOptions?: Omit<ParserOptions, 'filePath'>;
11
11
  };
12
12
  export type GraphQLInvalidTestCase<T> = GraphQLValidTestCase<T> & {
13
- errors: number | (RuleTester.TestCaseError | string)[];
13
+ errors: (RuleTester.TestCaseError | string)[] | number;
14
14
  output?: string | null;
15
15
  };
16
16
  type RuleTesterConfig = {
@@ -22,7 +22,7 @@ export declare class GraphQLRuleTester extends RuleTester {
22
22
  constructor(parserOptions?: Omit<ParserOptions, 'filePath'>);
23
23
  fromMockFile(path: string): string;
24
24
  runGraphQLTests<Options, WithTypeInfo extends boolean = false>(ruleId: string, rule: GraphQLESLintRule<Options, WithTypeInfo>, tests: {
25
- valid: (string | GraphQLValidTestCase<Options>)[];
25
+ valid: (GraphQLValidTestCase<Options> | string)[];
26
26
  invalid: GraphQLInvalidTestCase<Options>[];
27
27
  }): void;
28
28
  }
@@ -6,8 +6,8 @@ import { IExtensions, IGraphQLProject } from 'graphql-config';
6
6
  import { JSONSchema } from 'json-schema-to-ts';
7
7
  import { SiblingOperations } from './siblings.cjs';
8
8
  import { GraphQLESLintRuleListener } from './testkit.cjs';
9
- export type Schema = GraphQLSchema | Error | null;
10
- export type Pointer = string | string[];
9
+ export type Schema = Error | GraphQLSchema | null;
10
+ export type Pointer = string[] | string;
11
11
  export interface ParserOptions {
12
12
  schema?: Pointer | Record<string, {
13
13
  headers: Record<string, string>;
@@ -35,19 +35,19 @@ export type GraphQLESLintParseResult = Linter.ESLintParseResult & {
35
35
  };
36
36
  type Location = AST.SourceLocation | ESTree.Position;
37
37
  type ReportDescriptorLocation = {
38
+ loc: Location;
39
+ } | {
38
40
  node: {
39
41
  loc: Location;
40
42
  };
41
- } | {
42
- loc: Location;
43
43
  };
44
- export type ReportDescriptor = Rule.ReportDescriptorMessage & Rule.ReportDescriptorOptions & ReportDescriptorLocation;
45
- export type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'parserServices' | 'report' | 'options'> & {
44
+ export type ReportDescriptor = ReportDescriptorLocation & Rule.ReportDescriptorMessage & Rule.ReportDescriptorOptions;
45
+ export type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'options' | 'parserServices' | 'report'> & {
46
46
  options: Options;
47
- report(descriptor: ReportDescriptor): void;
48
47
  parserServices: ParserServices;
48
+ report(descriptor: ReportDescriptor): void;
49
49
  };
50
- export type CategoryType = 'Schema' | 'Operations';
50
+ export type CategoryType = 'Operations' | 'Schema';
51
51
  type RuleMetaDataDocs = Required<Rule.RuleMetaData>['docs'];
52
52
  export type RuleDocsInfo<T> = Omit<RuleMetaDataDocs, 'category' | 'suggestion'> & {
53
53
  category: CategoryType | CategoryType[];
@@ -66,16 +66,16 @@ export type RuleDocsInfo<T> = Omit<RuleMetaDataDocs, 'category' | 'suggestion'>
66
66
  isDisabledForAllConfig?: true;
67
67
  };
68
68
  export type GraphQLESLintRule<Options = [], WithTypeInfo extends boolean = false> = {
69
- create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
70
69
  meta: Omit<Rule.RuleMetaData, 'docs' | 'schema'> & {
71
70
  docs?: RuleDocsInfo<Options>;
72
71
  schema: Readonly<JSONSchema> | [];
73
72
  };
73
+ create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
74
74
  };
75
75
  export type ValueOf<T> = T[keyof T];
76
- type Id<T> = {} & {
76
+ type Id<T> = {
77
77
  [P in keyof T]: T[P];
78
- };
78
+ } & {};
79
79
  type OmitDistributive<T, K extends PropertyKey> = T extends object ? Id<OmitRecursively<T, K>> : T;
80
80
  export type OmitRecursively<T extends object, K extends PropertyKey> = Omit<{
81
81
  [P in keyof T]: OmitDistributive<T[P], K>;
@@ -6,8 +6,8 @@ import { IExtensions, IGraphQLProject } from 'graphql-config';
6
6
  import { JSONSchema } from 'json-schema-to-ts';
7
7
  import { SiblingOperations } from './siblings.js';
8
8
  import { GraphQLESLintRuleListener } from './testkit.js';
9
- export type Schema = GraphQLSchema | Error | null;
10
- export type Pointer = string | string[];
9
+ export type Schema = Error | GraphQLSchema | null;
10
+ export type Pointer = string[] | string;
11
11
  export interface ParserOptions {
12
12
  schema?: Pointer | Record<string, {
13
13
  headers: Record<string, string>;
@@ -35,19 +35,19 @@ export type GraphQLESLintParseResult = Linter.ESLintParseResult & {
35
35
  };
36
36
  type Location = AST.SourceLocation | ESTree.Position;
37
37
  type ReportDescriptorLocation = {
38
+ loc: Location;
39
+ } | {
38
40
  node: {
39
41
  loc: Location;
40
42
  };
41
- } | {
42
- loc: Location;
43
43
  };
44
- export type ReportDescriptor = Rule.ReportDescriptorMessage & Rule.ReportDescriptorOptions & ReportDescriptorLocation;
45
- export type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'parserServices' | 'report' | 'options'> & {
44
+ export type ReportDescriptor = ReportDescriptorLocation & Rule.ReportDescriptorMessage & Rule.ReportDescriptorOptions;
45
+ export type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, 'options' | 'parserServices' | 'report'> & {
46
46
  options: Options;
47
- report(descriptor: ReportDescriptor): void;
48
47
  parserServices: ParserServices;
48
+ report(descriptor: ReportDescriptor): void;
49
49
  };
50
- export type CategoryType = 'Schema' | 'Operations';
50
+ export type CategoryType = 'Operations' | 'Schema';
51
51
  type RuleMetaDataDocs = Required<Rule.RuleMetaData>['docs'];
52
52
  export type RuleDocsInfo<T> = Omit<RuleMetaDataDocs, 'category' | 'suggestion'> & {
53
53
  category: CategoryType | CategoryType[];
@@ -66,16 +66,16 @@ export type RuleDocsInfo<T> = Omit<RuleMetaDataDocs, 'category' | 'suggestion'>
66
66
  isDisabledForAllConfig?: true;
67
67
  };
68
68
  export type GraphQLESLintRule<Options = [], WithTypeInfo extends boolean = false> = {
69
- create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
70
69
  meta: Omit<Rule.RuleMetaData, 'docs' | 'schema'> & {
71
70
  docs?: RuleDocsInfo<Options>;
72
71
  schema: Readonly<JSONSchema> | [];
73
72
  };
73
+ create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
74
74
  };
75
75
  export type ValueOf<T> = T[keyof T];
76
- type Id<T> = {} & {
76
+ type Id<T> = {
77
77
  [P in keyof T]: T[P];
78
- };
78
+ } & {};
79
79
  type OmitDistributive<T, K extends PropertyKey> = T extends object ? Id<OmitRecursively<T, K>> : T;
80
80
  export type OmitRecursively<T extends object, K extends PropertyKey> = Omit<{
81
81
  [P in keyof T]: OmitDistributive<T[P], K>;
@@ -15,7 +15,7 @@ export declare const CWD: string;
15
15
  export declare const IS_BROWSER: boolean;
16
16
  export declare const getTypeName: (node: ASTNode) => string;
17
17
  export declare const TYPES_KINDS: readonly [Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFACE_TYPE_DEFINITION, Kind.ENUM_TYPE_DEFINITION, Kind.SCALAR_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.UNION_TYPE_DEFINITION];
18
- export type CaseStyle = 'camelCase' | 'PascalCase' | 'snake_case' | 'UPPER_CASE' | 'kebab-case';
18
+ export type CaseStyle = 'camelCase' | 'kebab-case' | 'PascalCase' | 'snake_case' | 'UPPER_CASE';
19
19
  export declare const pascalCase: (str: string) => string;
20
20
  export declare const camelCase: (str: string) => string;
21
21
  export declare const convertCase: (style: CaseStyle, str: string) => string;
@@ -33,6 +33,6 @@ export declare const ARRAY_DEFAULT_OPTIONS: {
33
33
  };
34
34
  };
35
35
  export declare const englishJoinWords: (words: string[]) => string;
36
- type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
36
+ type Truthy<T> = T extends '' | 0 | false | null | undefined ? never : T;
37
37
  export declare function truthy<T>(value: T): value is Truthy<T>;
38
38
  export {};
@@ -15,7 +15,7 @@ export declare const CWD: string;
15
15
  export declare const IS_BROWSER: boolean;
16
16
  export declare const getTypeName: (node: ASTNode) => string;
17
17
  export declare const TYPES_KINDS: readonly [Kind.OBJECT_TYPE_DEFINITION, Kind.INTERFACE_TYPE_DEFINITION, Kind.ENUM_TYPE_DEFINITION, Kind.SCALAR_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.UNION_TYPE_DEFINITION];
18
- export type CaseStyle = 'camelCase' | 'PascalCase' | 'snake_case' | 'UPPER_CASE' | 'kebab-case';
18
+ export type CaseStyle = 'camelCase' | 'kebab-case' | 'PascalCase' | 'snake_case' | 'UPPER_CASE';
19
19
  export declare const pascalCase: (str: string) => string;
20
20
  export declare const camelCase: (str: string) => string;
21
21
  export declare const convertCase: (style: CaseStyle, str: string) => string;
@@ -33,6 +33,6 @@ export declare const ARRAY_DEFAULT_OPTIONS: {
33
33
  };
34
34
  };
35
35
  export declare const englishJoinWords: (words: string[]) => string;
36
- type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
36
+ type Truthy<T> = T extends '' | 0 | false | null | undefined ? never : T;
37
37
  export declare function truthy<T>(value: T): value is Truthy<T>;
38
38
  export {};