0

I have the same error when I run jshint app.js or use Sublime 2.0 with sublimelinter.

My configuration looks very similar in sublimelinter and in 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
    }

My code:

'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'});
  }]);

This error is very annoying Use the function form of "use strict" How can I configure jshint in sublimelinter and package.json (jshint) to do not show this error again ?

Thomas
  • 503
  • 1
  • 12
  • 18
  • If you wrap all your code in a closure it will go away. I'd argue that's the better solution than reconfiguring the hint, since it stops you polluting the global scope, as well as allowing you to use non-strict libraries (which is why the hint exists) – Dave Mar 16 '14 at 11:06
  • @Dave: You might notice that he *does not* pollute global scope with his code. Also why would that prevent the use of non-strict libraries? – Bergi Mar 16 '14 at 11:39
  • It prevents non-strict libraries if you're bundling multiple sources into one (since the strict mode affects the entire file). Also while this code has no variables, that won't generally be the case, so the config shouldn't (IMO) be tailored for it; better to tailor the file to the config, which in this case means using a closure. – Dave Mar 16 '14 at 11:56
  • 2
    See this question: http://stackoverflow.com/questions/4462478/jslint-is-suddenly-reporting-use-the-function-form-of-use-strict – Miichi Mar 16 '14 at 13:49

0 Answers0