Skip to content
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

/* jshint -W101 */ not working when withing IIFE #3017

Closed
batista opened this issue Aug 24, 2016 · 3 comments
Closed

/* jshint -W101 */ not working when withing IIFE #3017

batista opened this issue Aug 24, 2016 · 3 comments
Labels

Comments

@batista
Copy link

batista commented Aug 24, 2016

I believe there's a regression between versions 2.9.2 and 2.9.3.

The following started throwing a warning since 2.9.3 throws an error line 5, col 133, Line is too long. (W101):

(function() {
  function myFunction(myVar) {
    /* jshint -W101 */
    if (myVar) {
      var longVariableContent = 'loooooooooooooooooooooooooooooooooooooooooooooooooong liiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiine';
    }
  }
})();

note that without the IIFE the warning doesn't trigger, the following passes the test:

  function myFunction(myVar) {
    /* jshint -W101 */
    if (myVar) {
      var longVariableContent = 'loooooooooooooooooooooooooooooooooooooooooooooooooong liiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiine';
    }
  }

EDIT: I realized that it has nothing to do with a recent update, although in my real use case, the warning has only started triggering after 2.9.3. I can't reproduce yet in a test though.

@batista batista changed the title /* jshint -W101 */ not working /* jshint -W101 */ not working when withing IIFE Aug 25, 2016
@jugglinmike
Copy link
Member

Thanks for the report! One detail missing from your test case is the maxlen
option. There are also a few details which aren't strictly necessary, so I've
cleaned things up a bit:

// jshint maxlen: 25
(function() {
  /* jshint -W101 */
  return "ooooooooooooooo";
})();

This is actually another case of a recently-reported bug; see gh-3013 for way
too much detail on what is going wrong here (along with an explanation as to
why it appears as a version 2.9.3 regression in your application).

I'm especially glad you reported the problem because it demonstrates how my
patch at gh-3016 is incomplete.

@batista
Copy link
Author

batista commented Mar 1, 2017

fixed with merge of #3016

@batista batista closed this as completed Mar 1, 2017
@jugglinmike
Copy link
Member

Thanks for following up on this, Sérgio!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants