Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1004 Bytes

no-unnecessary-service-injection-argument.md

File metadata and controls

43 lines (31 loc) · 1004 Bytes

Disallow unnecessary argument when injecting service

Rule name: no-unnecessary-service-injection-argument

It's not necessary to specify an injected service's name as an argument when the property name matches the service name.

Rule Details

Examples of incorrect code for this rule:

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

export default Component.extend({
  myServiceName: service('myServiceName')
});

Examples of correct code for this rule:

export default Component.extend({
  myServiceName: service()
});
export default Component.extend({
  myServiceName: service('my-service-name')
});
export default Component.extend({
  otherSpecialName: service('my-service-name')
});

References