fix: don't apply DeMorgan if double negation
MODIFY
internal/compiler/lint/rules/js/useSimplifiedLogicalExpression.test.rjson
internal/compiler/lint/rules/js/useSimplifiedLogicalExpression.test.rjson
@@ -24,4 +24,9 @@ valid: [
const boolExpr2 = false;
const r = !(boolExpr1 && boolExpr2);
"
+ "
+ const boolExpr1 = true;
+ const boolExpr2 = false;
+ const r = (!!boolExpr1 || !!boolExpr2);
+ "
]

MODIFY
internal/compiler/lint/rules/js/useSimplifiedLogicalExpression.ts
internal/compiler/lint/rules/js/useSimplifiedLogicalExpression.ts
@@ -100,7 +100,9 @@ function couldApplyDeMorgan(
node.left.type === "JSUnaryExpression" &&
node.right.type === "JSUnaryExpression" &&
node.left.operator === "!" &&
- node.right.operator === "!"
+ node.right.operator === "!" &&
+ node.left.argument.type !== "JSUnaryExpression" &&
+ node.right.argument.type !== "JSUnaryExpression"
);
}

MODIFY
internal/compiler/lint/rules/react/noDangerWithChildren.ts
internal/compiler/lint/rules/react/noDangerWithChildren.ts
@@ -45,8 +45,8 @@ function jsxDangerWithPropChildren(node: AnyNode) {
function createElementDangerWithChildren(node: AnyNode, scope: Scope): boolean {
return (
- getCreateElementChildren(node, scope) &&
- getCreateElementProp(node, scope, "dangerouslySetInnerHTML")
+ !!getCreateElementChildren(node, scope) &&
+ !!getCreateElementProp(node, scope, "dangerouslySetInnerHTML")
);
}

fix: don't apply DeMorgan if double negation