ember-codemods/ember-native-class-codemod

@service decorators output twice

lukemelia opened this issue · 2 comments

Consistently across my codebase, every time a service injection was used, it was replaced by the codemod with two @service decorators.

Example:

Before:

import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { readOnly } from '@ember/object/computed';

export default Component.extend({
  classNames: 'UpgradeSuccess',
  userService: service('user'),
  user: readOnly('userService.model')
});

After:

import classic from 'ember-classic-decorator';
import { classNames } from '@ember-decorators/component';
import { inject as service } from '@ember/service';
import { readOnly } from '@ember/object/computed';
import Component from '@ember/component';

@classic
@classNames('UpgradeSuccess')
export default class ComponentComponent extends Component {
  @service
  @service
  userService;

  @readOnly('userService.model')
  user;
}

Thanks for reporting!

I believe this should be fixed on master, we have tests for this now so we should be all good 👍