Skip to content

Commit 14f8435

Browse files
authored
Avoid crashing on valueless boolean props
b8217ed removed the node.value check leading to this crashing on any valueless boolean prop such as <Component isWhatever /> This just readds the check.
1 parent 1df23d2 commit 14f8435

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rules/jsx-no-literals.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,9 @@ module.exports = {
503503
},
504504

505505
JSXAttribute(node) {
506-
const isLiteralString = node.value.type === 'Literal'
506+
const isLiteralString = node.value && node.value.type === 'Literal'
507507
&& typeof node.value.value === 'string';
508-
const isStringLiteral = node.value.type === 'StringLiteral';
508+
const isStringLiteral = node.value && node.value.type === 'StringLiteral';
509509

510510
if (isLiteralString || isStringLiteral) {
511511
const resolvedConfig = getOverrideConfig(node) || config;

0 commit comments

Comments
 (0)