diff --git a/lib/rules/jsx-no-target-blank.js b/lib/rules/jsx-no-target-blank.js index 8f1d783949..6aec5d32b0 100644 --- a/lib/rules/jsx-no-target-blank.js +++ b/lib/rules/jsx-no-target-blank.js @@ -15,7 +15,7 @@ module.exports = function(context) { var relFound = false; var attrs = node.parent.attributes; for (var idx in attrs) { - if (attrs[idx].name.name === 'rel') { + if (attrs[idx].name && attrs[idx].name.name === 'rel') { var tags = attrs[idx].value.value.split(' '); if (tags.indexOf('noopener') >= 0 && tags.indexOf('noreferrer') >= 0) { relFound = true; diff --git a/tests/lib/rules/jsx-no-target-blank.js b/tests/lib/rules/jsx-no-target-blank.js index 2b624e29ab..48297eb211 100644 --- a/tests/lib/rules/jsx-no-target-blank.js +++ b/tests/lib/rules/jsx-no-target-blank.js @@ -27,7 +27,9 @@ ruleTester.run('jsx-no-target-blank', rule, { valid: [ {code: '', parserOptions: parserOptions}, {code: '', parserOptions: parserOptions}, - {code: '', parserOptions: parserOptions} + {code: '', parserOptions: parserOptions}, + {code: '', parserOptions: parserOptions}, + {code: '', parserOptions: parserOptions} ], invalid: [ {code: '', parserOptions: parserOptions,