Questions tagged [jshint]

A community-driven tool to detect errors and potential problems in JavaScript code and to enforce coding conventions.

About

JSHint is a community-driven tool to detect errors and potential problems in JavaScript code and to enforce coding conventions.

JSHint is very flexible so you can easily adjust it to your particular coding guidelines and the environment you expect your code to execute in.

Interface

JSHint is available:

  • Via a web interface at http://jshint.com/
  • Via npm with npm install jshint or npm install -g jshint for global install
  • As plugins for many text editors and IDEs.

History

JSHint is a fork of JSLint, the tool written and maintained by Douglas Crockford.

The project originally started as an effort to make a more configurable version of JSLint - the one that doesn't enforce one particular coding style on its users — but it then transformed into a separate static analysis tool with its own goals and ideals.

Goals

JSHint's goal is to help JavaScript developers write complex programs without worrying about typos and language gotchas.

Its developers believe that static code analysis programs — as well as other code quality tools — are important and beneficial to the JavaScript community and, thus, should not alienate their users.

Resources

Related Tags

983 questions
0
votes
2 answers

Strange way of setting a boolean in javascript

I've come across this javascript code in the wild and am having trouble understanding exactly what it does and how it works: // Ensure its bool. options.something = (!(options.something === false)); From what I can tell, options.something is just…
JC Hulce
  • 1,551
  • 2
  • 13
  • 23
0
votes
1 answer

How can I suppress warnings in SublimeLinter for mixed spaces/tabs in comments?

Here is a link to a screenshot of the warnings: I would like to be able to use the "cmd+/" shortcut to quickly comment out sections of code. Whenever I do, I get a bunch of space/tab mixing errors. I am required to use tabs for coding standards,…
Julian
  • 1,078
  • 5
  • 17
0
votes
1 answer

Cant remove Javascript JsLint error in Aptana using inline code

I have the following Lint errors with the following javascript function getColor: function (color) { var result = ""; switch (color) { case "RESET": result = "\033[0m"; break; case "BLACK": result = …
Welsh King
  • 3,178
  • 11
  • 38
  • 60
0
votes
1 answer

JSHint for SublimeText2 doesn't find node.js path even if it's right

I've installed JsHint Gutter package in my SublimeText 2, but when I'm try to use it SublimeText give me this error: Node.js was not found in the default path. Please specify the location. The path on the preference file is right.If I try to type…
RikyTres
  • 676
  • 9
  • 31
0
votes
1 answer

JSHint and skipping lines with custom non-JS templating code

I am using SublimeLinter3 in SublimeText3 with the SublimeLinter-jshint linter. I have server side JavaScript that is processed by a custom CGI. It imports other server side JS files with a import statement that is formatted as follows (the :ssjs…
0
votes
1 answer

Tell JSHint to ignore object variable names like obj.@var

I have an application that consumes a JSON web service produced by IBM Domino. Several of the members in each object have variable names that begin with an @ symbol, like obj.@unid for example. This causes JSHint to thrown an error saying…
Patrick Grimard
  • 7,033
  • 8
  • 51
  • 68
0
votes
1 answer

callback function within a loop raises a Lint error

I have a loop that is used to send a json object to several HTTP client: for(var i=0; i
Luc
  • 16,604
  • 34
  • 121
  • 183
0
votes
1 answer

stop building the project in eclipse or using maven if no of error/warnings increases to a certain limit?

I am using JsHint tool (Static Analysis warning tool)as eclipse plug-in in my project that will give the javascript warnings in my project files. Now I need that eclipse stop building project when number of warnings given by JsHint increases beyond…
user3128995
  • 61
  • 1
  • 5
0
votes
1 answer

jshint error: "Bad escaping of EOL. Use option multistr if needed." but multistr is true

I have following .jshintrc file and use grunt-contrib-jshint: { "predef": [ "after", "afterEach", "before", "beforeEach", "describe", "expect", "it", "jasmine", "ls", "moment", "runs", "sinon", …
Kosmetika
  • 20,774
  • 37
  • 108
  • 172
0
votes
0 answers

Writing NPM modules: install dependencies globally?

Summary: is there a way to list a dependency for your to-be-published npm module as global? I'm currently authoring an npm module which relies on JSHINT as a main dependency. The idea for my module is to be able to call JSHINT programmatically from…
tborenst
  • 972
  • 2
  • 9
  • 18
0
votes
1 answer

Can JSHint output warnings about globals

Is there an option parameter to force JSHint to check for explicitly defined global variables and output a warning? clarification: http://jsbin.com/odUcabUL/6/watch?js
Ozrix
  • 3,489
  • 2
  • 17
  • 27
0
votes
1 answer

JSHint Inline Configuration issue

I am using jshint with grunt and using some inline configuration. I am confused at the following. If I run jshint on just the below code. /* jshint undef: false */ var app = foo; /* jshint undef: true */ I would expect this to NOT return the error…
wlingke
  • 4,699
  • 4
  • 36
  • 52
0
votes
1 answer

CSSLint : How to save log from console log into file

I'm new in Grunt plugin and on the way using CSSLint plugin. I run it ok, but I want to save the errors from console log into file. Can CssLint support that, cos when run csslint on command line (window), if you have many errors or warnning, you…
kate
  • 179
  • 2
  • 16
0
votes
1 answer

Resolve JSHint's "Don't use 'with'" recommendation

I am using a script that was written in 2006 and rewriting it so that it follows best practices, and for future inclusion into a side project. I use JSHint.com to figure things out and search SO for solutions to other problems it finds. However, I…
NetOperator Wibby
  • 1,354
  • 5
  • 22
  • 44
0
votes
1 answer

Detect missing functions with jsHint or jsLint

I am wondering, why does code like this do not issue a warning with jsLint or jsHint var obj={}; obj.missingFunction(); I understand that it may assume that the function will be eventually defined. But it complains for so many other things, that i…
vlast3k
  • 78
  • 5