当我运行jshint app.js或使用Sublimelinter的Sublime 2.0时,我遇到了同样的错误。
我的配置在sublimelinter和package.json中非常相似:
"evil": true,
"regexdash": true,
"browser": true,
"wsh": true,
"trailing": true,
"sub": true,
"predef": ["angular"],
"globalstrict": true,
"node": true,
"strict": true,
"es5": true,
"predef": {
"angular": true
}
我的代码:
'use strict';
// Declare app level module which depends on filters, and services
angular.module('myApp', [
'ngRoute',
'myApp.filters',
'myApp.services',
'myApp.directives',
'myApp.controllers'
]).
config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view1', {templateUrl: 'partials/partial1.html', controller: 'MyCtrl1'});
$routeProvider.when('/view2', {templateUrl: 'partials/partial2.html', controller: 'MyCtrl2'});
$routeProvider.otherwise({redirectTo: '/view1'});
}]);
此错误非常烦人使用“use strict”的函数形式如何在sublimelinter和package.json(jshint)中配置jshint以不再显示此错误?