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

assuming Node.js forces adding 'use strict' statement #721

segrey opened this Issue Oct 30, 2012 · 5 comments


None yet
4 participants
Copy link

segrey commented Oct 30, 2012

Paste following code snippet info the code editor on the

function abc() {
  var a = 1;
  1. Lint code using default configuration (i.e. all "Warn" options are selected, "Browser" is assumed).
    Three errors are found. One of them is
Line 2: var a = 1;
Missing "use strict" statement.

OK. That is expected behavior.

  1. Deselect "When code is not in strict mode" option and lint again. The error has disappeared as expected.

  2. Assume NodeJS and lint again.
    Unexpected error:

Line 2: var a = 1;
Missing "use strict" statement.

@valueof valueof closed this in 69a350a Oct 31, 2012


This comment has been minimized.

Copy link

gmills82 commented Jan 2, 2013

This is still an issue. I'm using the Webstorm version of JSHint and have configured the options to not warn me about strict errors and yet I still get them. In this case I'm explicitly telling JSHint not to warn me and it is, so I think its a bug.


This comment has been minimized.

Copy link

robrich commented Jan 2, 2013

One of the bummer parts about JetBrains's WebStorm is they don't allow us to update JSHint. I'm using WebStorm 5.0.4 and WebStorm -> Settings -> JavaScript -> Code Quality Tools -> JSHint says that includes JSHint r12.

To help narrow the focus , can you grab the JSHint version you're using in WebStorm to produce this concern?


This comment has been minimized.

Copy link

valueof commented Jan 2, 2013

Well, given that 1.0.0 is only at the release candidate stage I don't blame them for not updating. In a week or so I'll make the official stable release and then you can ping WebStorm developers.


This comment has been minimized.

Copy link

segrey commented Jan 3, 2013

WebStorm 5.0.4 uses JSHint r12 ( jshint.js file is packed into plugins/JavaScriptLanguage/lib/JavaScriptLanguage.jar (subpath: com/intellij/lang/javascript/linter/jshint/jshint.js).
As the official stable JSHint release is available it will also be available in next WebStorm 6 EAP.
Also WebStorm 6 will have support for dynamic JSHint version update (it will fetch JSHint version from GitHub).


This comment has been minimized.

Copy link

gmills82 commented Jan 3, 2013

@robrich I'm also using the r12 version of JSHint. @antonkovalyov makes sense. Overall, not a huge deal. I still thoroughly enjoy this tool and the IDE.

jugglinmike added a commit to jugglinmike/jshint that referenced this issue Oct 21, 2014

Don't assume 'strict' for 'node' environments.
We don't need to warn people about using "use strict" outside
of a function scope in Node environments but my previous naive
implementation was achieving this by simply turning 'globalstrict'
on. This doesn't really work because it 'globalstrict' implies
'strict' which  is not always wanted. This patch fixes it.

Fixes jshintGH-721.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment