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

Block unsafe use of arrow functions #5

Open schmod opened 7 years ago

schmod commented 7 years ago

Arrow functions cannot be safely used in providers or services, because these types are intended to be invoked with the new operator, and expect to have their own value of this.

We should discourage (or outright disallow) people from doing this, because the breakages that it causes could lead to subtle and unpredictable bugs.

schmod commented 7 years ago

Counterpoint: This could be beyond the scope of what this project is meant to provide.

mgol commented 7 years ago

Yeah, I think such things are more in scope of a linter.