Skip to content

Commit

Permalink
fix(removecalls): remove unsafe optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Dec 23, 2019
1 parent 3e92ddb commit b0deb61
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/visitors/removeUnnecessaryCalls.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ const transforms = [
isSafeConditionalExpression(arg.right.right)))
) {
return t.conditionalExpression(arg.left, arg.right, t.stringLiteral(''));
} else if (t.isLogicalExpression(arg, { operator: '||' }) && isStringLike(arg.right)) {
// Assume that arg.left returns a string value
return arg;
}
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const foo = 'test';

const x = clsx(foo && 'bar');
const y = clsx(foo || 'bar');
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
const foo = 'test';
const x = foo ? 'bar' : '';
const y = foo || 'bar';

0 comments on commit b0deb61

Please sign in to comment.