import { Rule, Scope } from "eslint"; import { Expression, JSXAttribute, JSXElement, JSXEmptyExpression, JSXFragment, JSXOpeningElement, MemberExpression, Property, SpreadElement } from "estree-jsx"; export declare function getAttribute(node: JSXElement | JSXOpeningElement, attributeName: string): JSXAttribute; export declare function getAnyAttribute(node: JSXElement | JSXOpeningElement, attributeNames: string[]): any; /** * Attribute value and its type */ type Attribute = { type: "string"; value: string; } | { type: "Literal"; value: string | number | bigint | boolean | RegExp | null | undefined; } | { type: "MemberExpression"; value: MemberExpression; } | { type: "ObjectExpression"; value: (Property | SpreadElement)[]; } | { type: "undefined"; value: undefined; }; /** * Helper to get the raw value from a JSXAttribute value. If the JSXAttribute value is an Identifier, it tries to get the value of that variable. If the JSXAttribute value is a JSXExpressionContainer: {"value"}, it returns the inner content. * MemberExpressions and ObjectExpressions are not parsed further. * @param context Rule context * @param node JSXAttribute value * @returns Attribute in this form: { type: [specific type of the returned value], value: [actual value]}. Literal types are further processed, if their value is of type "string", type: "string" is returned, otherwise type: "Literal" */ export declare function getAttributeValue(context: Rule.RuleContext, node?: JSXAttribute["value"]): Attribute; export declare function getExpression(node?: JSXAttribute["value"]): JSXFragment | Expression | JSXEmptyExpression; export declare function getVariableDeclaration(name: string, scope: Scope.Scope | null): Scope.Variable; export declare function getVariableInit(variableDeclaration: Scope.Variable | undefined): Expression; /** * Helper to get the raw value of a variable, given by its name. Returns an Attribute object, similarly to getAttributeValue helper. * @param name Variable name * @param scope Scope where to look for the variable declaration * @param context Rule context * @returns Attribute in this form: { type: [specific type of the returned value], value: [actual value]}. Literal types are further processed, if their value is of type "string", type: "string" is returned, otherwise type: "Literal" */ export declare function getVariableValue(name: string, scope: Scope.Scope | null, context: Rule.RuleContext): Attribute; export {}; //# sourceMappingURL=JSXAttributes.d.ts.map