Enforce the use of for-of loop over the standard for loop where possible.
declare const array: string[];
for (const x of array) {
console.log(x);
}
for (let i = 0; i < array.length; i++) {
// i is used, so for-of could not be used.
console.log(`${i}-${array[i]}`);
} declare const array: string[];
for (const x of array) {
console.log(x);
}
for (let i = 0; i < array.length; i++) {
console.log(array[i]);
} plugin:@typescript-eslint/all
For details about how to configure Code Linter check rules, see Code Linter.