--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: valid.jsonc --- # Input ```cjs if (a); ``` # Input ```cjs if (a == 0); ``` # Input ```cjs if (a = f()); ``` # Input ```cjs if (a += 1); ``` # Input ```cjs if (a |= 1); ``` # Input ```cjs if (a |= true); ``` # Input ```cjs if (a |= false); ``` # Input ```cjs if (a &= 1); ``` # Input ```cjs if (a &= true); ``` # Input ```cjs if (a &= false); ``` # Input ```cjs if (a >>= 1); ``` # Input ```cjs if (a >>= true); ``` # Input ```cjs if (a >>= false); ``` # Input ```cjs if (a >>>= 1); ``` # Input ```cjs if (a ??= 1); ``` # Input ```cjs if (a ??= true); ``` # Input ```cjs if (a ??= false); ``` # Input ```cjs if (a ||= b); ``` # Input ```cjs if (a ||= false); ``` # Input ```cjs if (a ||= 0); ``` # Input ```cjs if (a ||= void 0); ``` # Input ```cjs if (+(a ||= 1)); ``` # Input ```cjs if (f(a ||= true)); ``` # Input ```cjs if ((a ||= 1) + 2); ``` # Input ```cjs if (1 + (a ||= true)); ``` # Input ```cjs if (a ||= '' || false); ``` # Input ```cjs if (a ||= void 0 || null); ``` # Input ```cjs if ((a ||= false) || b); ``` # Input ```cjs if (a || (b ||= false)); ``` # Input ```cjs if ((a ||= true) && b); ``` # Input ```cjs if (a && (b ||= true)); ``` # Input ```cjs if (a &&= b); ``` # Input ```cjs if (a &&= true); ``` # Input ```cjs if (a &&= 1); ``` # Input ```cjs if (a &&= 'foo'); ``` # Input ```cjs if ((a &&= '') + false); ``` # Input ```cjs if ('' + (a &&= null)); ``` # Input ```cjs if (a &&= 1 && 2); ``` # Input ```cjs if ((a &&= true) && b); ``` # Input ```cjs if (a && (b &&= true)); ``` # Input ```cjs if ((a &&= false) || b); ``` # Input ```cjs if (a || (b &&= false)); ``` # Input ```cjs if (a ||= b ||= false); ``` # Input ```cjs if (a &&= b &&= true); ``` # Input ```cjs if (a ||= b &&= false); ``` # Input ```cjs if (a ||= b &&= true); ``` # Input ```cjs if (a &&= b ||= false); ``` # Input ```cjs if (a &&= b ||= true); ``` # Input ```cjs if (1, a); ``` # Input ```cjs if ('every' in []); ``` # Input ```cjs // Ignore for now, not sure why ESLint detect this as valid ``` # Input ```cjs // if (`\ ${a}`) { } ``` # Input ```cjs if (`${a}`); ``` # Input ```cjs if (`${foo()}`); ``` # Input ```cjs if (`${a === 'b' && b === 'a'}`); ``` # Input ```cjs if (`foo${a}` === 'fooa'); ``` # Input ```cjs if (tag`a`); ``` # Input ```cjs if (tag`${a}`); ``` # Input ```cjs if (+(a || true)); ``` # Input ```cjs if (-(a || true)); ``` # Input ```cjs if (~(a || 1)); ``` # Input ```cjs if (+(a && 0) === +(b && 0)); ``` # Input ```cjs while (~!a); ``` # Input ```cjs while (a = b); ``` # Input ```cjs while (`${a}`); ``` # Input ```cjs for (; x < 10;); ``` # Input ```cjs for (; ;); ``` # Input ```cjs for (; `${a}`;); ``` # Input ```cjs do { } while (x) ``` # Input ```cjs q > 0 ? 1 : 2; ``` # Input ```cjs `${a}` === a ? 1 : 2; ``` # Input ```cjs `foo${a}` === a ? 1 : 2; ``` # Input ```cjs tag`a` === a ? 1 : 2; ``` # Input ```cjs tag`${a}` === a ? 1 : 2; ``` # Input ```cjs while (x += 3) { }; ``` # Input ```cjs while (tag`a`) { }; ``` # Input ```cjs while (tag`${a}`) { }; ``` # Input ```cjs // while (`\ ${a}`) { } ``` # Input ```cjs if (typeof x === 'undefined') { }; ``` # Input ```cjs if (`${typeof x}` === 'undefined') { }; ``` # Input ```cjs if (a === 'str' && typeof b) { }; ``` # Input ```cjs typeof a == typeof b; ``` # Input ```cjs typeof 'a' === 'string' || typeof b === 'string'; ``` # Input ```cjs `${typeof 'a'}` === 'string' || `${typeof b}` === 'string'; ``` # Input ```cjs if (void a || a); ``` # Input ```cjs if (a || void a); ``` # Input ```cjs if (xyz === 'str1' && abc === 'str2') { } ``` # Input ```cjs if (xyz === 'str1' || abc === 'str2') { } ``` # Input ```cjs if (xyz === 'str1' || abc === 'str2' && pqr === 5) { } ``` # Input ```cjs if (typeof abc === 'string' && abc === 'str2') { } ``` # Input ```cjs if (false || abc === 'str') { } ``` # Input ```cjs if (true && abc === 'str') { } ``` # Input ```cjs if (typeof 'str' && abc === 'str') { } ``` # Input ```cjs if (abc === 'str' || false || def === 'str') { } ``` # Input ```cjs if (true && abc === 'str' || def === 'str') { } ``` # Input ```cjs if (true && typeof abc === 'string') { } ``` # Input ```cjs if ('str1' && a) { } ``` # Input ```cjs if (a && 'str') { } ``` # Input ```cjs if ((foo || true) === 'baz') { } ``` # Input ```cjs if ((foo || 'bar') === 'baz') { } ``` # Input ```cjs if ((foo || 'bar') !== 'baz') { } ``` # Input ```cjs if ((foo || 'bar') == 'baz') { } ``` # Input ```cjs if ((foo || 'bar') != 'baz') { } ``` # Input ```cjs if ((foo || 233) > 666) { } ``` # Input ```cjs if ((foo || 233) < 666) { } ``` # Input ```cjs if ((foo || 233) >= 666) { } ``` # Input ```cjs if ((foo || 233) <= 666) { } ``` # Input ```cjs if ((key || 'k') in obj) { } ``` # Input ```cjs if ((foo || {}) instanceof obj) { } ``` # Input ```cjs if ((foo || 'bar' || 'bar') === 'bar'); ``` # Input ```cjs if ((foo || 1n) === 'baz') { } ``` # Input ```cjs if (a && 0n || b); ``` # Input ```cjs if (1n && a) { }; ``` # Input ```cjs if ('' + [y] === '' + [ty]) { } ``` # Input ```cjs if ('a' === '' + [ty]) { } ``` # Input ```cjs if ('' + [y, m, d] === 'a') { } ``` # Input ```cjs if ('' + [y, 'm'] === '' + [ty, 'tm']) { } ``` # Input ```cjs if ('' + [y, 'm'] === '' + ['ty']) { } ``` # Input ```cjs if ([,] in ($2)); else; ``` # Input ```cjs if ([...x] + '' === 'y') { } ``` # Input ```cjs function* foo() { while (true) { yield 'foo'; } } ``` # Input ```cjs function* foo() { for (; true;) { yield 'foo'; } } ``` # Input ```cjs function* foo() { do { yield 'foo'; } while (true) } ``` # Input ```cjs function* foo() { while (true) { while (true) { yield; } } } ``` # Input ```cjs function* foo() { for (; yield;) { } } ``` # Input ```cjs function* foo() { for (; ; yield) { } } ``` # Input ```cjs function* foo() { while (true) { function* foo() { yield; } yield; } } ``` # Input ```cjs function* foo() { for (let x = yield; x < 10; x++) { yield; } yield; } ``` # Input ```cjs function* foo() { for (let x = yield; ; x++) { yield; } } ``` # Input ```cjs if (new Number(x) + 1 === 2) { } ``` # Input ```cjs if ([a] == [b]) { } ``` # Input ```cjs if (+[...a]) { } ``` # Input ```cjs if (+[...[...a]]) { } ``` # Input ```cjs if (`${[...a]}`) { } ``` # Input ```cjs if (`${[a]}`) { } ``` # Input ```cjs if (+[a]) { } ``` # Input ```cjs if (0 - [a]) { } ``` # Input ```cjs if (1 * [a]) { } ``` # Input ```cjs if (Boolean(a)) { } ``` # Input ```cjs if (Boolean(...args)) { } ``` # Input ```cjs if (foo.Boolean(1)) { } ``` # Input ```cjs function foo(Boolean) { if (Boolean(12)) { } } ``` # Input ```cjs const Boolean = () => { }; if (Boolean(1)) { } ``` # Input ```cjs const undefined = 'lol'; if (undefined) { } ``` # Input ```cjs while (true); ``` # Input ```cjs function foo(Boolean) { while (true); } ```