Skip to content

Commit 18f4ddd

Browse files
committed
feature: @putout/plugin-logical-expressions: simplify: JSXContainerExpression: exclude
1 parent bbc8d43 commit 18f4ddd

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

packages/plugin-logical-expressions/lib/simplify/fixture/jsx.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ const jsx = (
22
<div>{Boolean(info) && <Alert severity="info">{convertToString(info)}</Alert>}
33
</div>
44
);
5+
6+
const jsx2 = (
7+
<button disabled={Boolean(error) || disabled}>
8+
</button>
9+
);

packages/plugin-logical-expressions/lib/simplify/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const {isSimple, replaceWith} = operator;
55
export const report = () => 'Simplify logical expression';
66

77
export const match = () => ({
8+
'Boolean(__a) || __b': (vars, path) => !path.parentPath.isJSXExpressionContainer(),
89
'__a(__args) && __b': ({__a, __b}, path) => {
910
if (path.parentPath.isJSXExpressionContainer())
1011
return false;

0 commit comments

Comments
 (0)