1

Closed

This tool is intolerable

description

  • Why does it care about whitespace so much?
  • Why does it care about having "use strict" in every function?
  • Why doesn't it allow shorthand conditionals?
Spent 5 minutes with this and immediately uninstalled. How about when we "tolerate stupidity," you make it tolerate the stupidity of this extension like the above?

My 2 cents.
Closed Aug 30, 2014 at 3:10 AM by Qube
Need separate task for settings UI.

comments

Qube wrote Aug 27, 2014 at 11:44 PM

Thanks for your feedback Izzmo.

JSLint.NET is an exact representation of JSLint without any alterations. It's just a wrapper. So if you have complaints about what JSLint does and does not tolerate, I suggest you take them to the JSLint community:
https://plus.google.com/communities/104441363299760713736

That said, I will try to answer your questions, because I am a user of JSLint myself:
  • Use the "white" switch to ignore all whitespace checking in JSLint. But I'd add that inconsistent indentation hides bugs and intent equally. Ctrl+K, Ctrl+D in Visual Studio with default settings will provide well formatted JavaScript at very low cost.
  • If there are a lot of "use strict" warnings, then there may be a lot of functions in global scope. If there are a lot of functions in global scope, then there may have a design problem. An IIFE will solve the leaky nature of JavaScript's global scope and provides a perfect place to put a single 'use strict' (all nested functions will inherit from there). Long story short, wrap scripts in an IIFE, put 'use strict' at the top, enjoy a more robust JavaScript.
  • If you mean one-liner if statements, it's because they introduce inconsistencies and confusion. Some people put the body on the same line, some people put them on the next line. Without curly braces, it's too easy to add another line to the body without realizing it's outside the scope of the condition. Curly braces cost so little, and the problem goes away forever.

Izzmo wrote Aug 28, 2014 at 12:20 AM

I am using JSLint directly and it is not giving me any grief with the aforementioned items. So I think this extension could just be super strict out of the box.

As far as global scope, we have 3 functions in there, I just found it a bit odd.

I could do a format on the document, but I don't think this should really be a linting issue per say.

Qube wrote Aug 28, 2014 at 12:30 AM

In JSLint.NET, all options are "off" by default - this is exactly the same as JSLint.com. You must manually turn on the tolerations / assumptions you need.

Question, when you say "using JSLint directly", do you mean via JSLint.com or some other means?

Izzmo wrote Aug 28, 2014 at 2:46 PM

Yes, via their website, but I have moved on to JSHint.

I tried turning all the options off in JSLint.NET, but it didn't work. The multi-state check boxes are super confusing if you ask me. What are the need for 3 states, and what does the boxed state imply?

Qube wrote Aug 28, 2014 at 10:12 PM

You're quite right. Those tri-state WPF checkboxes are confusing. I may raise a separate task to look at some alternative UI.

But they must have three states - default, true and false - to match JSLint.com. JSLint.NET makes no assumptions about what the default setting for each one should be; it leaves that to JSLint. It turns out that the default for every one is actually false - "do not tolerate this thing" - but that could change tomorrow.

You must turn an option on to tolerate things like missing 'use strict'. But turning on all the options is missing the point of the tool. To get the most value, it's better to start as strict as possible and dial it down based on the realities of your app. For example, I often end up setting "unparam" to true because I have no control over callback signatures from third party libraries.

Of course, if you've moved on to JSHint this may all be moot.

But I would add, you may find the JSHint options even more confusing. There are many, many more switches than JSLint, and some are for relaxing rules while others are for enforcing rules - it's a real bool trap.

Izzmo wrote Aug 28, 2014 at 11:44 PM

Yeah, I was using JSLint.com for some things today and noticed the similarities more between that an JSLint.NET. It makes much more sense now.

I guess I didn't get the whole "default" thing.