tslint-consistent-codestyle
tslint-consistent-codestyle copied to clipboard
feature request: naming-convention - set rule for `for` loop control variables
trafficstars
I would like to set a different for naming-convention rules for control variables defined in for loop.
For instance:
function fooBar() {
for (let i = 0, j = 10; i < 10; i++, j--) {
let _local = 2;
console.log (`${i} ${_local*i} => ${j} ${_local*j);
}
}
With the below tslint.json setting, tslint warns variable name must have leading underscore (naming-convention) for loop control variables i & j
"naming-convention": [
true,
{
"type": "variable",
"modifiers": "local",
"leadingUnderscore": "require"
}
]
I would like to add a new convention rule for overriding control variables defines in for loop.
I would advise to add a new type loopControlVariable