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

ESLint Rule: Underscored backing property names. #1

Open
paul-go opened this issue Apr 9, 2019 · 0 comments
Open

ESLint Rule: Underscored backing property names. #1

paul-go opened this issue Apr 9, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@paul-go
Copy link
Collaborator

paul-go commented Apr 9, 2019

Underscores should only be allowed when they're used as the backing field of a getter property. They should be disallowed in all other cases. For example, the following is valid:

class MyClass
{
  get value()
  {
    return this._value;
  }
  private _value = 0;
}

The name of the backing field should be identical to the name of the corresponding property, with the addition of the underscore prefix.

Also, the backing property with the underscore needs to be placed directly after the actual property in the file.

@paul-go paul-go added the enhancement New feature or request label Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant