eslint-plugin-ember icon indicating copy to clipboard operation
eslint-plugin-ember copied to clipboard

New Rule: `no-simple-alias`

Open runspired opened this issue 4 years ago • 1 comments

A new rule disallowing oneWay reads and readOnly off of another prop on the same context.

import Component from '@glimmer/component';
import { oneWay, reads, readOnly } from '@ember/object/computed';

export default MyComponent extends Component {
  aProp = true;

  // BAD
  @oneWay('aProp') oneWayProp;
  @reads('aProp') readsProp;
  @readOnly('aProp') readOnlyProp;

  // OK
  @oneWay('args.aProp') oneWayProp;
  @reads('args.aProp') readsProp;
  @readOnly('args.aProp') readOnlyProp;
}

runspired avatar Mar 29 '21 23:03 runspired

Ya, seems good to me. TBH, having many aliases for a local property is just very very confusing.

rwjblue avatar Apr 12 '21 17:04 rwjblue