schmod / babel-plugin-angularjs-annotate

Add Angular 1.x dependency injection annotations to ES6 code
http://schmod.github.io/babel-plugin-angularjs-annotate
MIT License
241 stars 26 forks source link

Support for @ngInject within JSDoc blocks #31

Closed kamilbrk closed 10 months ago

kamilbrk commented 6 years ago

Hi,

I was wondering if there's any chance you could consider supporting JSDoc/NGDoc multiline comments with explicit @ngInject annotation:

  /**
   * Example
   * @someannotation
   * @ngInject
   */
  class svc {}

I've made a simple pull request but I'm quite overwhelmed with tests, made just one for ES2015 code. Submitting shortly.

schmod commented 6 years ago

I'll take a look at the PR -- this seems like something we can add pretty easily. However, I want to emphasize that prologue directives are (by far) the most reliable way to add annotations.

Docblock comments occasionally get moved around by other transformations/preprocessors, and there aren't really any standards that say that they shouldn't. Prologue directives, on the other hand, have an explicit definition in the ECMAScript specification, and tend to be respected by other transformations.

kamilbrk commented 10 months ago

Fixed by https://github.com/schmod/babel-plugin-angularjs-annotate/pull/37