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

the example that can cause errors in rules about getter and setter #1120

Closed
cnwangjie opened this issue May 1, 2018 · 2 comments

Comments

@cnwangjie
Copy link
Contributor

commented May 1, 2018

Following is the current example for the rule Objects must contain a getter when a setter is defined.
This obviously leads to a loop call problem.

var person = {
  set name (value) {    // ✗ avoid
    this.name = value
  }
}

var person = {
  set name (value) {
    this.name = value
  },
  get name () {         // ✓ ok
    return this.name
  }
}
@LinusU

This comment has been minimized.

Copy link
Member

commented May 1, 2018

Whoops, yeah, do you want to submit a pull request to change this.name to this._name?

@cnwangjie

This comment has been minimized.

Copy link
Contributor Author

commented May 1, 2018

@LinusU Sure, I've submitted a PR just now #1121

@feross feross closed this in 24b6625 May 10, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.