When I try to save the following code in sublime text,
'use strict';
/*global angular,_*/
var app = angular.module("myApp", []);
app.controller("myCtrl", function ($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe";
});
I am getting the following jslint error :
#1 Unexpected expression 'use strict' in statement position.
'use strict'; // Line 1, Pos 1
#2 Place the '/*global*/' directive before the first statement.
/*global angular,_*/ // Line 2, Pos 1
#3 Undeclared 'angular'.
var app = angular.module("myApp", []); // Line 4, Pos 11
#4 Expected 'use strict' before '$scope'.
$scope.firstName = "John"; // Line 6, Pos 3
#5 Expected '$scope' at column 5, not column 3.
$scope.lastName = "Doe"; // Line 7, Pos 3
You cannot use
'use strict';
there in a global way with jslint. See https://stackoverflow.com/a/35297691/1873485With that in mind, you need to remove it from the global scope and add it in your function scope or wrap everything in an IFEE
or wrap it: