Questions tagged [jslint]

JSLint is a "code quality" tool for JavaScript developed by Douglas Crockford, a well-known developer also responsible for JSON, JSMin, ADSafe and parts of YUI. JSLint is parallel to C's lint.

JSLint is a static analysis “code quality” tool for JavaScript developed by Douglas Crockford, a well-known developer also responsible for JSON, JSMin, ADSafe and parts of YUI.

The term “linting” originates from fabric lint-rollers that help remove fluff from clothing. In the same way, a code “linter” helps the developer remove fluff from their code.

The first linting tool was developed for the C programming language when early compilers were not sophisticated enough to identify common programming errors. As the language and compilers matured, so the C linter became redundant and obsolete.

As much of the JavaScript written will not have been near a compiler, the requirement for an equivalent linting tool emerged. This is where JSLint comes in.

A similar tool, exists. It was forked from JSLint.

In the words of its creator:

Warning!

JSLint will hurt your feelings.

Resources

Related Tags

1004 questions
-1
votes
2 answers

What does it mean when JSLint returns 45 errors, but code still works, kind of?

JS lint returns a lot of errors, but code still works - good, bad?
antonpug
  • 13,724
  • 28
  • 88
  • 129
-2
votes
1 answer

esLint gives error The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype

I am using esLint for my angular project it throw an error for below code private calculateFieldValue(value: any): any { let isEmptyObject = false; if (value && Array.isArray(value) && value.length === 1 && value[0])…
Prasad Parab
  • 437
  • 1
  • 7
  • 26
-2
votes
1 answer

Whey I have a problem to identify a class on javascript

I create a JavaScript class like below: class contact{ constructeur(nom,prenom){ this.nom = nom; this.prenom = prenom; } function afficher(){ return "Nom : " + this.nom + "Prenom : " + this.prenom; } ... But I have…
Abdeloo07
  • 1
  • 3
-2
votes
1 answer

Declaration of iterator variable in JSLint is flagged as warning

How to declare an iterator for loop variable that passes JSLint.com validation. I have tried var, let, and neither work. I simplified my script down to this line. JSlint.com will not progress past this warning. Have googled it and tried every…
run_the_race
  • 1,344
  • 2
  • 36
  • 62
-2
votes
2 answers

Var delete or not delete?

When my code like this var app = angular.module('PhotoViewer', []); var photos = [ i have error: combine this with previous 'var' statement. When it like this: var app = angular.module('PhotoViewer', []); photos = [ i have error: 'photos' was used…
-2
votes
3 answers

jslint expected ';' saw '}' for inline function

I am using setInterval function of javascript, which expects a inline function defined which will be executed periodically. Below is my code snippet, setInterval( function(){_this.getView().setModel( new JSONModel(_this._getRecentRatingsModel())…
Pradeep
  • 350
  • 1
  • 3
  • 13
-3
votes
1 answer

Troubleshooting javascript failed

I have a page: http://concours.quebecskialliance.com/francais.html. It only works in Firefox but not in Safari or Chrome. The button, made with a jQuery .button is not created, which lead me to a JavaScript error, but even with JSLint or Chrome…
menardmam
  • 9,860
  • 28
  • 85
  • 113
-3
votes
1 answer

How to disable this error warning in jslint?

Can someone please show me how to remove this error from appearing in jslint? How do I disable it? Videos appear: https://jsfiddle.net/xrs21efw/ https://www.jslint.com/ function onYouTubeIframeAPIReady() { const totalP =…
Eve Ninnall
  • 1
  • 3
  • 20
-4
votes
1 answer

Unexpected ES6 feature '='

This minified JavaScript code works just fine: document.onkeyup=function(a){a=a||window.event;a.altKey&&121===a.which&&(my_variable=!0===my_variable?!1:!0)}; However, JSLint complains two things about it: Unexpected ES6 feature '=' Expected '=>'…
Tom
  • 1,836
  • 4
  • 16
  • 30
-4
votes
1 answer

Linters, forbid the use of jquery

We are developing an android app with webviews. We're gonna have third part developers for this webviews, but we want to forbid them to use some libraries to force the use of our owns. In this case, we want to forbid the use of jQuery, among other…
R01010010
  • 5,670
  • 11
  • 47
  • 77
-4
votes
1 answer

How to avoid the `this` and `new` keywords in Javascript?

Here is my code: I want to avoid using this (line 3) and new (line 23). I want to do this because Douglas Crockford considers them harmful. "use strict"; function capWord(inStr) { this.firstIndex = function(inStr) { …
user3421311
  • 171
  • 2
  • 10
-4
votes
1 answer

Where is there a missing semicolon?

JSLint claims there is a missing semicolon here: if ('onhashchange' in window && (docmode === undefined || docmode > 7 )) { window.onhashchange = expandFromLocation; } // IE7 doesn't support the hashchange event so we fall…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
-4
votes
3 answers

JSLint error The '&&' subexpression should be wrapped in parens ? OR with IF conditions error

JSLint gives me the following error : The '&&' subexpression should be wrapped in parens. Here is the line which causes problem: if (anchorLink === 'page1' || anchorLink === 'page2' || anchorLink === 'page3' && (!$('#myDiv').hasClass('boom'))) {…
mlclm
  • 725
  • 6
  • 16
  • 38
-5
votes
2 answers

Uncaught ReferenceError: x is not defined

So jsLint says my x is not defined. I looked it up everywhere but I cant find how to define it... for (x = 0; x < verdachten.length; x++) { console.log("De verdachte is de " + verdachten[x].leeftijd + "jaar oud " + verdachten[x].naam + ",…
1 2 3
66
67