Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
libinvarghese opened this issue Dec 13, 2019 · 1 comment

Comments

@libinvarghese
Copy link

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.

@libinvarghese
Copy link
Author

I would advise to add a new type loopControlVariable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant