allowAfterThisConstructor for no-underscore-dangle #11488
Labels
archived due to age
This issue has been archived; please open a new issue for any further discussion
auto closed
The bot closed this issue
enhancement
This change enhances an existing feature of ESLint
evaluating
The team will evaluate this issue to decide whether it meets the criteria for inclusion
rule
Relates to ESLint's core rules
Like many, I've been using the
no-underscore-dangle
method to enforce the style of prefixing "private" members with underscores. It's nice in that it flags anytime such properties are accessed, and theallowAfterThis
andallowAfterSuper
rules make possible to work with these properties inside a class.I have found an additional case that would be nice to allow: when an instance method or constructor wants to invoke a "private" static method. To make this possible without having to disable the rule on a case-by-case basis, I'd like to add an option to allow underscore dangles when referencing properties on
this.constructor
.What rule do you want to change?
no-underscore-dangle
Does this change cause the rule to produce more or fewer warnings?
Fewer, optionally.
How will the change be implemented? (New option, new default behavior, etc.)?
New option.
Please provide some example code that this change will affect:
What does the rule currently do for this code?
Produces the following warnings/errors:
Unexpected dangling '_' in 'foo_'
Unexpected dangling '_' in '_bar'What will the rule do after it's changed?
Allows suppression in this case, if new
allowAfterThisConstructor
option is set to true.Are you willing to submit a pull request to implement this change?
Yes, will be creating it shortly.
The text was updated successfully, but these errors were encountered: