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

allowAfterThisConstructor for no-underscore-dangle #11488

sripberger opened this issue Mar 7, 2019 · 2 comments · May be fixed by rsumner868/librealsense2.1#1, rsumner868/librealsense#4, O330oei/node#4 or O330oei/node#11


Copy link

@sripberger sripberger commented Mar 7, 2019

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 the allowAfterThis and allowAfterSuper 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?


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:

var a = this.constructor.foo_;

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.

@sripberger sripberger changed the title allowAfterConstructor for no-underscore-dangle allowAfterThisConstructor for no-underscore-dangle Mar 8, 2019
Copy link

@platinumazure platinumazure commented Mar 8, 2019

Seems reasonable to me. I'll support this. 👍

@platinumazure platinumazure added evaluating and removed triage labels Mar 8, 2019
@eslint eslint bot closed this Apr 8, 2019
@eslint eslint bot added the auto closed label Apr 8, 2019
Copy link

@eslint eslint bot commented Apr 8, 2019

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that issues failing to reach accepted status after 21 days tend to
never be accepted, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@eslint eslint bot locked and limited conversation to collaborators Oct 6, 2019
@eslint eslint bot added the archived due to age label Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.