@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
10 lines (9 loc) • 354 B
JavaScript
export default function calculateAttributeNames(attributeName) {
const set = new Set([attributeName]);
set.add(attributeName
.replace(/[A-Z]g/, input => '-' + input.toLowerCase())
.replace(/^-|-$/g, ''));
set.add(attributeName
.replace(/-([a-z])/g, (_input, symbol) => symbol?.toUpperCase() ?? ''));
return set;
}