Skip to content

Latest commit

 

History

History
48 lines (29 loc) · 1.65 KB

no-incorrect-computed-macros.md

File metadata and controls

48 lines (29 loc) · 1.65 KB

ember/no-incorrect-computed-macros

💼 This rule is enabled in the ✅ recommended config.

🔧 This rule is automatically fixable by the --fix CLI option.

This rule attempts to find incorrect usages of computed property macros, such as calling them with the incorrect number of arguments.

It currently only catches using the and and or macros with the wrong number of arguments, but may be expanded later.

Examples

Examples of incorrect code for this rule:

import { and, or } from '@ember/object/computed';

export default Component.extend({
  macroPropertyAnd: and('someProperty'), // Not enough arguments.

  macroPropertyOr: or('someProperty') // Not enough arguments.
});

Examples of correct code for this rule:

import { and, or, readOnly } from '@ember/object/computed';

export default Component.extend({
  macroPropertyReadOnly: readOnly('someProperty'),

  macroPropertyAnd: and('someProperty1', 'someProperty2'),

  macroPropertyOr: or('someProperty1', 'someProperty2')
});

Related Rules

References

  • Guide for computed properties
  • Spec for computed property macros