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.
992
questions
0
votes
0answers
17 views
Get Default Export in JavaScriptCore
Goal: I'm trying to run JSLint in JavaScriptCore.
Old Version
Older JSLint releases exposed a global function named JSLINT like this:
var JSLINT = (function () {
...
}
This was easy to retrieve ...
0
votes
1answer
25 views
ESLint not defined / is assigned a value but not used
I'm loading a couple of external JS files and keep getting errors in CodeKit/LSLint (and JSHint) - even though both scripts appear to work as intended when viewing in browser
All my JS files are ...
3
votes
1answer
33 views
How to search nested object by following JSLint
I have my object structured as below and I want to find the product with provided ID.
0 :{
id: 0,
title: 'xxxx',
url: "www.test.com"
quantity: 100
},
1 :{
id: 10,
title: '...
1
vote
1answer
34 views
Receiving a JSLint error from trying to import my 'aws-amplify' package into my entry point
The most recent version of aws-amplify was installed with npm. Additionally, npm init was run with the entrypoint file being 'entryPoint.js'. However, when I enter entryPoint.js and paste these lines ...
1
vote
1answer
106 views
How to fix jshint error Expected '(' before '('. (expected_a_before_b)
Here is javascript code
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('https://www....
0
votes
1answer
52 views
Are there any tools to detect/avoid IE proprietary syntax from my JavaScript code? [closed]
I learnt that the JavaScript syntax document.<a_form_name> is IE proprietary syntax (instead of document.forms.<a_form_name>). (reference: https://developer.mozilla.org/en-US/docs/Archive/...
0
votes
1answer
128 views
I'm getting many errors like “Expected 'use strict' at column 4, not column 2.” What does this mean?
I'm assuming since it mentions columns that it's off based off of there being a difference in spaces of the open and closed tags. How do I fix these though? It seems like the few I solve, the more pop ...
-2
votes
1answer
206 views
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 +...
2
votes
3answers
94 views
JSLint Warning about Ajax data
The following is a snippet of my JS:
$("#submit-email").click(function () {
var first_name = $("input[name='first_name']").val();
var last_name = $("input[name='...
1
vote
1answer
129 views
Why is JSLint warning me about my switch-case statement being incorrectly formatted?
In Adobe Brackets, I am getting warnings from JSLint when writing strict code ['use strict'] that my switch case statement is incorrectly formatted:
eg. Expected 'case' at column #, not column #
If I ...
0
votes
0answers
101 views
Getting Expected '/' and instead saw ''
I am using VS Code Editor with JShint and JShint is showing a warning in second div <div> some text </div>. It doesnot show any warnings if I give <div> some text <div/>. The ...
0
votes
1answer
759 views
Getting the error “Wrap the parameter in parens” from JSLint, why?
After executing JSLint I'm getting the following message:
Wrap the parameter in parens.
1 Expected '(' before 'info'. const valueArr = (info => { // Line 6,
Pos 19
I've read the Lint paren ...
2
votes
2answers
1k views
property does not exists on type Object from subscribe
Im using a forkJoin to do multiple http calls but it give me the error error TS2339: Property 'data' does not exist on type 'Object'
forkJoin(this.userservice.getUser(), this.userservice....
2
votes
1answer
29 views
JSLint: was used before it was defined in anonymous function
JSLint warns on variable in anomymous function
db.collection('users').doc(docId).set(userData).then(ref => {
console.log(ref)
})
Warning in first line: 'ref' was used before it was defined.
...
0
votes
0answers
39 views
Integrate Linter(JSLint\ESLint) to Google V8 Script compilation
I wrote an application that using Google V8 engine.
And I want to introduce printing warning messages in script compilation output.
There is no problem to load linter .js file, compile it and run ...
0
votes
1answer
31 views
JSLint line break format
I really can't understand how JSLint would like me to format this script:
(function ($) {
"use strict";
window.isMobileDevice = function () {
return (window.orientation !== undefined)...
2
votes
1answer
54 views
jsLint weird assignment error when casting
I use google-closure compiler and jsLint tool for my JS code. Because closure compiler looks at JSDoc tags I need to cast variable to proper type or otherwise compiler will throw errors. Code below ...
1
vote
1answer
35 views
Why do this function get a warning message from JSLint?
I have a function that's working perfectly fine, but I still get a warning message from JS Lint.
function undoActionClick() {
if (history.length <= 1) return;
...
1
vote
2answers
146 views
Batch with tslint command : error “Input line is too long”
I write this command on several lines using the character ^ but this command is considered to be on a single line .
When the file starts to contain a certain number of characters it causes an error.
...
0
votes
1answer
33 views
batch tslint on several lines
I launch a batch that contains a tslint command
tslint -c ../tslint.json --project tsconfig.json --out output.txt --format msbuild -e '**/bin/Debug/**' -e '**/fonts/**' -e '**/images/**' -e '**/...
1
vote
1answer
440 views
JSLint and assigning values with ternary expressions
This is only an example, however with the below assignment using ternary expression, I can't get it to pass the JSLint test.
Neither can I get it to ignore it.
var size = settings.size ? settings....
0
votes
0answers
40 views
How to fix Unexpected':'. in JSLint problem? [duplicate]
i have just learned labels in JS for loops.
it works correctly but with that warning.
Unexpected':'. mainLoop://label
var count = 0;
mainLoop: //label
for (i = 0; i < 5; i++) {
...
1
vote
2answers
61 views
How can I write these functions to use a forEach() statement?
How can write these (working) functions using forEach() methods:
function loadAudioMeterHistory(cell) {
var peaks = new Array(4);
for (var i = 0; i < peaks.length; i++) {
var peak,...
0
votes
2answers
235 views
Why jslint is not working with npm package
I installed :
npm i jslint
jslint@0.12.1 updated 1 package and audited 6594 packages in 5.791s found 53 vulnerabilities (15 low, 16 moderate, 22 high)
I have made some configurations :
./...
1
vote
1answer
3k views
JSLint and ESLint Problems (Brackets)
I am creating a mock website for a small project that I am doing. I am using nunjucks to perform some tasks. When I try to create a .js file that I can run later, I am getting errors.
I have looked ...
1
vote
1answer
554 views
Shadowing of global property 'undefined'
Can anyone give me some pointers on fixing a warning I'm getting with JSLint.
I have the following code:
/* global window, define, module */
(function(global, factory) {
var Gauge = factory(...
2
votes
0answers
241 views
turn off “use spaces, do not use tabs” in a jslint extension for VSCode
I got a VSCode JSLint extension and I got its settings pointing to an .eslintrc file where I have the following specified for indentation:
{
...
"indent" : [1, "tab"]
...
}
The problem ...
8
votes
3answers
3k views
How to fix this warning 'var' used instead of 'let' or 'const' JsLint in phpStrom?
I want to fix this in the code file not in jslint setting options. The JS file is in PHP project. How can I remove the warning from here?
-2
votes
1answer
92 views
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 ...
0
votes
1answer
47 views
How to find specific errors using jslint and violation plugins in jenkins?
My requirement is that to check for a specific error is existing on javascript file or not, if it exists makes the job fail otherwise build it successfully.
How can I check for a specific error in ...
0
votes
1answer
258 views
Move 'var' declarations to the top of the function - Javascript error
I'm following a tutorial on how to create dynamically updating comments within a form. The guide I'm following keeps presenting errors and the one I have just recently found is not letting me fix it. ...
-1
votes
2answers
447 views
Expected an identifier and instead saw '…'
This error is coming up in jslint, how would I fix this line?
const {
width,
height,
...options
} = opts;
Full Code:
https://jsfiddle.net/zt7anuL3/18/
Section of the code where the ...
1
vote
1answer
424 views
What's the difference between an ESLInt plugin and an ESLInt rule? To create a customized rule, do we have to create our own plugin first?
Could someone explain the difference between an ESLInt plugin and an ESLInt rule. I did my research on https://eslint.org/docs/developer-guide/working-with-plugins#working-with-plugins and it seems ...
1
vote
2answers
4k views
How to fix this regex to remove JSLint Unnecessary escape warning?
I'm getting a url then stripping the domain with an onClick handler in React using a regEx like this :
const path = e.target.closest('a');
if (!path) return;
e.preventDefault();
console.log('path: ',...
0
votes
5answers
107 views
Why is an If statement considered a function in this loop?
I have been building a React app that uses iteration a lot. I am using JSLint and get the annoying warning saying:
Don't make functions within a loop
On the following loop:
if(currentSearch[i]....
1
vote
1answer
374 views
Remove scsslint_tmp files generating automatically?
I am using WebStorm with JSLint, JSHint and some files are generating automatically in the same source directory with filename_scsslint_tmpXXXXXXX.
Can anyone please tell me how can remove this ...
0
votes
0answers
31 views
JSLint: SyntaxError: invalid quantifier {
on this line of code:
var regex = /{{([^}]+?)}}/g;
// ----------^
JSLint show an error:
SyntaxError: invalid quantifier {
the regex works
var regex = /{{([^}]+?)}}/g;
var string = "bla bla ...
0
votes
1answer
181 views
JSLint ES6 window in not defined
I am using latest JSLint and getting JSLint to complain about the window is not defined. With es6 JSLint directive globals are not allowed.
/*jslint es6*/
import AppConst from "@/constants/app....
6
votes
2answers
179 views
Why using a source tag inside an audio tag prevents the loadeddata event from firing?
For better accessibility we needed a second alternative set of play/pause controls and (with the help of user Kento Nishi) we successfully moved from DEMO A (with only 1 audio playback control) to ...
0
votes
1answer
454 views
JSLint “This function needs a ”use strict“ pragma.”
Anyone know the cause of the "This function needs a "use strict" pragma." errors i get when JSLinting this code? I could fix this by adding "use strict"; to all of my functions, but i'd rather know ...
2
votes
0answers
187 views
Configuring eslint and jslint to not give errors with reserved react-native keywords like [import,export]
I am very new to react native. I decided to learn on brackets text editor but when I opened the default template in app.js file, eslint and jslint complain about reserved keywords like import and ...
0
votes
1answer
38 views
Trying to Run Grunt But Getting Errors and not sure how to fix them
I'm currently reading a book on Learning to Program by Steven Foote. The book is currently talking about automation and is detailing how to use grunt.
I just installed grunt using npm install -g ...
0
votes
1answer
129 views
JSLint : Unexpected ']' in array of object
I'm using JSLint in PHPStorm with ES6 and I have this error after the line : pathPublic + "/css/style.css",
JSLint: Unexpected ']'.
My code :
let filesCss = [
{
outputFilename: "...
0
votes
1answer
43 views
JavaScript For Loop with Closure Causing JSLint Warning
I have a JavaScript script that I am writing that uses a for loop to assign onclick events to a series of buttons. To fix issues with the scope of i, I am using the following example as the base of my ...
2
votes
2answers
75 views
Warning not to make function within a loop
I've written a code to create modal windows for div container. Once the button is clicked, I get the button's number and display a related modal window. Tested, works on all browsers.
...
0
votes
3answers
70 views
JSLint warning: `Expected ':' and instead saw '='
I have a go to top button that appears when user has scrolled down on the page. The button works as intended but in JLint, it gives a warning: Expected ':' and instead saw '='. How do I correct the ...
0
votes
2answers
42 views
Assignments in the condition part of if and while statements
Here is quote by Crockford:
Assignment Expressions
Avoid doing assignments in the condition part of if and while statements.
Is
if (a = b) {
a correct statement? Or was
if (a == b)...
-1
votes
1answer
528 views
Disabling all jslint rules with Inline Comments
/* eslint-disable */ is the inline comment that disables/ignores all the eslint rules in a js file. Similarly is there any way to disable all jslint rules with inline comment within a js file?
1
vote
3answers
741 views
Can I disable jslint's 'empty block' warning in Brackets?
I created the following isqrt function.
function isqrt(n) {
var shift, result, candidateResult;
if (n < 0) {
return false;
}
for (shift = 2; n >> shift; shift += 2) {}...
0
votes
0answers
96 views
JSlint ignoring globals set inside .jshintrc file - used in intellij
I am trying to use jshint and jslint.I am using custom .jshintrc file and add few of my global variables and functions into globals inside .jshintrc as below.
{
// Environments
"browser" : ...