UNPKG

@graphql-eslint/eslint-plugin

Version:
30 lines (29 loc) 1.34 kB
import { RuleTester } from 'eslint'; import { ASTKindToNode } from 'graphql'; import { GraphQLESTreeNode } from './estree-converter/index.cjs'; import { GraphQLESLintRule, ParserOptions } from './types.cjs'; export type GraphQLESLintRuleListener<WithTypeInfo extends boolean = false> = Record<string, any> & { [K in keyof ASTKindToNode]?: (node: GraphQLESTreeNode<ASTKindToNode[K], WithTypeInfo>) => void; }; export type GraphQLValidTestCase<Options = []> = Omit<RuleTester.ValidTestCase, 'options' | 'parserOptions'> & { options?: Options; parserOptions?: Omit<ParserOptions, 'filePath'>; }; export type GraphQLInvalidTestCase<T = []> = GraphQLValidTestCase<T> & { errors: (RuleTester.TestCaseError | string)[] | number; output?: string | null; }; type RuleTesterConfig = { parser: string; parserOptions: Omit<ParserOptions, 'filePath'>; }; export declare class GraphQLRuleTester extends RuleTester { config: RuleTesterConfig; constructor(parserOptions?: Omit<ParserOptions, 'filePath'>); fromMockFile(path: string): string; runGraphQLTests<Options, WithTypeInfo extends boolean = false>(ruleId: string, rule: GraphQLESLintRule<Options, WithTypeInfo>, tests: { valid: (GraphQLValidTestCase<Options> | string)[]; invalid: GraphQLInvalidTestCase<Options>[]; }): void; } export {};