@graphql-eslint/eslint-plugin 2.1.0-alpha-b4cd82d.0 → 2.3.0-alpha-6ba4002.0
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/README.md +38 -18
- package/configs/all.d.ts +61 -0
- package/configs/index.d.ts +107 -0
- package/configs/recommended.d.ts +44 -0
- package/docs/README.md +64 -60
- package/docs/rules/avoid-scalar-result-type-on-mutation.md +30 -0
- package/docs/rules/avoid-typename-prefix.md +2 -0
- package/docs/rules/executable-definitions.md +3 -1
- package/docs/rules/fields-on-correct-type.md +3 -1
- package/docs/rules/fragments-on-composite-type.md +3 -1
- package/docs/rules/known-argument-names.md +3 -1
- package/docs/rules/known-directives.md +3 -1
- package/docs/rules/known-fragment-names.md +3 -1
- package/docs/rules/known-type-names.md +3 -1
- package/docs/rules/lone-anonymous-operation.md +3 -1
- package/docs/rules/lone-schema-definition.md +3 -1
- package/docs/rules/match-document-filename.md +1 -1
- package/docs/rules/naming-convention.md +2 -0
- package/docs/rules/no-anonymous-operations.md +2 -0
- package/docs/rules/no-case-insensitive-enum-values-duplicates.md +5 -1
- package/docs/rules/no-fragment-cycles.md +3 -1
- package/docs/rules/no-operation-name-suffix.md +4 -0
- package/docs/rules/no-undefined-variables.md +3 -1
- package/docs/rules/no-unreachable-types.md +2 -0
- package/docs/rules/no-unused-fields.md +2 -0
- package/docs/rules/no-unused-fragments.md +3 -1
- package/docs/rules/no-unused-variables.md +3 -1
- package/docs/rules/one-field-subscriptions.md +3 -1
- package/docs/rules/overlapping-fields-can-be-merged.md +3 -1
- package/docs/rules/possible-fragment-spread.md +3 -1
- package/docs/rules/possible-type-extension.md +3 -1
- package/docs/rules/provided-required-arguments.md +3 -1
- package/docs/rules/require-deprecation-date.md +53 -0
- package/docs/rules/require-deprecation-reason.md +2 -0
- package/docs/rules/require-field-of-type-query-in-mutation-result.md +42 -0
- package/docs/rules/scalar-leafs.md +3 -1
- package/docs/rules/strict-id-in-types.md +2 -0
- package/docs/rules/unique-argument-names.md +3 -1
- package/docs/rules/unique-directive-names-per-location.md +3 -1
- package/docs/rules/unique-directive-names.md +3 -1
- package/docs/rules/unique-enum-value-names.md +3 -1
- package/docs/rules/unique-field-definition-names.md +3 -1
- package/docs/rules/unique-input-field-names.md +3 -1
- package/docs/rules/unique-operation-types.md +3 -1
- package/docs/rules/unique-type-names.md +3 -1
- package/docs/rules/unique-variable-names.md +3 -1
- package/docs/rules/value-literals-of-correct-type.md +3 -1
- package/docs/rules/variables-are-input-types.md +3 -1
- package/docs/rules/variables-in-allowed-position.md +3 -1
- package/index.d.ts +1 -0
- package/index.js +389 -74
- package/index.mjs +390 -76
- package/package.json +1 -1
- package/rules/avoid-scalar-result-type-on-mutation.d.ts +3 -0
- package/rules/index.d.ts +5 -0
- package/rules/require-deprecation-date.d.ts +5 -0
- package/rules/require-field-of-type-query-in-mutation-result.d.ts +3 -0
- package/utils.d.ts +9 -4
package/package.json
CHANGED
package/rules/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const rules: {
|
2
2
|
'avoid-duplicate-fields': import("..").GraphQLESLintRule<[], false>;
|
3
3
|
'avoid-operation-name-prefix': import("..").GraphQLESLintRule<import("./avoid-operation-name-prefix").AvoidOperationNamePrefixConfig, false>;
|
4
|
+
'avoid-scalar-result-type-on-mutation': import("..").GraphQLESLintRule<any[], false>;
|
4
5
|
'avoid-typename-prefix': import("..").GraphQLESLintRule<any[], false>;
|
5
6
|
'description-style': import("..").GraphQLESLintRule<[{
|
6
7
|
style: "block" | "inline";
|
@@ -53,10 +54,14 @@ export declare const rules: {
|
|
53
54
|
'no-operation-name-suffix': import("..").GraphQLESLintRule<any[], false>;
|
54
55
|
'no-unreachable-types': import("..").GraphQLESLintRule<any[], false>;
|
55
56
|
'no-unused-fields': import("..").GraphQLESLintRule<any[], false>;
|
57
|
+
'require-deprecation-date': import("..").GraphQLESLintRule<[{
|
58
|
+
argumentName?: string;
|
59
|
+
}], false>;
|
56
60
|
'require-deprecation-reason': import("..").GraphQLESLintRule<any[], false>;
|
57
61
|
'require-description': import("..").GraphQLESLintRule<[{
|
58
62
|
on: ("SchemaDefinition" | "ObjectTypeDefinition" | "FieldDefinition" | "InputValueDefinition" | "InterfaceTypeDefinition" | "UnionTypeDefinition" | "EnumTypeDefinition" | "EnumValueDefinition" | "InputObjectTypeDefinition" | "DirectiveDefinition")[];
|
59
63
|
}], false>;
|
64
|
+
'require-field-of-type-query-in-mutation-result': import("..").GraphQLESLintRule<any[], false>;
|
60
65
|
'require-id-when-available': import("..").GraphQLESLintRule<[{
|
61
66
|
fieldName: string;
|
62
67
|
}], true>;
|
package/utils.d.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
import { GraphQLSchema } from 'graphql';
|
1
|
+
import { GraphQLSchema, ObjectTypeDefinitionNode, ObjectTypeExtensionNode } from 'graphql';
|
2
2
|
import { AST } from 'eslint';
|
3
3
|
import { Source as LoaderSource } from '@graphql-tools/utils';
|
4
4
|
import { GraphQLESLintRuleContext } from './types';
|
5
5
|
import { SiblingOperations } from './sibling-operations';
|
6
6
|
import { UsedFields, ReachableTypes } from './graphql-ast';
|
7
|
+
import { GraphQLESTreeNode } from './estree-parser';
|
7
8
|
export declare function requireSiblingsOperations(ruleName: string, context: GraphQLESLintRuleContext): SiblingOperations | never;
|
8
9
|
export declare function requireGraphQLSchemaFromContext(ruleName: string, context: GraphQLESLintRuleContext): GraphQLSchema | never;
|
9
10
|
export declare function requireReachableTypesFromContext(ruleName: string, context: GraphQLESLintRuleContext): ReachableTypes | never;
|
@@ -17,10 +18,12 @@ export declare const normalizePath: (path: string) => string;
|
|
17
18
|
* on disk. This attempts to transform a virtual path into an on-disk path
|
18
19
|
*/
|
19
20
|
export declare const getOnDiskFilepath: (filepath: string) => string;
|
21
|
+
export declare const getTypeName: (node: any) => any;
|
20
22
|
export declare const loaderCache: Record<string, LoaderSource[]>;
|
21
|
-
|
22
|
-
export declare const
|
23
|
-
export declare const
|
23
|
+
declare type ObjectTypeNode = GraphQLESTreeNode<ObjectTypeDefinitionNode | ObjectTypeExtensionNode>;
|
24
|
+
export declare const isQueryType: (node: ObjectTypeNode) => boolean;
|
25
|
+
export declare const isMutationType: (node: ObjectTypeNode) => boolean;
|
26
|
+
export declare const isSubscriptionType: (node: ObjectTypeNode) => boolean;
|
24
27
|
export declare enum CaseStyle {
|
25
28
|
camelCase = "camelCase",
|
26
29
|
pascalCase = "PascalCase",
|
@@ -28,4 +31,6 @@ export declare enum CaseStyle {
|
|
28
31
|
upperCase = "UPPER_CASE",
|
29
32
|
kebabCase = "kebab-case"
|
30
33
|
}
|
34
|
+
export declare const camelCase: (str: string) => string;
|
31
35
|
export declare const convertCase: (style: CaseStyle, str: string) => string;
|
36
|
+
export {};
|