Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Latest commit

 

History

History
31 lines (20 loc) · 523 Bytes

no-override-get-set.md

File metadata and controls

31 lines (20 loc) · 523 Bytes

Avoid to override getter or setter (s34)

Avoid to override getter or setter, it save computer resources.

Rule Details

This rule aims to flag when override getter or setter

Examples of incorrect code for this rule:

Object.defineProperty(foo, "bar", { get: function() {}})

Examples of correct code for this rule:

const obj = {
  log: ['a', 'b', 'c'],
  get latest() {
    if (this.log.length === 0) {
      return undefined;
    }
    return this.log[this.log.length - 1];
  }
};