@graphql-eslint/eslint-plugin 3.14.0-alpha-20221220004017-f1f0904 → 3.14.0-alpha-20221220160018-ba4832c
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/configs/operations-all.json +1 -0
- package/index.js +596 -467
- package/index.mjs +597 -468
- package/package.json +1 -1
- package/rules/alphabetize.d.ts +65 -14
- package/rules/description-style.d.ts +18 -4
- package/rules/index.d.ts +76 -18
- package/rules/input-name.d.ts +33 -7
- package/rules/lone-executable-definition.d.ts +26 -0
- package/rules/match-document-filename.d.ts +65 -13
- package/rules/naming-convention.d.ts +80 -34
- package/rules/no-anonymous-operations.d.ts +1 -2
- package/rules/no-case-insensitive-enum-values-duplicates.d.ts +1 -2
- package/rules/no-deprecated.d.ts +1 -2
- package/rules/no-duplicate-fields.d.ts +1 -2
- package/rules/no-hashtag-description.d.ts +1 -2
- package/rules/no-root-type.d.ts +23 -5
- package/rules/no-scalar-result-type-on-mutation.d.ts +1 -2
- package/rules/no-typename-prefix.d.ts +1 -2
- package/rules/no-unreachable-types.d.ts +1 -2
- package/rules/no-unused-fields.d.ts +1 -2
- package/rules/relay-arguments.d.ts +19 -4
- package/rules/relay-connection-types.d.ts +1 -2
- package/rules/relay-edge-types.d.ts +29 -6
- package/rules/relay-page-info.d.ts +1 -2
- package/rules/require-deprecation-date.d.ts +17 -4
- package/rules/require-deprecation-reason.d.ts +1 -2
- package/rules/require-description.d.ts +10 -7
- package/rules/require-field-of-type-query-in-mutation-result.d.ts +1 -2
- package/rules/require-id-when-available.d.ts +34 -4
- package/rules/selection-set-depth.d.ts +26 -5
- package/rules/strict-id-in-types.d.ts +54 -8
- package/rules/unique-fragment-name.d.ts +1 -2
- package/rules/unique-operation-name.d.ts +1 -2
- package/testkit.d.ts +1 -1
- package/types.d.ts +3 -1
- package/utils.d.ts +1 -0
@@ -1,8 +1,31 @@
|
|
1
1
|
import type { GraphQLESLintRule } from '../types';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly maxItems: 1;
|
6
|
+
readonly items: {
|
7
|
+
readonly type: "object";
|
8
|
+
readonly additionalProperties: false;
|
9
|
+
readonly minProperties: 1;
|
10
|
+
readonly properties: {
|
11
|
+
readonly withEdgeSuffix: {
|
12
|
+
readonly type: "boolean";
|
13
|
+
readonly default: true;
|
14
|
+
readonly description: "Edge type name must end in \"Edge\".";
|
15
|
+
};
|
16
|
+
readonly shouldImplementNode: {
|
17
|
+
readonly type: "boolean";
|
18
|
+
readonly default: true;
|
19
|
+
readonly description: "Edge type's field `node` must implement `Node` interface.";
|
20
|
+
};
|
21
|
+
readonly listTypeCanWrapOnlyEdgeType: {
|
22
|
+
readonly type: "boolean";
|
23
|
+
readonly default: true;
|
24
|
+
readonly description: "A list type should only wrap an edge type.";
|
25
|
+
};
|
26
|
+
};
|
27
|
+
};
|
6
28
|
};
|
7
|
-
|
8
|
-
export
|
29
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
30
|
+
export declare const rule: GraphQLESLintRule<RuleOptions, true>;
|
31
|
+
export {};
|
@@ -1,5 +1,18 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../types';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly maxItems: 1;
|
6
|
+
readonly items: {
|
7
|
+
readonly type: "object";
|
8
|
+
readonly additionalProperties: false;
|
9
|
+
readonly properties: {
|
10
|
+
readonly argumentName: {
|
11
|
+
readonly type: "string";
|
12
|
+
};
|
13
|
+
};
|
14
|
+
};
|
15
|
+
};
|
16
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
17
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
18
|
+
export {};
|
@@ -2,10 +2,13 @@ import { Kind } from 'graphql';
|
|
2
2
|
import type { GraphQLESLintRule } from '../types';
|
3
3
|
declare const ALLOWED_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, Kind.DIRECTIVE_DEFINITION, Kind.FIELD_DEFINITION, Kind.INPUT_VALUE_DEFINITION, Kind.ENUM_VALUE_DEFINITION, Kind.OPERATION_DEFINITION];
|
4
4
|
type AllowedKind = typeof ALLOWED_KINDS[number];
|
5
|
-
export type
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
|
11
|
-
|
5
|
+
export type RuleOptions = [
|
6
|
+
{
|
7
|
+
types?: boolean;
|
8
|
+
rootField?: boolean;
|
9
|
+
} & {
|
10
|
+
[key in AllowedKind]?: boolean;
|
11
|
+
}
|
12
|
+
];
|
13
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
14
|
+
export {};
|
@@ -1,6 +1,36 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../types';
|
2
|
-
|
3
|
-
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly definitions: {
|
5
|
+
readonly asString: {
|
6
|
+
readonly type: "string";
|
7
|
+
};
|
8
|
+
readonly asArray: {
|
9
|
+
readonly type: "array";
|
10
|
+
readonly uniqueItems: true;
|
11
|
+
readonly minItems: 1;
|
12
|
+
readonly items: {
|
13
|
+
readonly type: "string";
|
14
|
+
};
|
15
|
+
};
|
16
|
+
};
|
17
|
+
readonly type: "array";
|
18
|
+
readonly maxItems: 1;
|
19
|
+
readonly items: {
|
20
|
+
readonly type: "object";
|
21
|
+
readonly additionalProperties: false;
|
22
|
+
readonly properties: {
|
23
|
+
readonly fieldName: {
|
24
|
+
readonly oneOf: readonly [{
|
25
|
+
readonly $ref: "#/definitions/asString";
|
26
|
+
}, {
|
27
|
+
readonly $ref: "#/definitions/asArray";
|
28
|
+
}];
|
29
|
+
readonly default: "id";
|
30
|
+
};
|
31
|
+
};
|
32
|
+
};
|
4
33
|
};
|
5
|
-
|
6
|
-
export
|
34
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
35
|
+
export declare const rule: GraphQLESLintRule<RuleOptions, true>;
|
36
|
+
export {};
|
@@ -1,7 +1,28 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../types';
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly minItems: 1;
|
6
|
+
readonly maxItems: 1;
|
7
|
+
readonly items: {
|
8
|
+
readonly type: "object";
|
9
|
+
readonly additionalProperties: false;
|
10
|
+
readonly required: readonly ["maxDepth"];
|
11
|
+
readonly properties: {
|
12
|
+
readonly maxDepth: {
|
13
|
+
readonly type: "number";
|
14
|
+
};
|
15
|
+
readonly ignore: {
|
16
|
+
readonly type: "array";
|
17
|
+
readonly uniqueItems: true;
|
18
|
+
readonly minItems: 1;
|
19
|
+
readonly items: {
|
20
|
+
readonly type: "string";
|
21
|
+
};
|
22
|
+
};
|
23
|
+
};
|
24
|
+
};
|
5
25
|
};
|
6
|
-
|
7
|
-
export
|
26
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
27
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
28
|
+
export {};
|
@@ -1,11 +1,57 @@
|
|
1
1
|
import { GraphQLESLintRule } from '../types';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
import { FromSchema } from 'json-schema-to-ts';
|
3
|
+
declare const schema: {
|
4
|
+
readonly type: "array";
|
5
|
+
readonly maxItems: 1;
|
6
|
+
readonly items: {
|
7
|
+
readonly type: "object";
|
8
|
+
readonly additionalProperties: false;
|
9
|
+
readonly properties: {
|
10
|
+
readonly acceptedIdNames: {
|
11
|
+
readonly default: readonly ["id"];
|
12
|
+
readonly type: "array";
|
13
|
+
readonly uniqueItems: true;
|
14
|
+
readonly minItems: 1;
|
15
|
+
readonly items: {
|
16
|
+
readonly type: "string";
|
17
|
+
};
|
18
|
+
};
|
19
|
+
readonly acceptedIdTypes: {
|
20
|
+
readonly default: readonly ["ID"];
|
21
|
+
readonly type: "array";
|
22
|
+
readonly uniqueItems: true;
|
23
|
+
readonly minItems: 1;
|
24
|
+
readonly items: {
|
25
|
+
readonly type: "string";
|
26
|
+
};
|
27
|
+
};
|
28
|
+
readonly exceptions: {
|
29
|
+
readonly type: "object";
|
30
|
+
readonly additionalProperties: false;
|
31
|
+
readonly properties: {
|
32
|
+
readonly types: {
|
33
|
+
readonly description: "This is used to exclude types with names that match one of the specified values.";
|
34
|
+
readonly type: "array";
|
35
|
+
readonly uniqueItems: true;
|
36
|
+
readonly minItems: 1;
|
37
|
+
readonly items: {
|
38
|
+
readonly type: "string";
|
39
|
+
};
|
40
|
+
};
|
41
|
+
readonly suffixes: {
|
42
|
+
readonly description: "This is used to exclude types with names with suffixes that match one of the specified values.";
|
43
|
+
readonly type: "array";
|
44
|
+
readonly uniqueItems: true;
|
45
|
+
readonly minItems: 1;
|
46
|
+
readonly items: {
|
47
|
+
readonly type: "string";
|
48
|
+
};
|
49
|
+
};
|
50
|
+
};
|
51
|
+
};
|
52
|
+
};
|
8
53
|
};
|
9
54
|
};
|
10
|
-
|
11
|
-
export
|
55
|
+
export type RuleOptions = FromSchema<typeof schema>;
|
56
|
+
export declare const rule: GraphQLESLintRule<RuleOptions>;
|
57
|
+
export {};
|
@@ -2,5 +2,4 @@ import { ExecutableDefinitionNode } from 'graphql';
|
|
2
2
|
import { GraphQLESLintRule, GraphQLESLintRuleContext } from '../types';
|
3
3
|
import { GraphQLESTreeNode } from '../estree-converter';
|
4
4
|
export declare const checkNode: (context: GraphQLESLintRuleContext, node: GraphQLESTreeNode<ExecutableDefinitionNode>, ruleId: string) => void;
|
5
|
-
declare const rule: GraphQLESLintRule;
|
6
|
-
export default rule;
|
5
|
+
export declare const rule: GraphQLESLintRule;
|
package/testkit.d.ts
CHANGED
@@ -7,7 +7,7 @@ export type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = {
|
|
7
7
|
} & Record<string, any>;
|
8
8
|
export type GraphQLValidTestCase<Options> = Omit<RuleTester.ValidTestCase, 'options' | 'parserOptions'> & {
|
9
9
|
options?: Options;
|
10
|
-
parserOptions?: ParserOptions
|
10
|
+
parserOptions?: Omit<ParserOptions, 'filePath'>;
|
11
11
|
};
|
12
12
|
export type GraphQLInvalidTestCase<T> = GraphQLValidTestCase<T> & {
|
13
13
|
errors: number | (RuleTester.TestCaseError | string)[];
|
package/types.d.ts
CHANGED
@@ -5,6 +5,7 @@ import { IExtensions, IGraphQLProject } from 'graphql-config';
|
|
5
5
|
import { GraphQLParseOptions } from '@graphql-tools/utils';
|
6
6
|
import { GraphQLESLintRuleListener } from './testkit';
|
7
7
|
import { SiblingOperations } from './documents';
|
8
|
+
import { JSONSchema } from 'json-schema-to-ts';
|
8
9
|
export type Schema = GraphQLSchema | Error | null;
|
9
10
|
export type Pointer = string | string[];
|
10
11
|
export interface ParserOptions {
|
@@ -64,8 +65,9 @@ export type RuleDocsInfo<T> = Omit<Rule.RuleMetaData['docs'], 'category' | 'sugg
|
|
64
65
|
};
|
65
66
|
export type GraphQLESLintRule<Options = any[], WithTypeInfo extends boolean = false> = {
|
66
67
|
create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
|
67
|
-
meta: Omit<Rule.RuleMetaData, 'docs'> & {
|
68
|
+
meta: Omit<Rule.RuleMetaData, 'docs' | 'schema'> & {
|
68
69
|
docs?: RuleDocsInfo<Options>;
|
70
|
+
schema: Readonly<JSONSchema> | [];
|
69
71
|
};
|
70
72
|
};
|
71
73
|
export type ValueOf<T> = T[keyof T];
|
package/utils.d.ts
CHANGED
@@ -15,6 +15,7 @@ export declare const CWD: string;
|
|
15
15
|
export declare const getTypeName: (node: any) => string;
|
16
16
|
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];
|
17
17
|
export type CaseStyle = 'camelCase' | 'PascalCase' | 'snake_case' | 'UPPER_CASE' | 'kebab-case';
|
18
|
+
export declare const pascalCase: (str: string) => string;
|
18
19
|
export declare const camelCase: (str: string) => string;
|
19
20
|
export declare const convertCase: (style: CaseStyle, str: string) => string;
|
20
21
|
export declare function getLocation(start: Position, fieldName?: string): AST.SourceLocation;
|