Skip to content

eslint/no-setter-return Correctness

This rule is turned on by default.

What it does

Setters cannot return values.

Why is this bad?

While returning a value from a setter does not produce an error, the returned value is being ignored. Therefore, returning a value from a setter is either unnecessary or a possible error, since the returned value cannot be used.

Example

javascript
class URL {
  set origin() {
    return true;
  }
}

References

Released under the MIT License.