vue-a11y/eslint-plugin-vuejs-accessibility

TypeError: value.replace is not a function for conditional elements

Closed this issue · 3 comments

The makeKebabCase function explodes due to the result of getElementType when dealing with <component :is="foo ? 'a' : 'div'"></component> because the value of is is not a string.

TypeError: value.replace is not a function
Occurred while linting /Users/gavynmckenzie/dev/bbm/patterns/src/components/atoms/PromoSticker/MPromoSticker.vue:24
    at makeKebabCase (/Users/gavynmckenzie/dev/bbm/patterns/node_modules/eslint-plugin-vuejs-accessibility/src/utils/makeKebabCase.js:3:6)
    at getElementType (/Users/gavynmckenzie/dev/bbm/patterns/node_modules/eslint-plugin-vuejs-accessibility/src/utils/getElementType.js:6:10)
    at EventEmitter.VElement (/Users/gavynmckenzie/dev/bbm/patterns/node_modules/eslint-plugin-vuejs-accessibility/src/rules/alt-text.js:108:27)
    at EventEmitter.emit (events.js:203:15)
    at NodeEventGenerator.applySelector (/Users/gavynmckenzie/dev/bbm/patterns/node_modules/eslint-plugin-vuejs-accessibility/node_modules/vue-eslint-parser/index.js:3309:26)
    at NodeEventGenerator.applySelectors (/Users/gavynmckenzie/dev/bbm/patterns/node_modules/eslint-plugin-vuejs-accessibility/node_modules/vue-eslint-parser/index.js:3323:22)
    at NodeEventGenerator.enterNode (/Users/gavynmckenzie/dev/bbm/patterns/node_modules/eslint-plugin-vuejs-accessibility/node_modules/vue-eslint-parser/index.js:3331:14)
    at traverse (/Users/gavynmckenzie/dev/bbm/patterns/node_modules/eslint-plugin-vuejs-accessibility/node_modules/vue-eslint-parser/index.js:115:13)
    at traverse (/Users/gavynmckenzie/dev/bbm/patterns/node_modules/eslint-plugin-vuejs-accessibility/node_modules/vue-eslint-parser/index.js:122:21)
    at traverseNodes (/Users/gavynmckenzie/dev/bbm/patterns/node_modules/eslint-plugin-vuejs-accessibility/node_modules/vue-eslint-parser/index.js:133:5)

Interesting! Thanks for reporting. I'll check this out.

This is out as part of v0.5.1

Legendary! I'll give it a spin