From edd8812c9a928e855c8deddf7cc4e2eab4e74447 Mon Sep 17 00:00:00 2001 From: Vividha Date: Fri, 22 Jul 2022 13:24:07 +0530 Subject: [PATCH] Update lib/rules/jsx-no-target-blank.js Co-authored-by: Jordan Harband --- lib/rules/jsx-no-target-blank.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rules/jsx-no-target-blank.js b/lib/rules/jsx-no-target-blank.js index 851473a814..b25edd872f 100644 --- a/lib/rules/jsx-no-target-blank.js +++ b/lib/rules/jsx-no-target-blank.js @@ -111,15 +111,15 @@ function hasSecureRel(node, allowReferrer, warnOnSpreadAttributes, spreadAttribu const relAttribute = node.attributes[relIndex]; const value = getStringFromValue(relAttribute.value); if (Array.isArray(value)) { - for (let index = 0; index < value.length; index++) { - const tags = value[index] && typeof value[index] === 'string' && value[index].toLowerCase().split(' '); + return [].concat(value).filter(Boolean).some((item) => { + const tags = typeof item === 'string' && item.toLowerCase().split(' '); const noreferrer = tags && tags.indexOf('noreferrer') >= 0; const noopener = tags && tags.indexOf('noopener') >= 0; if (!noreferrer) { return allowReferrer && noopener; } - } - return true; + return false; + }); } const tags = value && typeof value === 'string' && value.toLowerCase().split(' '); const noreferrer = tags && tags.indexOf('noreferrer') >= 0;