Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

react-a11y-image-button-has-alt fails if type is an expression #476

Closed
mfedderly opened this issue Jul 30, 2018 · 1 comment
Closed

react-a11y-image-button-has-alt fails if type is an expression #476

mfedderly opened this issue Jul 30, 2018 · 1 comment
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Bug
Milestone

Comments

@mfedderly
Copy link
Contributor

react-a11y-image-button-has-alt rule fails on inputs like this:

const type = "text";
return <input type={type} />;

Stack trace:

TypeError: Cannot read property 'toLowerCase' of undefined
    at ReactA11yImageButtonHasAltWalker.validateOpeningElement (/code/node_modules/tslint-microsoft-contrib/reactA11yImageButtonHasAltRule.js:68:77)
    at ReactA11yImageButtonHasAltWalker.visitJsxSelfClosingElement (/code/node_modules/tslint-microsoft-contrib/reactA11yImageButtonHasAltRule.js:57:14)
    at ReactA11yImageButtonHasAltWalker.SyntaxWalker.visitNode (/code/node_modules/tslint/lib/language/walker/syntaxWalker.js:413:22)
    at /code/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNode (/code/node_modules/typescript/lib/typescript.js:14800:24)
    at Object.forEachChild (/code/node_modules/typescript/lib/typescript.js:15073:24)
    at ReactA11yImageButtonHasAltWalker.SyntaxWalker.walkChildren (/code/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:12)
    at ReactA11yImageButtonHasAltWalker.SyntaxWalker.visitReturnStatement (/code/node_modules/tslint/lib/language/walker/syntaxWalker.js:222:14)
    at ReactA11yImageButtonHasAltWalker.SyntaxWalker.visitNode (/code/node_modules/tslint/lib/language/walker/syntaxWalker.js:476:22)
    at /code/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
@JoshuaKGoldberg JoshuaKGoldberg added Type: Bug Status: Accepting PRs Good First Issue 🙌 Howdy, neighbor! Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. labels Jul 30, 2018
@JoshuaKGoldberg
Copy link

Glad this is fixed, thanks!

We should note that #461 would have caught this.

@JoshuaKGoldberg JoshuaKGoldberg added this to the 5.1.1 milestone Aug 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants