FAQ Database Discussion Community


There is a way to make jslint show a warning or an error when console is used?

javascript,jslint
I know that many people would prefer to ignore that warning, but here are some reasons because I think it should be a good idea: It's just a global var, like others, and I don't want to use it without explicitly declaring it as one of the /* globals */...

Trying to jslint files using jenkins .. java.io.FileNotFoundException: /var/lib/jenkins/jobs/test/workspace (Is a directory)

jenkins,jslint
Error seen in jenkins job console output .. [JSLint] Ready [JSLint] calling jslint with args[-DxmlOutput=/var/lib/jenkins/jobs/test/workspace/, /var/lib/jenkins/jobs/test/workspace/src/main/resources/levels/level1.json, /var/lib/jenkins/jobs/test/workspace/src/main/resources/levels/level2.json, /var/lib/jenkins/jobs/test/workspace/src/main/resources/levels/level3.json] [JSLint] JSLint path is jar:file:/var/lib/jenkins/plugins/jslint/WEB-INF/lib/classes.jar!/com/boxuk/jenkins/jslint/JSLintBuilder/jslint.js ERROR: Build...

What's wrong with this regex? JSLint is throwing an error

javascript,regex,jslint
I'm trying to validate my whole script through the new JSLint, but with this: function a() { 'use strict'; var string; string = string.replace(/\x00*/g, ''); } It throws: Unexpected 'x' after '\'. string = string.replace(/\x00*/g, ''); The old version throws no errors with that. I realize that it's in beta,...

Is it possible to switch on JSLint checking in PhpStorm for Typescript files?

javascript,typescript,phpstorm,jslint
Switching on JSLint code quality in PhpStorm only seems to work with js-files. Can I also switch it on for typescript (ts) files?

Unused 'x' in function arguments, but 'x' is needed - JSLint error

angularjs,jslint
I'm analyzing my AngularJS code with JSLint. Many times, I have function that have multiple argumets, eg: $rootScope.$on('$stateChangeSuccess', function (ev, toState, toParams, fromState, fromParams) { // code that uses toState, toParams, fromState, fromParams // but does touch use ev }) and many times I need to specify all arguments, because...

jslint4java external jslint options are ignored

drupal-7,jslint,jslint4java
I'm using phing-drupal-template and have problem with jslinting. When using an external jslint with the --jslint option neither --browser option nor inline options are recognized like /*jslint browser: true */ Any help would be much appreciated. thx. java -jar tools/jslint4java/jslint4java-2.0.5/jslint4java-2.0.5.jar --browser --predef "jQuery,$,Modernizr" ../sites/all/modules/custom/zendigital/js/frontpage.js java -jar tools/jslint4java/jslint4java-2.0.5/jslint4java-2.0.5.jar --jslint tools/jslint/fulljslint.js --browser...

JSLint error: “Expected a newline at EOF”, conflict with Beautify plugin

javascript,gruntjs,jslint,beautify
I have a problem while building the sources using Grunt, with JSLint task for error check: L177: Expected a newline at the end of the file. Warning: Formatting check failed. Use --force to continue. Aborted due to warnings. The problem is obvious, but I use also the Beautify plugin for...

JSlint: unexpected 'for' [duplicate]

javascript,jslint
This question already has an answer here: What does JSLint mean by 'Unexpected expression 'i' in statement position.'? 2 answers I have been testing with radio buttons. Everything seems okay until i ran it through JS lint. I fixed all errors except one: Unexpected 'for' for (i = 0;...

Validation error in JSlint

javascript,jslint
I am having some troubles. We had an assignment in the JavaScript class that I am taking to create a game of Hangman using module pattern. I have succeeded with making it function, however, my code does not pass the Jslint validation test. It keeps giving me one error and...

What does JSLint mean by 'Unexpected expression 'i' in statement position.'?

javascript,jslint
I have a for loop in JavaScript that I have run through JSLint a few times. In the past I received the unexpected++ error, I decided to refactor to make my code more readable. A month or so later JSLint came out with an update and is now showing the...

JSLint - Expected to see a statement but instead saw a block

javascript,code-formatting,jslint
I have just turned on 'JSLint' validation in Aptana Studio 3. In my web app, I have the following code: Sessions.getVars = function() { return $http.get(baseURL) .then(function(response) { return response.data; }, function(response) { /* TODO Error handling */ }); }; This is throwing the following error Expected to see a...

Check JavaScript for Unexpected Assignments

javascript,jslint
I have some JavaScript that I want to check to make sure I have no occurrences of using the assignment operator (=) as opposed to the equality operator (==). I've looked at JShint, JSLint, and the Google Closure Compiler. Unfortunately, no matter how I set the previous two tools, I...

How to run JSLint using bash? [closed]

javascript,bash,jslint
I am trying to setup JSLint on ubuntu and create script called jslint. I placed it at /usr/local/bin. So at any place I can run jslint somefile (in theory). I try to install jslint4java https://code.google.com/p/jslint4java/ my script has the following content: #!/bin/bash for jsfile in $@; do /usr/bin/java \ -jar...

JSLint - Undeclared 'jQuery' warning

javascript,jquery,jslint,jshint
I am trying to make the following jQuery code JSLint compliant. (function ($) { "use strict"; $('.addition').click(function () { $('.textbox:last,.addition:last,.subtraction:last,.replace:last').clone(true).appendTo('.replace:last'); $('.textbox:last').val(""); $('.addition:not(:last),.subtraction:not(:last)').attr('disabled','true'); }); $('.subtraction').click(function () { if($('.replace').length === 1) { $('.subtraction').click(function (event) { event.preventDefault(); }); } else {...

JSLint won't recognize getElementById

javascript,function,getelementbyid,jslint
JSLint gives errors with simple function, running on brackets with JSLint. Javascript: function soundSorry() { getElementById("player").play(); } Error codes: 2 Missing 'use strict' statement. getElementById("player").play(); 2 'getElementById' was used before it was defined. getElementById("player").play(); Any ideas?...

Why jshint alerts Read only on lastSelectedRow

javascript,jslint,jshint
Code below pasted to jshint.com site causes error Read only at line lastSelectedRow = 1; Why this error occurs and how to fix it? jslint does not thow this error. /*global lastSelectedRow */ function main() { lastSelectedRow = 1; return 'Hello, World!'; } main(); ...

ESLint: How to set .eslintrc to recognize 'require'?

javascript,intellij-idea,jslint,lint,eslint
I am new to ESLint, and I have successfully integrated ESLint with IntelliJ. Out of the box, my integration of ESLint did not recognize node, but basic review of documentation made clear that by creating the configuration file named .eslintrc at the root of my project folder (with the proper...

JSLint Error: Unexpected 'this'

javascript,constructor,jslint
Having trouble understanding why JSLint is surprised by my use of this in the following code: function testConstr (x) { 'use strict'; this.joker = "Whyyy sooo seriousss?"; this.x = x; } For both property assignments, JSLint says: Unexpected 'this'. How do I correct my code?...

How do I fix these JSLint errors?

javascript,jslint
I'm trying to fix some errors according to JSLint and there are some errors I can't get rid of: line 46 character 13 Missing 'new'. SortPosts(categories[categoryNumber].textContent); line 65 character 16 Unexpected '('. if (typeof (Storage) !== "undefined") { line 65 character 9Unexpected 'typeof'. Use '===' to compare directly with undefined....

JSLint for backwards for loops

javascript,jslint
Douglas Crockford, and thus, JSLint really dislike for loops. Most of the time I agree, and use [].forEach and Object.keys(obj) to iterate through arrays or dictionaries. However, there are cases where the built in functions are not better than a for loop in any reasonable sense (as far as I...