@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
24 lines (23 loc) • 1.55 kB
TypeScript
import type { Rule } from 'eslint';
import { type JSXAttribute, type JSXElement, type JSXFragment, type JSXSpreadAttribute } from 'eslint-codemod-utils';
export declare const JSXElementHelper: {
/**
* Names of JSXElements can be any of:
* `<Component></Component>` - (JSXIdentifier)
* `<MyComponents.Component></MyComponents.Component>` - `MyComponents` is a namespace (JSXNamespacedName)
* `<MyComponents.Component></MyComponents.Component>` - `MyComponents` is an object (JSXMemberExpression)
*
* getting the name of a JSXMemberExpression is difficult, because object can contain objects, which is recursively defined in the AST.
* e.g. Getting the name of `<MyComponents.PresentationLayer.LeftSideBar.Header />` would require `getName` to recursively resolve all parts of the name.
* `getName` does not currently have this functionality. Add it if you need it.
*/
getName(node: JSXElement): string;
updateName(node: JSXElement, newName: string, fixer: Rule.RuleFixer): Rule.Fix[];
isSelfClosing(node: JSXElement): boolean;
getAttributes(node: JSXElement): (JSXAttribute | JSXSpreadAttribute)[];
getAttributeByName(node: JSXElement, name: string): JSXAttribute | undefined;
containsSpreadAttributes(node: JSXElement): boolean;
addAttribute(node: JSXElement, name: string, value: string, fixer: Rule.RuleFixer): Rule.Fix;
getChildren(node: JSXElement | JSXFragment): JSXElement['children'];
hasAllowedAttrsOnly(node: JSXElement, allowedProps: string[]): boolean;
};