-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add usestrict option to include 'use strict';
in output
#58
Conversation
Updated tests and README.
How do you feel about just having |
I love that idea! Should I update the PR to do that (fix tests, etc...)? |
If you have the time, that'd be great. I can't see how this would even be a BC break. I'll handle the tagging & publishing afterwards... |
Just made the change, it will always add |
Add usestrict option to include `'use strict';` in output
|
Ironically enough... this change actually caused my output file to start breaking in jshint. Up until this change I had been adding the "use strict" statement plus some comments to the top of the output file via the bootstrap option, and now jshint is complaining about having two of those statements in the file. So I took out my manual addition. Now the "use strict" statement is nested inside of the angular.module block rather than at the top of the file. Jshint doesn't seem to care, but shouldn't it be at the top of the file? |
@gtczap It used to be that JSHint approved of the At least for now, the compiled templates should be jshint-compatible, and you shouldn't have to explicitly declare it anymore. If it is a big problem, then I can make |
@ericclemmons Same issue here as @gtczap. This should be an option. All my js are concatenated and the use strict causes jshint complain. 'use strict';
var someApp = angular.module('someApp', []);
angular.module('someApp').controller('homeController', ["$scope", function($scope) {
}]);
angular.module('someApp').run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('home/view.html',
""
);
}]);
|
Problem
I concatenate the output from ngtemplates into my application file. Part of my building process is to run JSHint after the concatenation, just in case. This step was failing because the generated function did not have
'use strict';
in there. I thought this might be helpful to other people, too!Solution
I added an option called
usestrict
(convention is no-underscores / all lowercase, right?) and if it istrue
then the generated function starts with a'use strict';
. I also added a test case and updated the README.