@graphql-eslint/eslint-plugin 2.4.0-alpha-0617395.0 → 2.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "2.4.0-alpha-0617395.0",
3
+ "version": "2.4.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"
@@ -1,9 +1,10 @@
1
+ import { Kind } from 'graphql';
1
2
  import { GraphQLESLintRule } from '../types';
2
- declare const fieldsEnum: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[];
3
- declare const valuesEnum: "EnumTypeDefinition"[];
4
- declare const selectionsEnum: ("OperationDefinition" | "FragmentDefinition")[];
5
- declare const variablesEnum: "OperationDefinition"[];
6
- declare const argumentsEnum: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[];
3
+ declare const fieldsEnum: Kind[];
4
+ declare const valuesEnum: Kind[];
5
+ declare const selectionsEnum: Kind[];
6
+ declare const variablesEnum: Kind[];
7
+ declare const argumentsEnum: Kind[];
7
8
  declare type AlphabetizeConfig = [
8
9
  {
9
10
  fields?: typeof fieldsEnum;
@@ -1,3 +1,3 @@
1
1
  import { GraphQLESLintRule } from '../types';
2
- declare const rule: GraphQLESLintRule<[], false>;
2
+ declare const rule: GraphQLESLintRule;
3
3
  export default rule;
package/rules/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  export declare const rules: {
2
2
  alphabetize: import("..").GraphQLESLintRule<[{
3
- fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[];
4
- values?: "EnumTypeDefinition"[];
5
- selections?: ("OperationDefinition" | "FragmentDefinition")[];
6
- variables?: "OperationDefinition"[];
7
- arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[];
3
+ fields?: import("graphql").Kind[];
4
+ values?: import("graphql").Kind[];
5
+ selections?: import("graphql").Kind[];
6
+ variables?: import("graphql").Kind[];
7
+ arguments?: import("graphql").Kind[];
8
8
  }], false>;
9
- 'avoid-duplicate-fields': import("..").GraphQLESLintRule<[], false>;
9
+ 'avoid-duplicate-fields': import("..").GraphQLESLintRule<any[], false>;
10
10
  'avoid-operation-name-prefix': import("..").GraphQLESLintRule<import("./avoid-operation-name-prefix").AvoidOperationNamePrefixConfig, false>;
11
11
  'avoid-scalar-result-type-on-mutation': import("..").GraphQLESLintRule<any[], false>;
12
12
  'avoid-typename-prefix': import("..").GraphQLESLintRule<any[], false>;
@@ -66,7 +66,7 @@ export declare const rules: {
66
66
  }], false>;
67
67
  'require-deprecation-reason': import("..").GraphQLESLintRule<any[], false>;
68
68
  'require-description': import("..").GraphQLESLintRule<[{
69
- on: ("SchemaDefinition" | "ObjectTypeDefinition" | "FieldDefinition" | "InputValueDefinition" | "InterfaceTypeDefinition" | "UnionTypeDefinition" | "EnumTypeDefinition" | "EnumValueDefinition" | "InputObjectTypeDefinition" | "DirectiveDefinition")[];
69
+ on: import("graphql").Kind[];
70
70
  }], false>;
71
71
  'require-field-of-type-query-in-mutation-result': import("..").GraphQLESLintRule<any[], false>;
72
72
  'require-id-when-available': import("..").GraphQLESLintRule<[{
@@ -1,5 +1,6 @@
1
1
  import { GraphQLESLintRule } from '../types';
2
- declare const DESCRIBABLE_NODES: ("SchemaDefinition" | "ObjectTypeDefinition" | "FieldDefinition" | "InputValueDefinition" | "InterfaceTypeDefinition" | "UnionTypeDefinition" | "EnumTypeDefinition" | "EnumValueDefinition" | "InputObjectTypeDefinition" | "DirectiveDefinition")[];
2
+ import { Kind } from 'graphql';
3
+ declare const DESCRIBABLE_NODES: Kind[];
3
4
  declare type RequireDescriptionRuleConfig = [{
4
5
  on: typeof DESCRIBABLE_NODES;
5
6
  }];
package/testkit.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare type GraphQLESLintRuleListener<WithTypeInfo extends boolean = fal
6
6
  [K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void;
7
7
  } & Record<string, any>;
8
8
  export declare type GraphQLValidTestCase<Options> = Omit<RuleTester.ValidTestCase, 'options' | 'parserOptions'> & {
9
+ name: string;
9
10
  options?: Options;
10
11
  parserOptions?: ParserOptions;
11
12
  };
@@ -13,8 +14,11 @@ export declare type GraphQLInvalidTestCase<T> = GraphQLValidTestCase<T> & {
13
14
  errors: number | Array<RuleTester.TestCaseError | string>;
14
15
  output?: string | null;
15
16
  };
16
- declare const GraphQLRuleTester_base: any;
17
- export declare class GraphQLRuleTester extends GraphQLRuleTester_base {
17
+ export declare class GraphQLRuleTester extends RuleTester {
18
+ config: {
19
+ parser: string;
20
+ parserOptions: ParserOptions;
21
+ };
18
22
  constructor(parserOptions?: ParserOptions);
19
23
  fromMockFile(path: string): string;
20
24
  runGraphQLTests<Config>(name: string, rule: GraphQLESLintRule, tests: {
@@ -22,4 +26,3 @@ export declare class GraphQLRuleTester extends GraphQLRuleTester_base {
22
26
  invalid: GraphQLInvalidTestCase<Config>[];
23
27
  }): void;
24
28
  }
25
- export {};
package/types.d.ts CHANGED
@@ -56,6 +56,7 @@ export declare type RuleDocsInfo<T> = Rule.RuleMetaData & {
56
56
  usage?: T;
57
57
  }[];
58
58
  optionsForConfig?: T;
59
+ graphQLJSRuleName?: string;
59
60
  };
60
61
  };
61
62
  export declare type GraphQLESLintRule<Options = any[], WithTypeInfo extends boolean = false> = {
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
@@ -31,7 +31,10 @@ export declare enum CaseStyle {
31
31
  upperCase = "UPPER_CASE",
32
32
  kebabCase = "kebab-case"
33
33
  }
34
- export declare const pascalCase: (str: string) => string;
35
34
  export declare const camelCase: (str: string) => string;
36
35
  export declare const convertCase: (style: CaseStyle, str: string) => string;
36
+ export declare function getLocation(loc: Partial<AST.SourceLocation>, fieldName?: string, offset?: {
37
+ offsetStart?: number;
38
+ offsetEnd?: number;
39
+ }): AST.SourceLocation;
37
40
  export {};