JavaScript

JavaScript

Made by DeepSource

Incorrect computed macros JS-0789

Bug risk
Minor
Autofix ember

Macros are called with incorrect number of arguments

Bad Practice

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

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

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

Recommended

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

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

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

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