-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Labels
Description
I would like to disallow short variable names and certain keywords.
This should already be possible with a regex, but maybe that could still be added as an option?
Examples where this is useful:
// Short variable names
try {} catch (e) {}
[1, 2].map(n => n*2)
[1, 2].forEach(v => v)
window.addEventListener('error', (ev) => {})
// Banned words (specific names, such as `err`, `num` and `val`
try {} catch (err) {}
[1, 2].map(num => num*2)
[1, 2].forEach(val => val)
Maybe there should be a way to define exceptions, for example i:
for(let i = 0; i < 1; i++) {}
I also noticed that the rule doesn't seem to trigger for the variable used in the catch: try {} catch (e) {}. Is that intended behavior or a bug?