Skip to content

Commit edd8812

Browse files
V2dhaljharb
andauthored
Update lib/rules/jsx-no-target-blank.js
Co-authored-by: Jordan Harband <[email protected]>
1 parent 97e8800 commit edd8812

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/rules/jsx-no-target-blank.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ function hasSecureRel(node, allowReferrer, warnOnSpreadAttributes, spreadAttribu
111111
const relAttribute = node.attributes[relIndex];
112112
const value = getStringFromValue(relAttribute.value);
113113
if (Array.isArray(value)) {
114-
for (let index = 0; index < value.length; index++) {
115-
const tags = value[index] && typeof value[index] === 'string' && value[index].toLowerCase().split(' ');
114+
return [].concat(value).filter(Boolean).some((item) => {
115+
const tags = typeof item === 'string' && item.toLowerCase().split(' ');
116116
const noreferrer = tags && tags.indexOf('noreferrer') >= 0;
117117
const noopener = tags && tags.indexOf('noopener') >= 0;
118118
if (!noreferrer) {
119119
return allowReferrer && noopener;
120120
}
121-
}
122-
return true;
121+
return false;
122+
});
123123
}
124124
const tags = value && typeof value === 'string' && value.toLowerCase().split(' ');
125125
const noreferrer = tags && tags.indexOf('noreferrer') >= 0;

0 commit comments

Comments
 (0)