1/* 2 * Copyright (c) 2023-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16for (let i = 0, j = 0; i < 10; ++i, j += 2) { 17 console.log(i) 18 console.log(j) 19} 20 21let x = 0 22 23// Error, no autofix 24x = (++x, x++) 25 26// No error 27for (let i = 0, j = 0; i < 10; ++i, j += 2) { 28 console.log(i) 29 console.log(j) 30} 31 32let x2 = 0 33++x2 34x2 = x2++ 35 36let c = () => 33; 37 38// Error, no autofix 39const a = (1, b = 2, c()); 40 41// Error, no autofix 42const r = (c(), b, 1) 43 44class Test { 45 // Error, no autofix 46 static readonly sr = (1, c(), 2); 47 48 // Error, no autofix 49 field1 = (1, 2, c()); 50 51 method() { 52 // Error, no autofix 53 this.field1 = (c(), sr, 1); 54 } 55} 56 57// Error, autofix 58x++; 59 x--; 60 61// Error, autofix 62x++; 63 x--; 64 ++x; 65 --x; 66 x; 67 68// Error, no autofix 69if (x++, x === 1) { 70 // Error, autofix 71 x++; 72 x--; 73 ++x; 74 --x; 75 x; 76} 77 78// Error, autofix 79x++ + x--; 80 ++x; 81 --x; 82 83// Error, autofix 84++x; 85 x-- + x++; 86 --x; 87 88// Error, autofix 89++x; 90 --x; 91 x-- + x++; 92 93// Error, autofix 94x === x; 95 --x; 96 x === x; 97 x++; 98 x === x; 99 100// Error, autofix 101x instanceof number; 102 --x; 103 x instanceof number; 104 x++; 105 x instanceof number; 106 107// Error, autofix 108x in x; 109 --x; 110 x in x; 111 x++; 112 x in x; 113