@graphql-eslint/eslint-plugin 3.14.4-alpha-20221229151835-f439b5b → 3.14.4-alpha-20221229154307-d2101f5
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/estree-converter/utils.js +2 -1
- package/cjs/rules/input-name.js +3 -1
- package/cjs/rules/no-hashtag-description.js +4 -1
- package/cjs/rules/require-description.js +1 -1
- package/esm/estree-converter/utils.js +2 -1
- package/esm/rules/input-name.js +3 -1
- package/esm/rules/no-hashtag-description.js +4 -1
- package/esm/rules/require-description.js +1 -1
- package/package.json +1 -1
@@ -18,7 +18,7 @@ function convertToken(token, type) {
|
|
18
18
|
const { line, column, end, start, value } = token;
|
19
19
|
return {
|
20
20
|
type,
|
21
|
-
value,
|
21
|
+
value: value,
|
22
22
|
/*
|
23
23
|
* ESLint has 0-based column number
|
24
24
|
* https://eslint.org/docs/developer-guide/working-with-rules#contextreport
|
@@ -73,6 +73,7 @@ function extractComments(loc) {
|
|
73
73
|
if (token.kind === graphql_1.TokenKind.COMMENT) {
|
74
74
|
const comment = convertToken(token,
|
75
75
|
// `eslint-disable` directive works only with `Block` type comment
|
76
|
+
// TODO: remove `!` when drop support of graphql@15
|
76
77
|
token.value.trimStart().startsWith('eslint') ? 'Block' : 'Line');
|
77
78
|
comments.push(comment);
|
78
79
|
}
|
package/cjs/rules/input-name.js
CHANGED
@@ -32,7 +32,9 @@ const schema = {
|
|
32
32
|
},
|
33
33
|
},
|
34
34
|
};
|
35
|
-
const isObjectType = (node) =>
|
35
|
+
const isObjectType = (node) =>
|
36
|
+
// TODO: remove `as any` when drop support of graphql@15
|
37
|
+
[graphql_1.Kind.OBJECT_TYPE_DEFINITION, graphql_1.Kind.OBJECT_TYPE_EXTENSION].includes(node.type);
|
36
38
|
const isQueryType = (node) => isObjectType(node) && node.name.value === 'Query';
|
37
39
|
const isMutationType = (node) => isObjectType(node) && node.name.value === 'Mutation';
|
38
40
|
exports.rule = {
|
@@ -62,6 +62,7 @@ exports.rule = {
|
|
62
62
|
while (token) {
|
63
63
|
const { kind, prev, next, value, line, column } = token;
|
64
64
|
if (kind === graphql_1.TokenKind.COMMENT && prev && next) {
|
65
|
+
// TODO: remove `!` when drop support of graphql@15
|
65
66
|
const isEslintComment = value.trimStart().startsWith('eslint');
|
66
67
|
const linesAfter = next.line - line;
|
67
68
|
if (!isEslintComment &&
|
@@ -76,7 +77,9 @@ exports.rule = {
|
|
76
77
|
},
|
77
78
|
suggest: ['"""', '"'].map(descriptionSyntax => ({
|
78
79
|
desc: `Replace with \`${descriptionSyntax}\` description syntax`,
|
79
|
-
fix: fixer => fixer.replaceTextRange([token.start, token.end],
|
80
|
+
fix: fixer => fixer.replaceTextRange([token.start, token.end],
|
81
|
+
// TODO: remove `!` when drop support of graphql@15
|
82
|
+
[descriptionSyntax, value.trim(), descriptionSyntax].join('')),
|
80
83
|
})),
|
81
84
|
});
|
82
85
|
}
|
@@ -168,7 +168,7 @@ exports.rule = {
|
|
168
168
|
const rawNode = node.rawNode();
|
169
169
|
const { prev, line } = rawNode.loc.startToken;
|
170
170
|
if ((prev === null || prev === void 0 ? void 0 : prev.kind) === graphql_1.TokenKind.COMMENT) {
|
171
|
-
const value = prev.value.trim();
|
171
|
+
const value = prev.value.trim(); // TODO: remove `!` when drop support of graphql@15
|
172
172
|
const linesBefore = line - prev.line;
|
173
173
|
if (!value.startsWith('eslint') && linesBefore === 1) {
|
174
174
|
description = value;
|
@@ -15,7 +15,7 @@ export function convertToken(token, type) {
|
|
15
15
|
const { line, column, end, start, value } = token;
|
16
16
|
return {
|
17
17
|
type,
|
18
|
-
value,
|
18
|
+
value: value,
|
19
19
|
/*
|
20
20
|
* ESLint has 0-based column number
|
21
21
|
* https://eslint.org/docs/developer-guide/working-with-rules#contextreport
|
@@ -68,6 +68,7 @@ export function extractComments(loc) {
|
|
68
68
|
if (token.kind === TokenKind.COMMENT) {
|
69
69
|
const comment = convertToken(token,
|
70
70
|
// `eslint-disable` directive works only with `Block` type comment
|
71
|
+
// TODO: remove `!` when drop support of graphql@15
|
71
72
|
token.value.trimStart().startsWith('eslint') ? 'Block' : 'Line');
|
72
73
|
comments.push(comment);
|
73
74
|
}
|
package/esm/rules/input-name.js
CHANGED
@@ -29,7 +29,9 @@ const schema = {
|
|
29
29
|
},
|
30
30
|
},
|
31
31
|
};
|
32
|
-
const isObjectType = (node) =>
|
32
|
+
const isObjectType = (node) =>
|
33
|
+
// TODO: remove `as any` when drop support of graphql@15
|
34
|
+
[Kind.OBJECT_TYPE_DEFINITION, Kind.OBJECT_TYPE_EXTENSION].includes(node.type);
|
33
35
|
const isQueryType = (node) => isObjectType(node) && node.name.value === 'Query';
|
34
36
|
const isMutationType = (node) => isObjectType(node) && node.name.value === 'Mutation';
|
35
37
|
export const rule = {
|
@@ -59,6 +59,7 @@ export const rule = {
|
|
59
59
|
while (token) {
|
60
60
|
const { kind, prev, next, value, line, column } = token;
|
61
61
|
if (kind === TokenKind.COMMENT && prev && next) {
|
62
|
+
// TODO: remove `!` when drop support of graphql@15
|
62
63
|
const isEslintComment = value.trimStart().startsWith('eslint');
|
63
64
|
const linesAfter = next.line - line;
|
64
65
|
if (!isEslintComment &&
|
@@ -73,7 +74,9 @@ export const rule = {
|
|
73
74
|
},
|
74
75
|
suggest: ['"""', '"'].map(descriptionSyntax => ({
|
75
76
|
desc: `Replace with \`${descriptionSyntax}\` description syntax`,
|
76
|
-
fix: fixer => fixer.replaceTextRange([token.start, token.end],
|
77
|
+
fix: fixer => fixer.replaceTextRange([token.start, token.end],
|
78
|
+
// TODO: remove `!` when drop support of graphql@15
|
79
|
+
[descriptionSyntax, value.trim(), descriptionSyntax].join('')),
|
77
80
|
})),
|
78
81
|
});
|
79
82
|
}
|
@@ -165,7 +165,7 @@ export const rule = {
|
|
165
165
|
const rawNode = node.rawNode();
|
166
166
|
const { prev, line } = rawNode.loc.startToken;
|
167
167
|
if ((prev === null || prev === void 0 ? void 0 : prev.kind) === TokenKind.COMMENT) {
|
168
|
-
const value = prev.value.trim();
|
168
|
+
const value = prev.value.trim(); // TODO: remove `!` when drop support of graphql@15
|
169
169
|
const linesBefore = line - prev.line;
|
170
170
|
if (!value.startsWith('eslint') && linesBefore === 1) {
|
171
171
|
description = value;
|
package/package.json
CHANGED