{"action":"created","issue":{"url":"https://api.github.com/repos/evcohen/eslint-plugin-jsx-a11y/issues/53","repository_url":"https://api.github.com/repos/evcohen/eslint-plugin-jsx-a11y","labels_url":"https://api.github.com/repos/evcohen/eslint-plugin-jsx-a11y/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/evcohen/eslint-plugin-jsx-a11y/issues/53/comments","events_url":"https://api.github.com/repos/evcohen/eslint-plugin-jsx-a11y/issues/53/events","html_url":"https://github.com/evcohen/eslint-plugin-jsx-a11y/pull/53","id":158530314,"number":53,"title":"[fix] Linter threw JS error when role is undefined","user":{"login":"christianvuerings","id":127199,"avatar_url":"https://avatars.githubusercontent.com/u/127199?v=3","gravatar_id":"","url":"https://api.github.com/users/christianvuerings","html_url":"https://github.com/christianvuerings","followers_url":"https://api.github.com/users/christianvuerings/followers","following_url":"https://api.github.com/users/christianvuerings/following{/other_user}","gists_url":"https://api.github.com/users/christianvuerings/gists{/gist_id}","starred_url":"https://api.github.com/users/christianvuerings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianvuerings/subscriptions","organizations_url":"https://api.github.com/users/christianvuerings/orgs","repos_url":"https://api.github.com/users/christianvuerings/repos","events_url":"https://api.github.com/users/christianvuerings/events{/privacy}","received_events_url":"https://api.github.com/users/christianvuerings/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-05T00:04:02Z","updated_at":"2016-06-05T00:55:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/evcohen/eslint-plugin-jsx-a11y/pulls/53","html_url":"https://github.com/evcohen/eslint-plugin-jsx-a11y/pull/53","diff_url":"https://github.com/evcohen/eslint-plugin-jsx-a11y/pull/53.diff","patch_url":"https://github.com/evcohen/eslint-plugin-jsx-a11y/pull/53.patch"},"body":"*To reproduce*\r\n\r\n- Add `<img role />` to your JSX code\r\n- Run the linter\r\n\r\n*Result*\r\n\r\nA JS error in the output\r\n\r\n```\r\n  1) img-has-alt invalid <img role />:\r\n     TypeError: roleValue.toLowerCase is not a function\r\n      at EventEmitter.JSXOpeningElement (img-has-alt.js:5:1)\r\n      at NodeEventGenerator.enterNode (node_modules/eslint/lib/util/node-event-generator.js:40:22)\r\n      at CodePathAnalyzer.enterNode (node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:607:23)\r\n      at CommentEventGenerator.enterNode (node_modules/eslint/lib/util/comment-event-generator.js:97:23)\r\n      at Controller.traverser.traverse.enter (node_modules/eslint/lib/eslint.js:905:36)\r\n      at Controller.__execute (node_modules/estraverse/estraverse.js:397:31)\r\n      at Controller.traverse (node_modules/estraverse/estraverse.js:501:28)\r\n      at Controller.Traverser.controller.traverse (node_modules/eslint/lib/util/traverser.js:36:33)\r\n      at EventEmitter.module.exports.api.verify (node_modules/eslint/lib/eslint.js:902:23)\r\n      at runRuleForItem (node_modules/eslint/lib/testers/rule-tester.js:324:38)\r\n      at testInvalidTemplate (node_modules/eslint/lib/testers/rule-tester.js:378:26)\r\n      at Context.<anonymous> (node_modules/eslint/lib/testers/rule-tester.js:455:25)\r\n```\r\n\r\n*Expected*\r\n\r\nA linter error in the output"},"comment":{"url":"https://api.github.com/repos/evcohen/eslint-plugin-jsx-a11y/issues/comments/223786747","html_url":"https://github.com/evcohen/eslint-plugin-jsx-a11y/pull/53#issuecomment-223786747","issue_url":"https://api.github.com/repos/evcohen/eslint-plugin-jsx-a11y/issues/53","id":223786747,"user":{"login":"ljharb","id":45469,"avatar_url":"https://avatars.githubusercontent.com/u/45469?v=3","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"created_at":"2016-06-05T00:55:45Z","updated_at":"2016-06-05T00:55:45Z","body":"It seems like it's assuming the value will always be a string, when in this case it's `true` - I think the fix is simply adding `typeof roleValue === 'string'` into https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/src/rules/img-has-alt.js#L27"}}
{"actor":{"display_login":"ljharb"}}