Skip to content

feature request: naming-convention - set rule for for loop control variables #137

@libinvarghese

Description

@libinvarghese

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions