UNPKG

eslint-plugin-mocha

Version:

Eslint rules for mocha.

43 lines 2.39 kB
import type { Rule } from 'eslint'; import { type TrackedBinding } from './tracked-callback-reference-state.ts'; type CallExpressionNode = Readonly<Parameters<Exclude<Rule.RuleListener['CallExpression'], undefined>>[0]>; type CallbackReferenceState = { readonly aliasBindings: ReadonlySet<TrackedBinding>; readonly containerPropertiesByBinding: ReadonlyMap<TrackedBinding, ReadonlySet<string>>; }; export type CallbackPathState = { readonly callbackHandled: boolean; readonly handledReferences: CallbackReferenceState; readonly unhandledReferences: CallbackReferenceState; }; export type CallbackHandlingOperation = { readonly node: CallExpressionNode; readonly type: 'call'; } | { readonly node: Rule.Node; readonly propertyName: string | undefined; readonly source: Readonly<Rule.Node> | null; readonly target: TrackedBinding; readonly type: 'containerPropertyAssignment'; } | { readonly node: Rule.Node; readonly source: Readonly<Rule.Node> | null; readonly target: TrackedBinding; readonly type: 'bindingAssignment'; } | { readonly node: Rule.Node; readonly type: 'callbackHandoff'; }; export type CallbackHandlingContext = { readonly callbackBinding: TrackedBinding; readonly codePath: Readonly<Rule.CodePath>; readonly operationsBySegmentId: ReadonlyMap<string, readonly CallbackHandlingOperation[]>; readonly sourceCode: Readonly<Rule.RuleContext['sourceCode']>; }; export declare function clonePathState(state: Readonly<CallbackPathState>): CallbackPathState; export declare function arePathStatesSame(left: Readonly<CallbackPathState> | undefined, right: Readonly<CallbackPathState>): boolean; export declare function updatePathState(sourceCode: Readonly<Rule.RuleContext['sourceCode']>, state: Readonly<CallbackPathState>, operation: Readonly<CallbackHandlingOperation>): CallbackPathState; export declare function getCodeAfterCallbackHandlingNode(sourceCode: Readonly<Rule.RuleContext['sourceCode']>, state: Readonly<CallbackPathState>, operation: Readonly<CallbackHandlingOperation>): Rule.Node | undefined; export declare function createEntryState(context: Readonly<CallbackHandlingContext>, segment: Readonly<Rule.CodePathSegment>, exitStatesBySegmentId: ReadonlyMap<string, Readonly<CallbackPathState>>): CallbackPathState; export {}; //# sourceMappingURL=callback-handling-state.d.ts.map