@graphql-eslint/eslint-plugin 2.4.0-alpha-a3f52b6.0 → 2.4.1-alpha-7542cbd.0

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 CHANGED
@@ -149,7 +149,7 @@ function getLexer(source) {
149
149
  throw new Error(`Unsupported GraphQL version! Please make sure to use GraphQL v14 or newer!`);
150
150
  }
151
151
  function extractTokens(source) {
152
- const lexer = getLexer(new graphql.Source(source));
152
+ const lexer = getLexer(source);
153
153
  const tokens = [];
154
154
  let token = lexer.advance();
155
155
  while (token && token.kind !== '<EOF>') {
@@ -3693,7 +3693,7 @@ function parseForESLint(code, options = {}) {
3693
3693
  noLocation: false,
3694
3694
  });
3695
3695
  const { rootTree, comments } = convertToESTree(graphqlAst.document, schema ? new graphql.TypeInfo(schema) : null);
3696
- const tokens = extractTokens(code);
3696
+ const tokens = extractTokens(new graphql.Source(code, filePath));
3697
3697
  return {
3698
3698
  services: parserServices,
3699
3699
  parserServices,
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { Kind, Source, validate, isScalarType, TokenKind, isNonNullType, isListType, isObjectType as isObjectType$1, visit, visitWithTypeInfo, GraphQLObjectType, GraphQLInterfaceType, TypeInfo, isInterfaceType, GraphQLError } from 'graphql';
1
+ import { Kind, validate, isScalarType, TokenKind, isNonNullType, isListType, isObjectType as isObjectType$1, visit, visitWithTypeInfo, GraphQLObjectType, GraphQLInterfaceType, TypeInfo, isInterfaceType, Source, GraphQLError } from 'graphql';
2
2
  import { validateSDL } from 'graphql/validation/validate';
3
3
  import { processImport, parseImportLine } from '@graphql-tools/import';
4
4
  import { statSync, existsSync, readFileSync } from 'fs';
@@ -143,7 +143,7 @@ function getLexer(source) {
143
143
  throw new Error(`Unsupported GraphQL version! Please make sure to use GraphQL v14 or newer!`);
144
144
  }
145
145
  function extractTokens(source) {
146
- const lexer = getLexer(new Source(source));
146
+ const lexer = getLexer(source);
147
147
  const tokens = [];
148
148
  let token = lexer.advance();
149
149
  while (token && token.kind !== '<EOF>') {
@@ -3687,7 +3687,7 @@ function parseForESLint(code, options = {}) {
3687
3687
  noLocation: false,
3688
3688
  });
3689
3689
  const { rootTree, comments } = convertToESTree(graphqlAst.document, schema ? new TypeInfo(schema) : null);
3690
- const tokens = extractTokens(code);
3690
+ const tokens = extractTokens(new Source(code, filePath));
3691
3691
  return {
3692
3692
  services: parserServices,
3693
3693
  parserServices,
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "2.4.0-alpha-a3f52b6.0",
3
+ "version": "2.4.1-alpha-7542cbd.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0"
7
7
  },
8
8
  "dependencies": {
9
+ "@babel/code-frame": "7.16.0",
9
10
  "@graphql-tools/code-file-loader": "^7.0.2",
10
11
  "@graphql-tools/graphql-tag-pluck": "^7.0.2",
11
12
  "@graphql-tools/import": "^6.3.1",
package/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { GraphQLSchema, ObjectTypeDefinitionNode, ObjectTypeExtensionNode } from 'graphql';
1
+ import { GraphQLSchema, Source, ObjectTypeDefinitionNode, ObjectTypeExtensionNode } from 'graphql';
2
2
  import { AST } from 'eslint';
3
3
  import { Source as LoaderSource } from '@graphql-tools/utils';
4
4
  import { GraphQLESLintRuleContext } from './types';
@@ -9,7 +9,7 @@ export declare function requireSiblingsOperations(ruleName: string, context: Gra
9
9
  export declare function requireGraphQLSchemaFromContext(ruleName: string, context: GraphQLESLintRuleContext): GraphQLSchema | never;
10
10
  export declare function requireReachableTypesFromContext(ruleName: string, context: GraphQLESLintRuleContext): ReachableTypes | never;
11
11
  export declare function requireUsedFieldsFromContext(ruleName: string, context: GraphQLESLintRuleContext): UsedFields | never;
12
- export declare function extractTokens(source: string): AST.Token[];
12
+ export declare function extractTokens(source: Source): AST.Token[];
13
13
  export declare const normalizePath: (path: string) => string;
14
14
  /**
15
15
  * https://github.com/prettier/eslint-plugin-prettier/blob/76bd45ece6d56eb52f75db6b4a1efdd2efb56392/eslint-plugin-prettier.js#L71