Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

JSHint does not recognize missing `use strict` in files without functions #1388

Closed
goloroden opened this Issue · 2 comments

3 participants

@goloroden

Sample file foo.js:

y = 35;

var x = {
  foo: 'bar'
};

module.exports = x;

Then, run jshint with detection of stict and globalStrict both enabled.

Expected behavior:

  • JSHint should complain about y defined, but not declared.
  • JSHint should complain about missing 'use strict'; statement.

Actual behavior:

  • JSHint complains about y defined, but not declared.
  • JSHint does NOT complain about missing 'use strict'; statement.

JSHint version 2.3.0.

@valueof
Owner

Fixed.

@valueof valueof closed this
@julienw

Mmm this regressed this with "globalstrict: true":

(function() {
  'use strict';

  var a = 'toto';
  a = a + 'plop';
})();

I think "globalstrict" is not supposed to force using it in global, but only to allow it.

@julienw julienw referenced this issue from a commit in julienw/jshint
@julienw julienw fix issue #1388 using another way ec7efd3
@julienw julienw referenced this issue from a commit in julienw/jshint
@julienw julienw fix issue #1388 using another way e7c0133
@valueof valueof referenced this issue from a commit
@julienw julienw Issue #1451: Fix a regression caused by #1388
Signed-off-by: Anton Kovalyov <anton@kovalyov.net>
c0785c0
@jugglinmike jugglinmike referenced this issue from a commit in jugglinmike/jshint
@julienw julienw Issue #1451: Fix a regression caused by #1388
Signed-off-by: Anton Kovalyov <anton@kovalyov.net>
c15b2e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.