Re: [jslint] Re: JSLint stops on "for (var ..."
- One of the problems with this, is if the bug puts the interpreted state of
the code into an inconsistent state.. Jslint might not be able to continue
interpreting the code in a sane way, so aborting is kind of the only
reasonable thing to do (in *some* cases)
On Jul 23, 2012 11:30 AM, "aceblchboy" <aceblchboy@...> wrote:
> --- In email@example.com, "Deva Satyam" <satyam@...> wrote:
> > Even if you allow multiple var declaration, JSLint stops when if finds a
> variable defined within a for ().
> > The problem is not so much that it reports an issue that you told it to
> dismiss but that it stops scanning.
> > My job often involves advising other developers on how to improve their
> code and it is far easier for me if I can get a full listing at once. I
> prefer to teach them using the code they wrote themselves and if I cannot
> get a decent error report, I cannot do it. Fixing the error so as to be
> able to carry on distracts the audience and it doesn't guaranty that it
> will not stop a few lines after the one I fixed.
> There has been a <i>lot</i> of complaints about this. I'm in the same
> sector as you (code review) and even I have complained about it. He isn't
> budging. Try JSHint, or if you have beautified code and really must use
> JSLint, try this regex:
> Find: ^(\s+)for \(var (\w+) = (\d+);
> Replace: \1var \2;\n\1for (\2 = \3;
> That will produce more errors of the var and scoping variety, but it
> should clear 75% of the for (var bottleneck. You may need to tweak matches
> 2 and 3 and where the expression should stop at the first semicolon by
> including more matches.
> I really wish that he would see that if the code is not broken because it
> did not meet his style, that his program should not say that it is broken
> and just print a warning like the rest. It would eliminate the need for
[Non-text portions of this message have been removed]