UNPKG

@jsxtools/eslint-plugin-jsx-a11y

Version:

Static AST checker for accessibility rules on JSX elements for flat ESLint Config.

16 lines (13 loc) 571 B
import { roles, dom } from 'aria-query'; import { f as filter, i as iterFrom } from '../index-d79WKvnw.js'; import { getLiteralPropValue, getProp } from './module/jsx-ast-utils.js'; const abstractRoles = new Set(filter(iterFrom(roles.keys()), (role) => roles.get(role).abstract)); const DOMElements = new Set(dom.keys()); const isAbstractRole = (tagName, attributes) => { if (!DOMElements.has(tagName)) { return false; } const role = getLiteralPropValue(getProp(attributes, "role")); return abstractRoles.has(role); }; export { isAbstractRole as default };