@graphql-eslint/eslint-plugin 3.11.0 → 3.11.1-alpha-20220926112156-14d4be3
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/index.js +14 -10
- package/index.mjs +14 -10
- package/package.json +1 -1
- package/types.d.ts +2 -5
package/index.js
CHANGED
@@ -65,20 +65,24 @@ const addCodeFileLoaderExtension = api => {
|
|
65
65
|
return { name: 'graphql-eslint-loaders' };
|
66
66
|
};
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
const { modules = [], globalGqlIdentifierName = ['gql', 'graphql'], gqlMagicComment = 'GraphQL', } = graphQLTagPluckOptions || {};
|
71
|
-
const RELEVANT_KEYWORDS = [
|
72
|
-
...new Set([
|
73
|
-
...modules.map(({ identifier }) => identifier),
|
74
|
-
...utils.asArray(globalGqlIdentifierName),
|
75
|
-
gqlMagicComment,
|
76
|
-
].filter(Boolean)),
|
77
|
-
];
|
68
|
+
let RELEVANT_KEYWORDS;
|
69
|
+
let graphQLTagPluckOptions;
|
78
70
|
const blocksMap = new Map();
|
79
71
|
const processor = {
|
80
72
|
supportsAutofix: true,
|
81
73
|
preprocess(code, filePath) {
|
74
|
+
var _a, _b;
|
75
|
+
if (!RELEVANT_KEYWORDS) {
|
76
|
+
graphQLTagPluckOptions = (_b = (_a = loadGraphQLConfig().getDefault()) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.graphqlTagPluck;
|
77
|
+
const { modules = [], globalGqlIdentifierName = ['gql', 'graphql'], gqlMagicComment = 'GraphQL', } = graphQLTagPluckOptions || {};
|
78
|
+
RELEVANT_KEYWORDS = [
|
79
|
+
...new Set([
|
80
|
+
...modules.map(({ identifier }) => identifier),
|
81
|
+
...utils.asArray(globalGqlIdentifierName),
|
82
|
+
gqlMagicComment,
|
83
|
+
].filter(Boolean)),
|
84
|
+
];
|
85
|
+
}
|
82
86
|
if (RELEVANT_KEYWORDS.every(keyword => !code.includes(keyword))) {
|
83
87
|
return [code];
|
84
88
|
}
|
package/index.mjs
CHANGED
@@ -59,20 +59,24 @@ const addCodeFileLoaderExtension = api => {
|
|
59
59
|
return { name: 'graphql-eslint-loaders' };
|
60
60
|
};
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
const { modules = [], globalGqlIdentifierName = ['gql', 'graphql'], gqlMagicComment = 'GraphQL', } = graphQLTagPluckOptions || {};
|
65
|
-
const RELEVANT_KEYWORDS = [
|
66
|
-
...new Set([
|
67
|
-
...modules.map(({ identifier }) => identifier),
|
68
|
-
...asArray(globalGqlIdentifierName),
|
69
|
-
gqlMagicComment,
|
70
|
-
].filter(Boolean)),
|
71
|
-
];
|
62
|
+
let RELEVANT_KEYWORDS;
|
63
|
+
let graphQLTagPluckOptions;
|
72
64
|
const blocksMap = new Map();
|
73
65
|
const processor = {
|
74
66
|
supportsAutofix: true,
|
75
67
|
preprocess(code, filePath) {
|
68
|
+
var _a, _b;
|
69
|
+
if (!RELEVANT_KEYWORDS) {
|
70
|
+
graphQLTagPluckOptions = (_b = (_a = loadGraphQLConfig().getDefault()) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.graphqlTagPluck;
|
71
|
+
const { modules = [], globalGqlIdentifierName = ['gql', 'graphql'], gqlMagicComment = 'GraphQL', } = graphQLTagPluckOptions || {};
|
72
|
+
RELEVANT_KEYWORDS = [
|
73
|
+
...new Set([
|
74
|
+
...modules.map(({ identifier }) => identifier),
|
75
|
+
...asArray(globalGqlIdentifierName),
|
76
|
+
gqlMagicComment,
|
77
|
+
].filter(Boolean)),
|
78
|
+
];
|
79
|
+
}
|
76
80
|
if (RELEVANT_KEYWORDS.every(keyword => !code.includes(keyword))) {
|
77
81
|
return [code];
|
78
82
|
}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
@@ -46,11 +46,8 @@ export declare type GraphQLESLintRuleContext<Options = any[]> = Omit<Rule.RuleCo
|
|
46
46
|
parserServices?: ParserServices;
|
47
47
|
};
|
48
48
|
export declare type CategoryType = 'Schema' | 'Operations';
|
49
|
-
export declare type RuleDocsInfo<T> = {
|
50
|
-
description: string;
|
49
|
+
export declare type RuleDocsInfo<T> = Omit<Rule.RuleMetaData['docs'], 'category' | 'suggestion'> & {
|
51
50
|
category: CategoryType | CategoryType[];
|
52
|
-
recommended?: boolean;
|
53
|
-
url: string;
|
54
51
|
requiresSchema?: true;
|
55
52
|
requiresSiblings?: true;
|
56
53
|
examples?: {
|
@@ -68,7 +65,7 @@ export declare type RuleDocsInfo<T> = {
|
|
68
65
|
export declare type GraphQLESLintRule<Options = any[], WithTypeInfo extends boolean = false> = {
|
69
66
|
create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
|
70
67
|
meta: Omit<Rule.RuleMetaData, 'docs'> & {
|
71
|
-
docs
|
68
|
+
docs?: RuleDocsInfo<Options>;
|
72
69
|
};
|
73
70
|
};
|
74
71
|
export declare type ValueOf<T> = T[keyof T];
|