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
-1
votes
2 answers

How is it possible to use object "angular" even if 'use strict' statement is used?

I’m using the gulp-jshint which makes me add ‘use strict’ directive in every file and therefore I can’t use my global object emApp, defined in my app.js file like this: var emApp = angular.module('emApp'); However, I see that jshint says nothing…
zhekaus
  • 3,126
  • 6
  • 23
  • 46
-1
votes
1 answer

How to remove the following error in Jslint?

I am the first experience with Jslint/jshint, Just received the error like this ES5 option is now set per default How to fix it?
Adam Lee
  • 24,710
  • 51
  • 156
  • 236
-1
votes
1 answer

Expected ')' to match '(' from instead saw while running the JSHint

I am using the d3 library to draw a path/line, for this I need to use stroke-dasharray property as given below. This works fine for me, vis.append("path") .attr("class", "predictedLowerCI") .attr("d", valueline5(scope.rowdata)) .attr({…
nitin
  • 156
  • 2
  • 13
-1
votes
1 answer

How configure jshint in a meanjs project with socket.io?

I followed exactly that tutorial (I obviously replaced the vexxhost domain name by localhost:3000 for my tests). And while calling grunt there is an error ('io' is not defined) but the server start without any other complain. If I correctly…
Alexandre SIRKO
  • 816
  • 11
  • 22
-1
votes
1 answer

Can JSHint detect when extra arguments are passed to a function?

For example, this won't trigger any warnings from JSHint, even though one of the arguments isn't used by the function, and isn't even part of the function signature. function foo(x) { return x; } foo(4, 5);
wch
  • 4,069
  • 2
  • 28
  • 36
-1
votes
1 answer

JSHINT tar unpack error

I'm trying to install jshint to use with Sublime. I've successfully installed node.js and have installed SublimeLinter and SublimeLinter-jshint packages but whenever I type npm install -g jshint into terminal, I get the following: have tried using…
-1
votes
4 answers

Correct Way Of Achieving This Result?

So I currently have this piece of code: if(direction === "right" ) { var signOne = '-'; var signTwo = ''; } if(direction === "left" ) { var signOne = ''; var signTwo = '-'; } innerWork.not('.active').css({'left': signOne + '450px'}); // Move the…
Tenatious
  • 849
  • 4
  • 12
  • 32
-1
votes
1 answer

Impossible to install jshint-eclipse plugin

It is impossible to install jshint-eclipse plugin (http://github.eclipsesource.com/jshint-eclipse/), the following error occurs: No repository found at http://github.eclipsesource.com/jshint-eclipse/updates/ Maybe, somebody knows another way to…
isaranchuk
  • 362
  • 3
  • 13
-1
votes
1 answer

What is difference between "options and error code" in jshint?

I had confusion between options and error/warning code in jshint. curly : true or W116 How to identify "curly options" belongs to W116 Code? while(true) alert("ok"); demo.js: line 3, col 5, Expected '{' and instead saw…
-1
votes
1 answer

jhint error W021: 'draw' is a function

i have included this file in angular app . /** * @description Google Chart Api Directive Module for AngularJS * @version 0.1 * @author Nicolas Bouillon * @license MIT * @year 2013 */ (function(document, window) { 'use…
XMen
  • 29,384
  • 41
  • 99
  • 151
-2
votes
1 answer

Math in javascript doesnt work the way i expected

Im trying to use this equation to make a progress bar but when ever i try to divide a number with a percent it just gives me a error. The equation: /* jshint esversion: 6 */ let progress = (this.assetsComplete*100%)/((this.assets.length -…
Fus_ion
  • 41
  • 6
-2
votes
3 answers

JSHint - Unreachable 'break' after 'return'

So I have been developing a modal control for several months. It is custom coded to my clients needs but I want to release it to the generic public. I have been working to get it to minify via codekit as well as uglify. Here is an example of the…
googabeast
  • 172
  • 9
-2
votes
1 answer

Allow type declaration with JSHint

I try to validate some server side javascript with JSHint. Everything looks great so far, but i got problems with a syntax like this var foo:type = bar; The message is Missing semicolon. Expected '(end)' and instead saw ':'. Is there any way to…
Pudelduscher
  • 359
  • 3
  • 18
-2
votes
2 answers

JSHint: Allow empty return statements with ASI

In my JavaScript I want to have a function exit early if certain conditions are not met, like in the following example. (function () { var something = false if (!something) return doMoreStuff() }()) I'm ommitting semicolons out of…
Sacha
  • 2,813
  • 3
  • 22
  • 27
-3
votes
1 answer

How to fix JSHint warning when I use the "Lazy Function Definition" pattern?

I use the "Lazy Function Definition" pattern to define global functions like so: if (bArmingSequenceComplete () ) { console.log ("Good to go."); } // Code flows from high level to low level and support functions... // vvvvv function…
Brock Adams
  • 90,639
  • 22
  • 233
  • 295
1 2 3
65
66