question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The future of ng-annotate

See original GitHub issue

I have maintained ng-annotate for almost three years now and I think it’s now time for me to either pass the maintainer bit forward or to declare ng-annotate feature complete, disabling implicit matching.

I created ng-annotate because it seemed tedious and error-prone to keep two parameter-lists in sync. At the time most angular-applications had similar enough structure that detecting functions to annotate automagically seemed like a good idea. But as angular progressed and its community grew, the slope became more and more slippery. I eventually added support for explicitly marking up which functions to annotate (first via /*@ngInject*/, then via "ngInject") but regrettably to late. The automagic expectation still remains, as reflected in the issue tracker. Please note that "ngInject" works great in practice - it takes a couple of seconds to type it in, you don’t need to keep two parameter lists in sync and it’s crystal clear which parts of your code will be transformed and which won’t.

Which brings us to TypeScript and ES2015+ support. With "ngInject" markup it works fine as long as ng-annotate is fed with the tsc/babel/… processed output. With implicit matching it’s a whole different beast on top of the already slippery automagic-slope. I’ve consistently said no to adding ES2015+ support for this reason, and there are lingering pull requests and issues (mostly feature requests).

I see two paths forward (are there other options?):

  1. I will ship a vastly simplified ng-annotate 2.0, supporting explicit "ngInject" matching only. It will be (mostly) feature frozen but bugs will be fixed. An unimportant but still nice side effect would be that ng-annotate becomes even faster.
  2. I pass it along. The new maintainer(s) can revisit my decision to not support unprocessed ES2015+ input and how far to further slip down the implicit slope.

Thoughts on this? I’m interested in hearing from users, current and future contributors and from anyone interested in taking on the maintainer role.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:41
  • Comments:39 (5 by maintainers)

github_iconTop GitHub Comments

25reactions
mgolcommented, Jun 10, 2016

Unprocessed ES6 shouldn’t be supported in my opinion. Use toolchains, dudes.

Why? There are lots of ES6-compatible environments now and not every project has to support IE. Also, it’s perfectly fine to want to run your code in ES6 mode during development for easier debugging and having ng-annotate work there would help a lot.

Requiring transpiling ES6 to ES5 in all cases decreases usefulness of ES6 a lot.

10reactions
schmodcommented, Jul 25, 2016

Actually, explicit-only matching turned out to be really easy to implement, and is now released in v0.4.0 of babel-plugin-angularjs-annotate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ng-annotate NPM - npm.io
ng-annotate adds and removes AngularJS dependency injection annotations. Write your code without annotations and mark-up functions to be annotated with the ...
Read more >
ng-annotate - npm
ng-annotate adds and removes AngularJS dependency injection annotations. It is non-intrusive so your source code stays exactly the same ...
Read more >
Building app with ES6 features causes issues. - Discussion
Building app with ES6 features causes issues. I was testing out a custom view component and had ES6 syntax to test something out...
Read more >
https://www.saitestore.unasus.ufma.br/theme/mm/nod...
... if not please let me know! ngmin issues that just works in ng-annotate: ... enhancement #70 The future of ngmin - ng-annotate...
Read more >
You Don't Need to Type Annotations by Hand - codelord.net
For several years, the handy ng-annotate has helped save countless developers hours and debugging sessions, by automatically inserting ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found