@graphql-eslint/eslint-plugin 3.8.0-alpha-fb12b01.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 +2 -0
- package/estree-parser/estree-ast.d.ts +1 -2
- package/estree-parser/utils.d.ts +8 -5
- package/index.js +200 -158
- package/index.mjs +199 -157
- package/package.json +1 -1
- package/rules/alphabetize.d.ts +1 -1
- package/rules/index.d.ts +1 -7
- package/testkit.d.ts +0 -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
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# `alphabetize`
|
2
2
|
|
3
|
+
đ§ The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
|
4
|
+
|
3
5
|
- Category: `Schema & Operations`
|
4
6
|
- Rule name: `@graphql-eslint/alphabetize`
|
5
7
|
- Requires GraphQL Schema: `false` [âšī¸](../../README.md#extended-linting-rules-with-graphql-schema)
|
@@ -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
|
};
|