Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Moved 'use strict'; to a functional scope inside js templates. #1127

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Moved 'use strict'; to a functional scope inside js templates. #1127

wants to merge 13 commits into from

Conversation

qed2000
Copy link

@qed2000 qed2000 commented Jun 28, 2015

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.

qed2000 added 13 commits June 27, 2015 20:37
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.
@arthurvr
Copy link
Member

Please read the contribution guidelines before opening a pull request. https://github.com/yeoman/generator-angular/blob/master/contributing.md#git-commit-guidelines

@eddiemonge
Copy link
Member

ideally there would be a tool that would add this automatically for us

@arthurvr
Copy link
Member

arthurvr commented Jul 2, 2015

ideally there would be a tool that would add this automatically for us

Agreed. Is there such a tool?

@qed2000
Copy link
Author

qed2000 commented Jul 5, 2015

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.

@eddiemonge
Copy link
Member

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

@eddiemonge
Copy link
Member

Also, should the CoffeeScript files get these changes?

@stevemao
Copy link
Contributor

@stevemao
Copy link
Contributor

CoffeeScript should probably be replaced by babel?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants