eslint-plugin-perfectionist
Version:
ESLint plugin for sorting various data such as objects, imports, types, enums, JSX props, etc.
30 lines (29 loc) • 1.03 kB
TypeScript
import { RuleContext } from '@typescript-eslint/utils/ts-eslint'
import { TSESLint } from '@typescript-eslint/utils'
import { TSESTree } from '@typescript-eslint/types'
import { Options } from './types.js'
/**
* Computes the matched context options for a given variable declaration node.
*
* @param params - Parameters.
* @param params.node - The variable declaration node to compute the context
* options for.
* @param params.matchedAstSelectors - The matched AST selectors for an object
* node.
* @param params.sourceCode - The ESLint source code object.
* @param params.context - The rule context.
* @returns The matched context options or undefined if none match.
*/
export declare function computeMatchedContextOptions<
MessageIds extends string,
>({
matchedAstSelectors,
sourceCode,
context,
node,
}: {
context: Readonly<RuleContext<MessageIds, Options>>
matchedAstSelectors: ReadonlySet<string>
node: TSESTree.VariableDeclaration
sourceCode: TSESLint.SourceCode
}): Options[number] | undefined