--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.js --- # Input ```jsx a = a + 1; a = a - 1; a = a * 1; a = 1 * a; a = a / 1; a = a % 1; a = a << 1; a = a >> 1; a = a >>> 1; a = a & 1; a = 1 & a; a = a ^ 1; a = 1 ^ a; a = a | 1; a = 1 | a; a = a ** 1; this.a = this.a + 1; this.a = this.a + b this.a = this.a + this.b a = (a) + 1; x = (x + y); x[0] = x[0] - y window.a = window.a + 1; ``` # Diagnostics ``` invalid.js:1:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment +=. > 1 │ a = a + 1; │ ^^^^^^^^^ 2 │ a = a - 1; 3 │ a = a * 1; i Unsafe fix: Use += instead. 1 │ - a·=·a·+·1; 1 │ + a·+=·1; 2 2 │ a = a - 1; 3 3 │ a = a * 1; ``` ``` invalid.js:2:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment -=. 1 │ a = a + 1; > 2 │ a = a - 1; │ ^^^^^^^^^ 3 │ a = a * 1; 4 │ a = 1 * a; i Unsafe fix: Use -= instead. 1 1 │ a = a + 1; 2 │ - a·=·a·-·1; 2 │ + a·-=·1; 3 3 │ a = a * 1; 4 4 │ a = 1 * a; ``` ``` invalid.js:3:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment *=. 1 │ a = a + 1; 2 │ a = a - 1; > 3 │ a = a * 1; │ ^^^^^^^^^ 4 │ a = 1 * a; 5 │ a = a / 1; i Unsafe fix: Use *= instead. 1 1 │ a = a + 1; 2 2 │ a = a - 1; 3 │ - a·=·a·*·1; 3 │ + a·*=·1; 4 4 │ a = 1 * a; 5 5 │ a = a / 1; ``` ``` invalid.js:4:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment *=. 2 │ a = a - 1; 3 │ a = a * 1; > 4 │ a = 1 * a; │ ^^^^^^^^^ 5 │ a = a / 1; 6 │ a = a % 1; i Unsafe fix: Use *= instead. 2 2 │ a = a - 1; 3 3 │ a = a * 1; 4 │ - a·=·1·*·a; 4 │ + a·*=·1; 5 5 │ a = a / 1; 6 6 │ a = a % 1; ``` ``` invalid.js:5:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment /=. 3 │ a = a * 1; 4 │ a = 1 * a; > 5 │ a = a / 1; │ ^^^^^^^^^ 6 │ a = a % 1; 7 │ a = a << 1; i Unsafe fix: Use /= instead. 3 3 │ a = a * 1; 4 4 │ a = 1 * a; 5 │ - a·=·a·/·1; 5 │ + a·/=·1; 6 6 │ a = a % 1; 7 7 │ a = a << 1; ``` ``` invalid.js:6:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment %=. 4 │ a = 1 * a; 5 │ a = a / 1; > 6 │ a = a % 1; │ ^^^^^^^^^ 7 │ a = a << 1; 8 │ a = a >> 1; i Unsafe fix: Use %= instead. 4 4 │ a = 1 * a; 5 5 │ a = a / 1; 6 │ - a·=·a·%·1; 6 │ + a·%=·1; 7 7 │ a = a << 1; 8 8 │ a = a >> 1; ``` ``` invalid.js:7:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment <<=. 5 │ a = a / 1; 6 │ a = a % 1; > 7 │ a = a << 1; │ ^^^^^^^^^^ 8 │ a = a >> 1; 9 │ a = a >>> 1; i Unsafe fix: Use <<= instead. 5 5 │ a = a / 1; 6 6 │ a = a % 1; 7 │ - a·=·a·<<·1; 7 │ + a·<<=·1; 8 8 │ a = a >> 1; 9 9 │ a = a >>> 1; ``` ``` invalid.js:8:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment >>=. 6 │ a = a % 1; 7 │ a = a << 1; > 8 │ a = a >> 1; │ ^^^^^^^^^^ 9 │ a = a >>> 1; 10 │ a = a & 1; i Unsafe fix: Use >>= instead. 6 6 │ a = a % 1; 7 7 │ a = a << 1; 8 │ - a·=·a·>>·1; 8 │ + a·>>=·1; 9 9 │ a = a >>> 1; 10 10 │ a = a & 1; ``` ``` invalid.js:9:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment >>>=. 7 │ a = a << 1; 8 │ a = a >> 1; > 9 │ a = a >>> 1; │ ^^^^^^^^^^^ 10 │ a = a & 1; 11 │ a = 1 & a; i Unsafe fix: Use >>>= instead. 7 7 │ a = a << 1; 8 8 │ a = a >> 1; 9 │ - a·=·a·>>>·1; 9 │ + a·>>>=·1; 10 10 │ a = a & 1; 11 11 │ a = 1 & a; ``` ``` invalid.js:10:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment &=. 8 │ a = a >> 1; 9 │ a = a >>> 1; > 10 │ a = a & 1; │ ^^^^^^^^^ 11 │ a = 1 & a; 12 │ a = a ^ 1; i Unsafe fix: Use &= instead. 8 8 │ a = a >> 1; 9 9 │ a = a >>> 1; 10 │ - a·=·a·&·1; 10 │ + a·&=·1; 11 11 │ a = 1 & a; 12 12 │ a = a ^ 1; ``` ``` invalid.js:11:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment &=. 9 │ a = a >>> 1; 10 │ a = a & 1; > 11 │ a = 1 & a; │ ^^^^^^^^^ 12 │ a = a ^ 1; 13 │ a = 1 ^ a; i Unsafe fix: Use &= instead. 9 9 │ a = a >>> 1; 10 10 │ a = a & 1; 11 │ - a·=·1·&·a; 11 │ + a·&=·1; 12 12 │ a = a ^ 1; 13 13 │ a = 1 ^ a; ``` ``` invalid.js:12:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment ^=. 10 │ a = a & 1; 11 │ a = 1 & a; > 12 │ a = a ^ 1; │ ^^^^^^^^^ 13 │ a = 1 ^ a; 14 │ a = a | 1; i Unsafe fix: Use ^= instead. 10 10 │ a = a & 1; 11 11 │ a = 1 & a; 12 │ - a·=·a·^·1; 12 │ + a·^=·1; 13 13 │ a = 1 ^ a; 14 14 │ a = a | 1; ``` ``` invalid.js:13:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment ^=. 11 │ a = 1 & a; 12 │ a = a ^ 1; > 13 │ a = 1 ^ a; │ ^^^^^^^^^ 14 │ a = a | 1; 15 │ a = 1 | a; i Unsafe fix: Use ^= instead. 11 11 │ a = 1 & a; 12 12 │ a = a ^ 1; 13 │ - a·=·1·^·a; 13 │ + a·^=·1; 14 14 │ a = a | 1; 15 15 │ a = 1 | a; ``` ``` invalid.js:14:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment |=. 12 │ a = a ^ 1; 13 │ a = 1 ^ a; > 14 │ a = a | 1; │ ^^^^^^^^^ 15 │ a = 1 | a; 16 │ a = a ** 1; i Unsafe fix: Use |= instead. 12 12 │ a = a ^ 1; 13 13 │ a = 1 ^ a; 14 │ - a·=·a·|·1; 14 │ + a·|=·1; 15 15 │ a = 1 | a; 16 16 │ a = a ** 1; ``` ``` invalid.js:15:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment |=. 13 │ a = 1 ^ a; 14 │ a = a | 1; > 15 │ a = 1 | a; │ ^^^^^^^^^ 16 │ a = a ** 1; 17 │ this.a = this.a + 1; i Unsafe fix: Use |= instead. 13 13 │ a = 1 ^ a; 14 14 │ a = a | 1; 15 │ - a·=·1·|·a; 15 │ + a·|=·1; 16 16 │ a = a ** 1; 17 17 │ this.a = this.a + 1; ``` ``` invalid.js:16:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment **=. 14 │ a = a | 1; 15 │ a = 1 | a; > 16 │ a = a ** 1; │ ^^^^^^^^^^ 17 │ this.a = this.a + 1; 18 │ this.a = this.a + b i Unsafe fix: Use **= instead. 14 14 │ a = a | 1; 15 15 │ a = 1 | a; 16 │ - a·=·a·**·1; 16 │ + a·**=·1; 17 17 │ this.a = this.a + 1; 18 18 │ this.a = this.a + b ``` ``` invalid.js:17:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment +=. 15 │ a = 1 | a; 16 │ a = a ** 1; > 17 │ this.a = this.a + 1; │ ^^^^^^^^^^^^^^^^^^^ 18 │ this.a = this.a + b 19 │ this.a = this.a + this.b i Unsafe fix: Use += instead. 15 15 │ a = 1 | a; 16 16 │ a = a ** 1; 17 │ - this.a·=·this.a·+·1; 17 │ + this.a·+=·1; 18 18 │ this.a = this.a + b 19 19 │ this.a = this.a + this.b ``` ``` invalid.js:18:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment +=. 16 │ a = a ** 1; 17 │ this.a = this.a + 1; > 18 │ this.a = this.a + b │ ^^^^^^^^^^^^^^^^^^^ 19 │ this.a = this.a + this.b 20 │ a = (a) + 1; i Unsafe fix: Use += instead. 16 16 │ a = a ** 1; 17 17 │ this.a = this.a + 1; 18 │ - this.a·=·this.a·+·b 18 │ + this.a·+=·b 19 19 │ this.a = this.a + this.b 20 20 │ a = (a) + 1; ``` ``` invalid.js:19:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment +=. 17 │ this.a = this.a + 1; 18 │ this.a = this.a + b > 19 │ this.a = this.a + this.b │ ^^^^^^^^^^^^^^^^^^^^^^^^ 20 │ a = (a) + 1; 21 │ x = (x + y); i Unsafe fix: Use += instead. 17 17 │ this.a = this.a + 1; 18 18 │ this.a = this.a + b 19 │ - this.a·=·this.a·+·this.b 19 │ + this.a·+=·this.b 20 20 │ a = (a) + 1; 21 21 │ x = (x + y); ``` ``` invalid.js:20:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment +=. 18 │ this.a = this.a + b 19 │ this.a = this.a + this.b > 20 │ a = (a) + 1; │ ^^^^^^^^^^^ 21 │ x = (x + y); 22 │ x[0] = x[0] - y i Unsafe fix: Use += instead. 18 18 │ this.a = this.a + b 19 19 │ this.a = this.a + this.b 20 │ - a·=·(a)·+·1; 20 │ + a·+=·1; 21 21 │ x = (x + y); 22 22 │ x[0] = x[0] - y ``` ``` invalid.js:21:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment +=. 19 │ this.a = this.a + this.b 20 │ a = (a) + 1; > 21 │ x = (x + y); │ ^^^^^^^^^^^ 22 │ x[0] = x[0] - y 23 │ window.a = window.a + 1; i Unsafe fix: Use += instead. 19 19 │ this.a = this.a + this.b 20 20 │ a = (a) + 1; 21 │ - x·=·(x·+·y); 21 │ + x·+=·y; 22 22 │ x[0] = x[0] - y 23 23 │ window.a = window.a + 1; ``` ``` invalid.js:22:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment -=. 20 │ a = (a) + 1; 21 │ x = (x + y); > 22 │ x[0] = x[0] - y │ ^^^^^^^^^^^^^^^ 23 │ window.a = window.a + 1; 24 │ i Unsafe fix: Use -= instead. 20 20 │ a = (a) + 1; 21 21 │ x = (x + y); 22 │ - x[0]·=·x[0]·-·y 22 │ + x[0]·-=·y 23 23 │ window.a = window.a + 1; 24 24 │ ``` ``` invalid.js:23:1 lint/style/useShorthandAssign FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Assignment (=) can be replaced with operator assignment +=. 21 │ x = (x + y); 22 │ x[0] = x[0] - y > 23 │ window.a = window.a + 1; │ ^^^^^^^^^^^^^^^^^^^^^^^ 24 │ i Unsafe fix: Use += instead. 21 21 │ x = (x + y); 22 22 │ x[0] = x[0] - y 23 │ - window.a·=·window.a·+·1; 23 │ + window.a·+=·1; 24 24 │ ```