Skip to content

Commit

Permalink
Find usages of literals as a part of BinaryExpressions in jsx-no-lite…
Browse files Browse the repository at this point in the history
…rals
  • Loading branch information
jaaberg committed Dec 17, 2017
1 parent 4cf6752 commit 2ae8d5e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/rules/jsx-no-literals.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ module.exports = {
}

function getValidation(node) {
let current = node;
while (current.parent.type === 'BinaryExpression') {
current = current.parent;
}
const standard = !/^[\s]+$/.test(node.value) &&
typeof node.value === 'string' &&
node.parent &&
node.parent.type.indexOf('JSX') !== -1 &&
node.parent.type !== 'JSXAttribute';
current.parent &&
current.parent.type.indexOf('JSX') !== -1 &&
current.parent.type !== 'JSXAttribute';
if (isNoStrings) {
return standard;
}
Expand Down

0 comments on commit 2ae8d5e

Please sign in to comment.