@graphql-eslint/eslint-plugin 3.11.0-alpha-20220923225709-62c6df2 → 3.11.1-alpha-20220926102745-dd5901a
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/graphql-config.d.ts +1 -1
- package/index.d.ts +1 -4
- package/index.js +74 -61
- package/index.mjs +74 -61
- package/package.json +1 -1
- package/processor.d.ts +2 -3
package/graphql-config.d.ts
CHANGED
package/index.d.ts
CHANGED
@@ -4,10 +4,7 @@ export * from './testkit';
|
|
4
4
|
export * from './types';
|
5
5
|
export { requireGraphQLSchemaFromContext, requireSiblingsOperations } from './utils';
|
6
6
|
export declare const processors: {
|
7
|
-
graphql: import("eslint").Linter.Processor<string |
|
8
|
-
lineOffset: number;
|
9
|
-
offset: number;
|
10
|
-
})>;
|
7
|
+
graphql: import("eslint").Linter.Processor<string | import("./processor").Block>;
|
11
8
|
};
|
12
9
|
export declare const configs: {
|
13
10
|
[k: string]: {
|
package/index.js
CHANGED
@@ -5,27 +5,84 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
6
6
|
|
7
7
|
const graphqlTagPluck = require('@graphql-tools/graphql-tag-pluck');
|
8
|
+
const utils = require('@graphql-tools/utils');
|
9
|
+
const path = require('path');
|
10
|
+
const debugFactory = _interopDefault(require('debug'));
|
11
|
+
const graphqlConfig = require('graphql-config');
|
12
|
+
const codeFileLoader = require('@graphql-tools/code-file-loader');
|
8
13
|
const graphql = require('graphql');
|
9
14
|
const validate = require('graphql/validation/validate');
|
10
15
|
const fs = require('fs');
|
11
|
-
const path = require('path');
|
12
16
|
const lowerCase = _interopDefault(require('lodash.lowercase'));
|
13
17
|
const chalk = _interopDefault(require('chalk'));
|
14
|
-
const utils = require('@graphql-tools/utils');
|
15
18
|
const valueFromASTUntyped = require('graphql/utilities/valueFromASTUntyped');
|
16
19
|
const depthLimit = _interopDefault(require('graphql-depth-limit'));
|
17
|
-
const debugFactory = _interopDefault(require('debug'));
|
18
20
|
const fastGlob = _interopDefault(require('fast-glob'));
|
19
|
-
const graphqlConfig = require('graphql-config');
|
20
|
-
const codeFileLoader = require('@graphql-tools/code-file-loader');
|
21
21
|
const eslint = require('eslint');
|
22
22
|
const codeFrame = require('@babel/code-frame');
|
23
23
|
|
24
|
-
const
|
24
|
+
const debug = debugFactory('graphql-eslint:graphql-config');
|
25
|
+
let graphQLConfig;
|
26
|
+
function loadGraphQLConfig(options = {}) {
|
27
|
+
// We don't want cache config on test environment
|
28
|
+
// Otherwise schema and documents will be same for all tests
|
29
|
+
if (process.env.NODE_ENV !== 'test' && graphQLConfig) {
|
30
|
+
return graphQLConfig;
|
31
|
+
}
|
32
|
+
const onDiskConfig = options.skipGraphQLConfig
|
33
|
+
? null
|
34
|
+
: graphqlConfig.loadConfigSync({
|
35
|
+
// load config relative to the file being linted
|
36
|
+
rootDir: options.filePath ? path.dirname(options.filePath) : undefined,
|
37
|
+
throwOnEmpty: false,
|
38
|
+
throwOnMissing: false,
|
39
|
+
extensions: [addCodeFileLoaderExtension],
|
40
|
+
});
|
41
|
+
debug('options.skipGraphQLConfig: %o', options.skipGraphQLConfig);
|
42
|
+
if (onDiskConfig) {
|
43
|
+
debug('Graphql-config path %o', onDiskConfig.filepath);
|
44
|
+
}
|
45
|
+
const configOptions = options.projects
|
46
|
+
? { projects: options.projects }
|
47
|
+
: {
|
48
|
+
schema: (options.schema || ''),
|
49
|
+
documents: options.documents || options.operations,
|
50
|
+
extensions: options.extensions,
|
51
|
+
include: options.include,
|
52
|
+
exclude: options.exclude,
|
53
|
+
};
|
54
|
+
graphQLConfig =
|
55
|
+
onDiskConfig ||
|
56
|
+
new graphqlConfig.GraphQLConfig({
|
57
|
+
config: configOptions,
|
58
|
+
filepath: 'virtual-config',
|
59
|
+
}, [addCodeFileLoaderExtension]);
|
60
|
+
return graphQLConfig;
|
61
|
+
}
|
62
|
+
const addCodeFileLoaderExtension = api => {
|
63
|
+
api.loaders.schema.register(new codeFileLoader.CodeFileLoader());
|
64
|
+
api.loaders.documents.register(new codeFileLoader.CodeFileLoader());
|
65
|
+
return { name: 'graphql-eslint-loaders' };
|
66
|
+
};
|
67
|
+
|
68
|
+
let RELEVANT_KEYWORDS;
|
69
|
+
let graphQLTagPluckOptions;
|
25
70
|
const blocksMap = new Map();
|
26
71
|
const processor = {
|
27
72
|
supportsAutofix: true,
|
28
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
|
+
}
|
29
86
|
if (RELEVANT_KEYWORDS.every(keyword => !code.includes(keyword))) {
|
30
87
|
return [code];
|
31
88
|
}
|
@@ -33,8 +90,8 @@ const processor = {
|
|
33
90
|
code,
|
34
91
|
filePath,
|
35
92
|
options: {
|
36
|
-
globalGqlIdentifierName: ['gql', 'graphql'],
|
37
93
|
skipIndent: true,
|
94
|
+
...graphQLTagPluckOptions,
|
38
95
|
},
|
39
96
|
});
|
40
97
|
const blocks = extractedDocuments.map(item => ({
|
@@ -4206,7 +4263,7 @@ const rules = {
|
|
4206
4263
|
};
|
4207
4264
|
|
4208
4265
|
const schemaCache = new Map();
|
4209
|
-
const debug = debugFactory('graphql-eslint:schema');
|
4266
|
+
const debug$1 = debugFactory('graphql-eslint:schema');
|
4210
4267
|
function getSchema(projectForFile, options = {}) {
|
4211
4268
|
const schemaKey = utils.asArray(projectForFile.schema).sort().join(',');
|
4212
4269
|
if (!schemaKey) {
|
@@ -4217,14 +4274,14 @@ function getSchema(projectForFile, options = {}) {
|
|
4217
4274
|
}
|
4218
4275
|
let schema;
|
4219
4276
|
try {
|
4220
|
-
debug('Loading schema from %o', projectForFile.schema);
|
4277
|
+
debug$1('Loading schema from %o', projectForFile.schema);
|
4221
4278
|
schema = projectForFile.loadSchemaSync(projectForFile.schema, 'GraphQLSchema', options.schemaOptions);
|
4222
|
-
if (debug.enabled) {
|
4223
|
-
debug('Schema loaded: %o', schema instanceof graphql.GraphQLSchema);
|
4279
|
+
if (debug$1.enabled) {
|
4280
|
+
debug$1('Schema loaded: %o', schema instanceof graphql.GraphQLSchema);
|
4224
4281
|
const schemaPaths = fastGlob.sync(projectForFile.schema, {
|
4225
4282
|
absolute: true,
|
4226
4283
|
});
|
4227
|
-
debug('Schema pointers %O', schemaPaths);
|
4284
|
+
debug$1('Schema pointers %O', schemaPaths);
|
4228
4285
|
}
|
4229
4286
|
}
|
4230
4287
|
catch (error) {
|
@@ -4235,7 +4292,7 @@ function getSchema(projectForFile, options = {}) {
|
|
4235
4292
|
return schema;
|
4236
4293
|
}
|
4237
4294
|
|
4238
|
-
const debug$
|
4295
|
+
const debug$2 = debugFactory('graphql-eslint:operations');
|
4239
4296
|
const handleVirtualPath = (documents) => {
|
4240
4297
|
const filepathMap = Object.create(null);
|
4241
4298
|
return documents.map(source => {
|
@@ -4261,16 +4318,16 @@ const getSiblings = (projectForFile) => {
|
|
4261
4318
|
}
|
4262
4319
|
let siblings = operationsCache.get(documentsKey);
|
4263
4320
|
if (!siblings) {
|
4264
|
-
debug$
|
4321
|
+
debug$2('Loading operations from %o', projectForFile.documents);
|
4265
4322
|
const documents = projectForFile.loadDocumentsSync(projectForFile.documents, {
|
4266
4323
|
skipGraphQLImport: true,
|
4267
4324
|
});
|
4268
|
-
if (debug$
|
4269
|
-
debug$
|
4325
|
+
if (debug$2.enabled) {
|
4326
|
+
debug$2('Loaded %d operations', documents.length);
|
4270
4327
|
const operationsPaths = fastGlob.sync(projectForFile.documents, {
|
4271
4328
|
absolute: true,
|
4272
4329
|
});
|
4273
|
-
debug$
|
4330
|
+
debug$2('Operations pointers %O', operationsPaths);
|
4274
4331
|
}
|
4275
4332
|
siblings = handleVirtualPath(documents);
|
4276
4333
|
operationsCache.set(documentsKey, siblings);
|
@@ -4375,50 +4432,6 @@ function getSiblingOperations(projectForFile) {
|
|
4375
4432
|
return siblingOperations;
|
4376
4433
|
}
|
4377
4434
|
|
4378
|
-
const debug$2 = debugFactory('graphql-eslint:graphql-config');
|
4379
|
-
let graphQLConfig;
|
4380
|
-
function loadGraphQLConfig(options) {
|
4381
|
-
// We don't want cache config on test environment
|
4382
|
-
// Otherwise schema and documents will be same for all tests
|
4383
|
-
if (process.env.NODE_ENV !== 'test' && graphQLConfig) {
|
4384
|
-
return graphQLConfig;
|
4385
|
-
}
|
4386
|
-
const onDiskConfig = options.skipGraphQLConfig
|
4387
|
-
? null
|
4388
|
-
: graphqlConfig.loadConfigSync({
|
4389
|
-
// load config relative to the file being linted
|
4390
|
-
rootDir: options.filePath ? path.dirname(options.filePath) : undefined,
|
4391
|
-
throwOnEmpty: false,
|
4392
|
-
throwOnMissing: false,
|
4393
|
-
extensions: [addCodeFileLoaderExtension],
|
4394
|
-
});
|
4395
|
-
debug$2('options.skipGraphQLConfig: %o', options.skipGraphQLConfig);
|
4396
|
-
if (onDiskConfig) {
|
4397
|
-
debug$2('Graphql-config path %o', onDiskConfig.filepath);
|
4398
|
-
}
|
4399
|
-
const configOptions = options.projects
|
4400
|
-
? { projects: options.projects }
|
4401
|
-
: {
|
4402
|
-
schema: (options.schema || ''),
|
4403
|
-
documents: options.documents || options.operations,
|
4404
|
-
extensions: options.extensions,
|
4405
|
-
include: options.include,
|
4406
|
-
exclude: options.exclude,
|
4407
|
-
};
|
4408
|
-
graphQLConfig =
|
4409
|
-
onDiskConfig ||
|
4410
|
-
new graphqlConfig.GraphQLConfig({
|
4411
|
-
config: configOptions,
|
4412
|
-
filepath: 'virtual-config',
|
4413
|
-
}, [addCodeFileLoaderExtension]);
|
4414
|
-
return graphQLConfig;
|
4415
|
-
}
|
4416
|
-
const addCodeFileLoaderExtension = api => {
|
4417
|
-
api.loaders.schema.register(new codeFileLoader.CodeFileLoader());
|
4418
|
-
api.loaders.documents.register(new codeFileLoader.CodeFileLoader());
|
4419
|
-
return { name: 'graphql-eslint-loaders' };
|
4420
|
-
};
|
4421
|
-
|
4422
4435
|
const debug$3 = debugFactory('graphql-eslint:parser');
|
4423
4436
|
debug$3('cwd %o', process.cwd());
|
4424
4437
|
function parseForESLint(code, options = {}) {
|
package/index.mjs
CHANGED
@@ -1,25 +1,82 @@
|
|
1
1
|
import { parseCode } from '@graphql-tools/graphql-tag-pluck';
|
2
|
+
import { asArray, getDocumentNodeFromSchema, parseGraphQLSDL } from '@graphql-tools/utils';
|
3
|
+
import { dirname, extname, basename, relative, resolve } from 'path';
|
4
|
+
import debugFactory from 'debug';
|
5
|
+
import { loadConfigSync, GraphQLConfig } from 'graphql-config';
|
6
|
+
import { CodeFileLoader } from '@graphql-tools/code-file-loader';
|
2
7
|
import { Kind, visit, validate, TokenKind, isScalarType, DirectiveLocation, isInterfaceType, TypeInfo, visitWithTypeInfo, isObjectType as isObjectType$1, Source, isNonNullType, isListType, GraphQLObjectType, GraphQLInterfaceType, GraphQLSchema, GraphQLError } from 'graphql';
|
3
8
|
import { validateSDL } from 'graphql/validation/validate';
|
4
9
|
import { statSync, existsSync, readFileSync } from 'fs';
|
5
|
-
import { dirname, extname, basename, relative, resolve } from 'path';
|
6
10
|
import lowerCase from 'lodash.lowercase';
|
7
11
|
import chalk from 'chalk';
|
8
|
-
import { getDocumentNodeFromSchema, asArray, parseGraphQLSDL } from '@graphql-tools/utils';
|
9
12
|
import { valueFromASTUntyped } from 'graphql/utilities/valueFromASTUntyped';
|
10
13
|
import depthLimit from 'graphql-depth-limit';
|
11
|
-
import debugFactory from 'debug';
|
12
14
|
import fastGlob from 'fast-glob';
|
13
|
-
import { loadConfigSync, GraphQLConfig } from 'graphql-config';
|
14
|
-
import { CodeFileLoader } from '@graphql-tools/code-file-loader';
|
15
15
|
import { RuleTester, Linter } from 'eslint';
|
16
16
|
import { codeFrameColumns } from '@babel/code-frame';
|
17
17
|
|
18
|
-
const
|
18
|
+
const debug = debugFactory('graphql-eslint:graphql-config');
|
19
|
+
let graphQLConfig;
|
20
|
+
function loadGraphQLConfig(options = {}) {
|
21
|
+
// We don't want cache config on test environment
|
22
|
+
// Otherwise schema and documents will be same for all tests
|
23
|
+
if (process.env.NODE_ENV !== 'test' && graphQLConfig) {
|
24
|
+
return graphQLConfig;
|
25
|
+
}
|
26
|
+
const onDiskConfig = options.skipGraphQLConfig
|
27
|
+
? null
|
28
|
+
: loadConfigSync({
|
29
|
+
// load config relative to the file being linted
|
30
|
+
rootDir: options.filePath ? dirname(options.filePath) : undefined,
|
31
|
+
throwOnEmpty: false,
|
32
|
+
throwOnMissing: false,
|
33
|
+
extensions: [addCodeFileLoaderExtension],
|
34
|
+
});
|
35
|
+
debug('options.skipGraphQLConfig: %o', options.skipGraphQLConfig);
|
36
|
+
if (onDiskConfig) {
|
37
|
+
debug('Graphql-config path %o', onDiskConfig.filepath);
|
38
|
+
}
|
39
|
+
const configOptions = options.projects
|
40
|
+
? { projects: options.projects }
|
41
|
+
: {
|
42
|
+
schema: (options.schema || ''),
|
43
|
+
documents: options.documents || options.operations,
|
44
|
+
extensions: options.extensions,
|
45
|
+
include: options.include,
|
46
|
+
exclude: options.exclude,
|
47
|
+
};
|
48
|
+
graphQLConfig =
|
49
|
+
onDiskConfig ||
|
50
|
+
new GraphQLConfig({
|
51
|
+
config: configOptions,
|
52
|
+
filepath: 'virtual-config',
|
53
|
+
}, [addCodeFileLoaderExtension]);
|
54
|
+
return graphQLConfig;
|
55
|
+
}
|
56
|
+
const addCodeFileLoaderExtension = api => {
|
57
|
+
api.loaders.schema.register(new CodeFileLoader());
|
58
|
+
api.loaders.documents.register(new CodeFileLoader());
|
59
|
+
return { name: 'graphql-eslint-loaders' };
|
60
|
+
};
|
61
|
+
|
62
|
+
let RELEVANT_KEYWORDS;
|
63
|
+
let graphQLTagPluckOptions;
|
19
64
|
const blocksMap = new Map();
|
20
65
|
const processor = {
|
21
66
|
supportsAutofix: true,
|
22
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
|
+
}
|
23
80
|
if (RELEVANT_KEYWORDS.every(keyword => !code.includes(keyword))) {
|
24
81
|
return [code];
|
25
82
|
}
|
@@ -27,8 +84,8 @@ const processor = {
|
|
27
84
|
code,
|
28
85
|
filePath,
|
29
86
|
options: {
|
30
|
-
globalGqlIdentifierName: ['gql', 'graphql'],
|
31
87
|
skipIndent: true,
|
88
|
+
...graphQLTagPluckOptions,
|
32
89
|
},
|
33
90
|
});
|
34
91
|
const blocks = extractedDocuments.map(item => ({
|
@@ -4200,7 +4257,7 @@ const rules = {
|
|
4200
4257
|
};
|
4201
4258
|
|
4202
4259
|
const schemaCache = new Map();
|
4203
|
-
const debug = debugFactory('graphql-eslint:schema');
|
4260
|
+
const debug$1 = debugFactory('graphql-eslint:schema');
|
4204
4261
|
function getSchema(projectForFile, options = {}) {
|
4205
4262
|
const schemaKey = asArray(projectForFile.schema).sort().join(',');
|
4206
4263
|
if (!schemaKey) {
|
@@ -4211,14 +4268,14 @@ function getSchema(projectForFile, options = {}) {
|
|
4211
4268
|
}
|
4212
4269
|
let schema;
|
4213
4270
|
try {
|
4214
|
-
debug('Loading schema from %o', projectForFile.schema);
|
4271
|
+
debug$1('Loading schema from %o', projectForFile.schema);
|
4215
4272
|
schema = projectForFile.loadSchemaSync(projectForFile.schema, 'GraphQLSchema', options.schemaOptions);
|
4216
|
-
if (debug.enabled) {
|
4217
|
-
debug('Schema loaded: %o', schema instanceof GraphQLSchema);
|
4273
|
+
if (debug$1.enabled) {
|
4274
|
+
debug$1('Schema loaded: %o', schema instanceof GraphQLSchema);
|
4218
4275
|
const schemaPaths = fastGlob.sync(projectForFile.schema, {
|
4219
4276
|
absolute: true,
|
4220
4277
|
});
|
4221
|
-
debug('Schema pointers %O', schemaPaths);
|
4278
|
+
debug$1('Schema pointers %O', schemaPaths);
|
4222
4279
|
}
|
4223
4280
|
}
|
4224
4281
|
catch (error) {
|
@@ -4229,7 +4286,7 @@ function getSchema(projectForFile, options = {}) {
|
|
4229
4286
|
return schema;
|
4230
4287
|
}
|
4231
4288
|
|
4232
|
-
const debug$
|
4289
|
+
const debug$2 = debugFactory('graphql-eslint:operations');
|
4233
4290
|
const handleVirtualPath = (documents) => {
|
4234
4291
|
const filepathMap = Object.create(null);
|
4235
4292
|
return documents.map(source => {
|
@@ -4255,16 +4312,16 @@ const getSiblings = (projectForFile) => {
|
|
4255
4312
|
}
|
4256
4313
|
let siblings = operationsCache.get(documentsKey);
|
4257
4314
|
if (!siblings) {
|
4258
|
-
debug$
|
4315
|
+
debug$2('Loading operations from %o', projectForFile.documents);
|
4259
4316
|
const documents = projectForFile.loadDocumentsSync(projectForFile.documents, {
|
4260
4317
|
skipGraphQLImport: true,
|
4261
4318
|
});
|
4262
|
-
if (debug$
|
4263
|
-
debug$
|
4319
|
+
if (debug$2.enabled) {
|
4320
|
+
debug$2('Loaded %d operations', documents.length);
|
4264
4321
|
const operationsPaths = fastGlob.sync(projectForFile.documents, {
|
4265
4322
|
absolute: true,
|
4266
4323
|
});
|
4267
|
-
debug$
|
4324
|
+
debug$2('Operations pointers %O', operationsPaths);
|
4268
4325
|
}
|
4269
4326
|
siblings = handleVirtualPath(documents);
|
4270
4327
|
operationsCache.set(documentsKey, siblings);
|
@@ -4369,50 +4426,6 @@ function getSiblingOperations(projectForFile) {
|
|
4369
4426
|
return siblingOperations;
|
4370
4427
|
}
|
4371
4428
|
|
4372
|
-
const debug$2 = debugFactory('graphql-eslint:graphql-config');
|
4373
|
-
let graphQLConfig;
|
4374
|
-
function loadGraphQLConfig(options) {
|
4375
|
-
// We don't want cache config on test environment
|
4376
|
-
// Otherwise schema and documents will be same for all tests
|
4377
|
-
if (process.env.NODE_ENV !== 'test' && graphQLConfig) {
|
4378
|
-
return graphQLConfig;
|
4379
|
-
}
|
4380
|
-
const onDiskConfig = options.skipGraphQLConfig
|
4381
|
-
? null
|
4382
|
-
: loadConfigSync({
|
4383
|
-
// load config relative to the file being linted
|
4384
|
-
rootDir: options.filePath ? dirname(options.filePath) : undefined,
|
4385
|
-
throwOnEmpty: false,
|
4386
|
-
throwOnMissing: false,
|
4387
|
-
extensions: [addCodeFileLoaderExtension],
|
4388
|
-
});
|
4389
|
-
debug$2('options.skipGraphQLConfig: %o', options.skipGraphQLConfig);
|
4390
|
-
if (onDiskConfig) {
|
4391
|
-
debug$2('Graphql-config path %o', onDiskConfig.filepath);
|
4392
|
-
}
|
4393
|
-
const configOptions = options.projects
|
4394
|
-
? { projects: options.projects }
|
4395
|
-
: {
|
4396
|
-
schema: (options.schema || ''),
|
4397
|
-
documents: options.documents || options.operations,
|
4398
|
-
extensions: options.extensions,
|
4399
|
-
include: options.include,
|
4400
|
-
exclude: options.exclude,
|
4401
|
-
};
|
4402
|
-
graphQLConfig =
|
4403
|
-
onDiskConfig ||
|
4404
|
-
new GraphQLConfig({
|
4405
|
-
config: configOptions,
|
4406
|
-
filepath: 'virtual-config',
|
4407
|
-
}, [addCodeFileLoaderExtension]);
|
4408
|
-
return graphQLConfig;
|
4409
|
-
}
|
4410
|
-
const addCodeFileLoaderExtension = api => {
|
4411
|
-
api.loaders.schema.register(new CodeFileLoader());
|
4412
|
-
api.loaders.documents.register(new CodeFileLoader());
|
4413
|
-
return { name: 'graphql-eslint-loaders' };
|
4414
|
-
};
|
4415
|
-
|
4416
4429
|
const debug$3 = debugFactory('graphql-eslint:parser');
|
4417
4430
|
debug$3('cwd %o', process.cwd());
|
4418
4431
|
function parseForESLint(code, options = {}) {
|
package/package.json
CHANGED
package/processor.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
import
|
2
|
-
declare type Block = Linter.ProcessorFile & {
|
1
|
+
import { Linter } from 'eslint';
|
2
|
+
export declare type Block = Linter.ProcessorFile & {
|
3
3
|
lineOffset: number;
|
4
4
|
offset: number;
|
5
5
|
};
|
6
6
|
export declare const processor: Linter.Processor<Block | string>;
|
7
|
-
export {};
|