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.
1,001
questions
2
votes
0
answers
23
views
JavaScript Code Linting tool to find Variables which are initialised but might not be used due to condition
I have the following JavaScript code,
var foo = {
company: "ABC",
name: "John"
};
var att = "";
function test(ob, i) {
var m = JSON.stringify(ob);
if (i ...
1
vote
1
answer
68
views
How to pass "parameter" to react component
I have a quick question, I am attempting to refactor my code in a existing codebase, this codebase uses a render function, however I would like to replace this with a react functional component ...
0
votes
1
answer
37
views
JSLint Character Unexpected '.'
Atoms's JSLint report is complaining about an unexpected dot of the .toFixed function:
subTotal = (Math.round(subTotal * 100) / 100).toFixed(2);
at line 113, character 50 Unexpected '.'
The code ...
1
vote
1
answer
101
views
Detect old Internet explorer Javascript functions ( < ES6)
There is a web online, library or something to detect old IE functions that are not compatible with Chrome/Firefox or just ES6?
Like: document.all, event.returnValue, etc
JsHint/Jslint are not ...
1
vote
1
answer
66
views
Is there an indent option for jslint or has it been removed?
The indent option appears to not be recognized any more.
http://linterrors.com/js/option-indent
Is this still an option for jslint or has it been removed?
I've tried setting it using the web interface ...
0
votes
1
answer
42
views
How to run jslint command on all files with in a directory in cmd (context npm)
https://chromium.googlesource.com/external/github.com/reid/node-jslint/+/pulls-2013-11-03/doc/jslint.md
the above link is a the documentation on jslint. I am trying to run the jslint command on all ...
0
votes
2
answers
44
views
What is the proper way to call another function from a function within the same object that will pass jslint?
What is the proper way to call another function from a function within the same object that will pass jslint?
Any information would be greatly appreciated!
Simple example for illustration purposes:
...
1
vote
1
answer
125
views
Parsing error: Unexpected token stripe? slint
When I replace functions.auth.user().onCreate(async (user) => { with functions.https.onRequest((req, res) => { I end up getting the following error:
Parsing error: Unexpected token stripeslint
...
-1
votes
1
answer
50
views
What is the correct way to declare the e variable in a catch clause [closed]
When I don't declare the variable which catch uses to store the error, JSHint gives me the following error
function foo (){
try{
let a = 0/0;
} catch (e){
console.log (e);
}...
0
votes
1
answer
64
views
Why does jslint complain Unexpected '`' on template strings
I am using JSLint with syntastic in Vim and when I have a simple .js file like so
var a = 99;
var b = `I am ${a} years old`;
Why does Syntastic (and thus jslint) give me this error
Unexpected '`'
1
vote
2
answers
69
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
1
answer
297
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
1
answer
39
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
1
answer
86
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
1
answer
346
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
1
answer
68
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
1
answer
253
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
1
answer
215
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
3
answers
111
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
1
answer
219
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
0
answers
233
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 ...
1
vote
1
answer
1k
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
2
answers
2k
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
1
answer
70
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
0
answers
53
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
1
answer
63
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
1
answer
80
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
1
answer
37
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
2
answers
220
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
1
answer
45
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
1
answer
816
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....
1
vote
2
answers
71
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
2
answers
428
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
1
answer
4k
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
1
answer
1k
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(...
7
votes
1
answer
392
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
3
answers
4k
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
1
answer
125
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
1
answer
56
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
1
answer
509
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
2
answers
864
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
1
answer
577
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 ...
2
votes
2
answers
8k
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
5
answers
125
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
1
answer
391
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
0
answers
58
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
1
answer
257
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
2
answers
223
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
1
answer
510
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
0
answers
231
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 ...