1
1
import { parseGraphQLSDL } from '@graphql-tools/utils' ;
2
2
import { ASTNode , GraphQLError , TypeInfo , Source } from 'graphql' ;
3
- import { Linter } from 'eslint ' ;
3
+ import debugFactory from 'debug ' ;
4
4
import { convertToESTree , extractTokens } from './estree-parser' ;
5
5
import { GraphQLESLintParseResult , ParserOptions , ParserServices } from './types' ;
6
6
import { getSchema } from './schema' ;
7
7
import { getSiblingOperations } from './sibling-operations' ;
8
8
import { loadGraphQLConfig } from './graphql-config' ;
9
9
10
- export function parse ( code : string , options ?: ParserOptions ) : Linter . ESLintParseResult [ 'ast' ] {
11
- return parseForESLint ( code , options ) . ast ;
12
- }
10
+ const debug = debugFactory ( 'graphql-eslint:parser' ) ;
11
+
12
+ debug ( 'cwd %o' , process . cwd ( ) )
13
13
14
14
export function parseForESLint ( code : string , options : ParserOptions = { } ) : GraphQLESLintParseResult {
15
15
const gqlConfig = loadGraphQLConfig ( options ) ;
@@ -36,15 +36,14 @@ export function parseForESLint(code: string, options: ParserOptions = {}): Graph
36
36
37
37
return {
38
38
services : parserServices ,
39
- parserServices,
40
39
ast : {
41
- type : 'Program' ,
42
- body : [ rootTree as any ] ,
43
- sourceType : 'script' ,
44
40
comments,
41
+ tokens,
45
42
loc : rootTree . loc ,
46
43
range : rootTree . range as [ number , number ] ,
47
- tokens,
44
+ type : 'Program' ,
45
+ sourceType : 'script' ,
46
+ body : [ rootTree as any ] ,
48
47
} ,
49
48
} ;
50
49
} catch ( e ) {
0 commit comments