Giter Site home page Giter Site logo

Comments (6)

schmod avatar schmod commented on August 22, 2024

Do you have a reason for preferring this style?

I generally haven't seen it used much in the wild, and @-prefixed comments seem to be the standard convention for annotating JS sources, and mimic the annotation syntax used in ES6/Java/Python.

from babel-plugin-angularjs-annotate.

mgol avatar mgol commented on August 22, 2024

I guess you're right in that it reminds other tools more.

My preference came from a few things:

  1. The fact that I have 'ngInject'; sprinkled all over my projects so migrating to this Babel plugin would require refactoring. 😄
  2. It resembles "use strict", "use asm" etc. a little.
  3. ng-annotate itself has described this way as the preferred one: https://github.com/olov/ng-annotate#explicit-annotations-with-nginject

from babel-plugin-angularjs-annotate.

mgol avatar mgol commented on August 22, 2024

See also olov#180 (comment) and olov#206. I have an impression that quite many people think the 'ngInject'; pragma is the recommended way, some even think other forms are deprecated. :) In some cases it's the only way as some transpilers will lose comments or misplace them.

Adding this way of annotating would increase the compatibility with the original ng-annotate.

from babel-plugin-angularjs-annotate.

mgol avatar mgol commented on August 22, 2024

Thanks! 🎉

from babel-plugin-angularjs-annotate.

schmod avatar schmod commented on August 22, 2024

Huh. I didn't realize that it had emerged as the preference.

Fortunately, it's also a whole lot easier to implement.

Unless I'm missing something, I think class constructors are the only new ES6 feature where a prologue would be useful/usable. Can you think of any place else where this would be useful?

Class methods come to mind, but is there an actual use-case for that?

from babel-plugin-angularjs-annotate.

mgol avatar mgol commented on August 22, 2024

I'd expect it to be used only for class constructors, at least I don't see use cases for annotating methods. If some come up, it can always be added later, I guess. :)

from babel-plugin-angularjs-annotate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.