@yasanchezz/eslint-plugin-vue-data-testid
Version:
An `eslint` plugin for checking accessibility rules from within `.vue` files. Add `data-testid` to use better behavior testing
11 lines (10 loc) • 415 B
JavaScript
export default function getAttributeNames(node) {
const attributeNames = node.startTag.attributes
.map(attribute => attribute.key.type === 'VDirectiveKey'
? attribute.key.argument?.type === 'VIdentifier'
? attribute.key.argument.name
: undefined
: attribute.key.name)
.filter(attributeName => attributeName != null);
return new Set(attributeNames);
}