--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.jsonc --- # Input ```cjs const boolExp = true; ``` # Input ```cjs const r = true && boolExp; ``` # Diagnostics ``` invalid.jsonc:1:11 lint/complexity/useSimplifiedLogicExpression FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Logical expression contains unnecessary complexity. > 1 │ const r = true && boolExp; │ ^^^^^^^^^^^^^^^ i Unsafe fix: Discard redundant terms from the logical expression. 1 │ const·r·=·true·&&·boolExp; │ -------- ``` # Input ```cjs const boolExp2 = true; ``` # Input ```cjs const r2 = boolExp || true; ``` # Diagnostics ``` invalid.jsonc:1:12 lint/complexity/useSimplifiedLogicExpression FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Logical expression contains unnecessary complexity. > 1 │ const r2 = boolExp || true; │ ^^^^^^^^^^^^^^^ i Unsafe fix: Discard redundant terms from the logical expression. 1 │ const·r2·=·boolExp·||·true; │ ----------- ``` # Input ```cjs const nonNullExp = 123; ``` # Input ```cjs const r3 = null ?? nonNullExp; ``` # Diagnostics ``` invalid.jsonc:1:12 lint/complexity/useSimplifiedLogicExpression FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Logical expression contains unnecessary complexity. > 1 │ const r3 = null ?? nonNullExp; │ ^^^^^^^^^^^^^^^^^^ i Unsafe fix: Discard redundant terms from the logical expression. 1 │ const·r3·=·null·??·nonNullExp; │ -------- ``` # Input ```cjs const boolExpr1 = true; ``` # Input ```cjs const boolExpr2 = false; ``` # Input ```cjs const r4 = !boolExpr1 || !boolExpr2; ``` # Diagnostics ``` invalid.jsonc:1:12 lint/complexity/useSimplifiedLogicExpression FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Logical expression contains unnecessary complexity. > 1 │ const r4 = !boolExpr1 || !boolExpr2; │ ^^^^^^^^^^^^^^^^^^^^^^^^ i Unsafe fix: Reduce the complexity of the logical expression. - const·r4·=·!boolExpr1·||·!boolExpr2; + const·r4·=·!(boolExpr1·&&·boolExpr2); ```