@graphql-eslint/eslint-plugin 3.11.0 → 3.11.1-alpha-20220926102745-dd5901a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/index.js +14 -10
  2. package/index.mjs +14 -10
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -65,20 +65,24 @@ const addCodeFileLoaderExtension = api => {
65
65
  return { name: 'graphql-eslint-loaders' };
66
66
  };
67
67
 
68
- var _a, _b;
69
- const graphQLTagPluckOptions = (_b = (_a = loadGraphQLConfig().getDefault()) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.graphqlTagPluck;
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
- var _a, _b;
63
- const graphQLTagPluckOptions = (_b = (_a = loadGraphQLConfig().getDefault()) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.graphqlTagPluck;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "3.11.0",
3
+ "version": "3.11.1-alpha-20220926102745-dd5901a",
4
4
  "description": "GraphQL plugin for ESLint",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {