@graphql-eslint/eslint-plugin 3.8.0-alpha-a8fcc7b.0 → 3.8.0-alpha-8ddf2a4.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/docs/parser.md +1 -1
- package/docs/rules/alphabetize.md +0 -2
- package/docs/rules/match-document-filename.md +2 -1
- package/estree-parser/estree-ast.d.ts +1 -2
- package/estree-parser/utils.d.ts +8 -5
- package/index.js +219 -183
- package/index.mjs +218 -182
- package/package.json +1 -2
- package/rules/match-document-filename.d.ts +2 -1
- package/rules/require-description.d.ts +1 -1
- package/utils.d.ts +4 -8
package/docs/parser.md
CHANGED
@@ -36,7 +36,7 @@ Here's a list of changes that the parser performs, in order to make the GraphQL
|
|
36
36
|
|
37
37
|
**Problem**: GraphQL uses `location` field to store the AST locations, while ESTree also uses it in a different structure.
|
38
38
|
|
39
|
-
**Solution**: The parser creates a new `location` field that is compatible with ESTree
|
39
|
+
**Solution**: The parser creates a new `location` field that is compatible with ESTree.
|
40
40
|
|
41
41
|
### Loading GraphQL Schema
|
42
42
|
|
@@ -131,7 +131,7 @@ The schema defines the following additional types:
|
|
131
131
|
|
132
132
|
## `asString` (enum)
|
133
133
|
|
134
|
-
One of: `camelCase`, `PascalCase`, `snake_case`, `UPPER_CASE`, `kebab-case`
|
134
|
+
One of: `camelCase`, `PascalCase`, `snake_case`, `UPPER_CASE`, `kebab-case`, `matchDocumentStyle`
|
135
135
|
|
136
136
|
## `asObject` (object)
|
137
137
|
|
@@ -146,6 +146,7 @@ This element must be one of the following enum values:
|
|
146
146
|
- `snake_case`
|
147
147
|
- `UPPER_CASE`
|
148
148
|
- `kebab-case`
|
149
|
+
- `matchDocumentStyle`
|
149
150
|
|
150
151
|
### `suffix` (string)
|
151
152
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ASTNode,
|
1
|
+
import { ASTNode, TypeInfo, TypeNode, ValueNode } from 'graphql';
|
2
2
|
import { BaseNode } from 'estree';
|
3
3
|
export declare type SafeGraphQLType<T extends ASTNode | ValueNode> = Omit<T extends {
|
4
4
|
readonly type: TypeNode;
|
@@ -7,7 +7,6 @@ export declare type SafeGraphQLType<T extends ASTNode | ValueNode> = Omit<T exte
|
|
7
7
|
} : T, 'loc'>;
|
8
8
|
export declare type SingleESTreeNode<T, WithTypeInfo extends boolean> = T extends ASTNode | ValueNode ? SafeGraphQLType<T> & Pick<BaseNode, 'leadingComments' | 'loc' | 'range'> & {
|
9
9
|
type: T['kind'];
|
10
|
-
gqlLocation: Location;
|
11
10
|
} & (WithTypeInfo extends true ? {
|
12
11
|
typeInfo?: () => {
|
13
12
|
argument?: ReturnType<TypeInfo['getArgument']>;
|
package/estree-parser/utils.d.ts
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
-
import { Location, ValueNode, StringValueNode, ASTNode, GraphQLOutputType, GraphQLNamedType } from 'graphql';
|
2
|
-
import {
|
3
|
-
import {
|
1
|
+
import { Location, ValueNode, StringValueNode, ASTNode, TokenKind, GraphQLOutputType, GraphQLNamedType, Token, Source } from 'graphql';
|
2
|
+
import type { Comment } from 'estree';
|
3
|
+
import type { AST } from 'eslint';
|
4
|
+
import type { GraphQLESTreeNode } from './estree-ast';
|
4
5
|
export default function keyValMap<T, V>(list: ReadonlyArray<T>, keyFn: (item: T) => string, valFn: (item: T) => V): Record<string, V>;
|
5
6
|
export declare function valueFromNode(valueNode: GraphQLESTreeNode<ValueNode>, variables?: Record<string, any>): any;
|
6
7
|
export declare function getBaseType(type: GraphQLOutputType): GraphQLNamedType;
|
7
|
-
export declare function
|
8
|
+
export declare function convertToken<T extends 'Line' | 'Block' | TokenKind>(token: Token, type: T): Omit<AST.Token, 'type'> & {
|
9
|
+
type: T;
|
10
|
+
};
|
11
|
+
export declare function extractTokens(source: Source): AST.Token[];
|
8
12
|
export declare function extractCommentsFromAst(loc: Location): Comment[];
|
9
|
-
export declare function convertLocation(gqlLocation: Location): SourceLocation;
|
10
13
|
export declare function isNodeWithDescription<T extends ASTNode>(obj: T): obj is T & {
|
11
14
|
readonly description?: StringValueNode;
|
12
15
|
};
|