Skip to content

Commit 18a3597

Browse files
committed
Fixed empty literal detection
Should ignore any literal nodes that are purely whitespace. That way simply splitting a node accross multiple lines doens't get reported. ```javascript <div> {'test'} </div> ```
1 parent d81e03c commit 18a3597

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rules/no-literals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = function(context) {
2222

2323
Literal: function(node) {
2424
if (
25-
/[\S]/.test(node.value) &&
25+
!/^[\s]+$/.test(node.value) &&
2626
node.parent &&
2727
node.parent.type !== 'JSXExpressionContainer'
2828
) {

0 commit comments

Comments
 (0)