-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Moved 'use strict'; to a functional scope inside js templates. #1127
base: master
Are you sure you want to change the base?
Conversation
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
moved 'use strict'; to a functional scope.
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 |
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? |
CoffeeScript should probably be replaced by babel? |
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.