generator-angular
generator-angular copied to clipboard
Moved 'use strict'; to a functional scope inside js templates.
By placing the 'use strict'; outside of a functional scope, it can force an entire application to be strict even if some 3rd party components are not. By moving this statement into each component's function, it forces that component into strict mode, without causing conflicts with non strict outside code. Besides, I found that placing it outside of the app functions didn't enforce strict anyway.
Please read the contribution guidelines before opening a pull request. https://github.com/yeoman/generator-angular/blob/master/contributing.md#git-commit-guidelines
ideally there would be a tool that would add this automatically for us
ideally there would be a tool that would add this automatically for us
Agreed. Is there such a tool?
style(templates): move 'use strict'; to a functional scope inside js templates
'use strict'; does not behave as expected when outside of a functional scope. This change moves the 'use strict'; into each function within the templates.
This does not contain breaking changes.
The specs dont need it moved since they don't get concatenated. Also, these should be squashed.
As for the tool that would do this, it should take each file, wrap it in an iife and put the 'use strict' at the top of the iife. Although this could cause problems if the enduser doesn't know this is happening.
These shouldn't affect the vendor.js files since those are separate from the app files
Also, should the CoffeeScript files get these changes?
https://github.com/gruntjs/grunt-contrib-concat#custom-process-function
CoffeeScript should probably be replaced by babel?