Skip to content

A codemod to convert Ember.js service injections to include the service name argument

License

Notifications You must be signed in to change notification settings

ziw/ember-named-service-codemod

Repository files navigation

ember-named-service-codemod

CI

A codemod to transform your service injection to include service name argument.

Before @inject myService After @inject('my-service') myService Also supports the case when your inject import is aliased to another name (import { inject as service } from '@ember/service')

The service name argument is not required by Ember. This transform is solely for the purpose of more explicit and consistent service injection pattern.

Usage

To run this codemod, you would run the following:

npx ember-named-service-codemod named-service-injection path/of/files/ or/some**/*glob.js

# or

yarn global add ember-named-service-codemod
ember-named-service-codemod named-service-injection path/of/files/ or/some**/*glob.js

Local Usage

node ./bin/cli.js named-service-injection path/of/files/ or/some**/*glob.js

Options

Option Value Default Details
--double-quote boolean false If the output string arg should use double quote @inject("my-service")

Transforms

Contributing

Installation

  • clone the repo
  • change into the repo directory
  • yarn

Running tests

  • yarn test

Update Documentation

  • yarn update-docs

About

A codemod to convert Ember.js service injections to include the service name argument

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published