@graphql-eslint/eslint-plugin 3.14.4-alpha-20230114034407-43b98e3 → 3.14.4-alpha-20230114195130-1fb7b9a
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/siblings.js +2 -2
- package/esm/siblings.js +2 -2
- package/package.json +1 -1
- package/typings/cache.d.cts +1 -1
- package/typings/cache.d.ts +1 -1
- package/typings/estree-converter/types.d.cts +3 -3
- package/typings/estree-converter/types.d.ts +3 -3
- package/typings/estree-converter/utils.d.cts +2 -2
- package/typings/estree-converter/utils.d.ts +2 -2
- package/typings/rules/require-description.d.cts +2 -2
- package/typings/rules/require-description.d.ts +2 -2
- package/typings/siblings.d.cts +1 -1
- package/typings/siblings.d.ts +1 -1
- package/typings/testkit.d.cts +4 -4
- package/typings/testkit.d.ts +4 -4
- package/typings/types.d.cts +11 -11
- package/typings/types.d.ts +11 -11
- package/typings/utils.d.cts +2 -2
- package/typings/utils.d.ts +2 -2
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 =>
|
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 =>
|
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 =>
|
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 =>
|
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
package/typings/cache.d.cts
CHANGED
package/typings/cache.d.ts
CHANGED
@@ -20,9 +20,9 @@ export type TypeInformation = {
|
|
20
20
|
parentType: ReturnType<TypeInfo['getParentType']>;
|
21
21
|
gqlType: ReturnType<TypeInfo['getType']>;
|
22
22
|
};
|
23
|
-
type NodeWithName =
|
24
|
-
type NodeWithType = FieldDefinitionNode | InputValueDefinitionNode |
|
25
|
-
type ParentNode<T> = T extends DocumentNode ? AST.Program : T extends DefinitionNode ? DocumentNode : T extends EnumValueDefinitionNode ? EnumTypeDefinitionNode | EnumTypeExtensionNode : T extends InputValueDefinitionNode ?
|
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 =
|
24
|
-
type NodeWithType = FieldDefinitionNode | InputValueDefinitionNode |
|
25
|
-
type ParentNode<T> = T extends DocumentNode ? AST.Program : T extends DefinitionNode ? DocumentNode : T extends EnumValueDefinitionNode ? EnumTypeDefinitionNode | EnumTypeExtensionNode : T extends InputValueDefinitionNode ?
|
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 = '
|
7
|
-
export declare function convertToken<T extends
|
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 = '
|
7
|
-
export declare function convertToken<T extends
|
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>;
|
package/typings/siblings.d.cts
CHANGED
@@ -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:
|
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[];
|
package/typings/siblings.d.ts
CHANGED
@@ -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:
|
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[];
|
package/typings/testkit.d.cts
CHANGED
@@ -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
|
-
}
|
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:
|
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: (
|
25
|
+
valid: (GraphQLValidTestCase<Options> | string)[];
|
26
26
|
invalid: GraphQLInvalidTestCase<Options>[];
|
27
27
|
}): void;
|
28
28
|
}
|
package/typings/testkit.d.ts
CHANGED
@@ -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
|
-
}
|
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:
|
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: (
|
25
|
+
valid: (GraphQLValidTestCase<Options> | string)[];
|
26
26
|
invalid: GraphQLInvalidTestCase<Options>[];
|
27
27
|
}): void;
|
28
28
|
}
|
package/typings/types.d.cts
CHANGED
@@ -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 =
|
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
|
45
|
-
export type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, '
|
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 = '
|
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>;
|
package/typings/types.d.ts
CHANGED
@@ -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 =
|
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
|
45
|
-
export type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleContext, '
|
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 = '
|
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>;
|
package/typings/utils.d.cts
CHANGED
@@ -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' | '
|
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
|
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 {};
|
package/typings/utils.d.ts
CHANGED
@@ -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' | '
|
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
|
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 {};
|