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
1,002
questions
0
votes
1
answer
55
views
can anyone help me with this error i got in my script while makinga a hamburger menu on a websit
code:
let bar = document.querySelector('.bars'),
navItem = document.querySelector('.nav-items');
bar.addEventListener('click', () => {
navItem.classList.toggle('active');
})
issue:
JsLint:
...
0
votes
0
answers
31
views
I am getting a JSLint insecure exception error when trying to validate a password in JavaScript [duplicate]
while trying to validate the password with regular expression in the .js file I am getting the error as Run JSLint (if jslint.scan.dir=/src/...) Failed
this happens while building the application
got ...
1
vote
1
answer
57
views
Import a .js file into another (JSLINT doesn't recognize the "Import" key word)
I am trying to import a .js file into antoher.js file. JSLint is throwing errors and doesn't seem to recognize the "import" statement
import "./Scripts/dompurify/purify.min.js";
...
0
votes
1
answer
44
views
JSlint warning "Move variable declaration to top of function or script."
I don't know why there is a warning of "Move variable declaration to top of function or script."
Although I move the variable "myName" to other places, the variable below will be ...
-1
votes
1
answer
343
views
Wrap a ternary expression in parens, with a line break after the left paren [closed]
jslint is telling me to do this:
Wrap a ternary expression in parens, with a line break after the left paren.
To this line:
"wrapper": (index < allWrappers.length) ? allWrappers[index] :...
0
votes
1
answer
113
views
Expected an identifier and instead saw '0'
How would this jslint error be fixed in here? https://jsfiddle.net/cfv2g1ho/
[JSLint was unable to finish] Expected an identifier and instead saw
'0'.
function onYouTubeIframeAPIReady() {
let ...
-2
votes
1
answer
696
views
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 && ...
2
votes
0
answers
266
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
8k
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
99
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
265
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
151
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
150
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
52
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
217
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
...
0
votes
1
answer
170
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 '`'
2
votes
2
answers
169
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 ...
1
vote
1
answer
2k
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
42
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
132
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
515
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
77
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
470
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
224
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
120
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='...
2
votes
1
answer
353
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
558
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
2k
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 ...
3
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
205
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
64
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
143
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
103
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
41
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
281
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
67
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
1k
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
79
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
632
views
Why jslint is not working with npm package
I installed :
npm i jslint
[email protected] 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
2k
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
584
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
5k
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
173
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
95
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
815
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
vote
1
answer
640
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
10k
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
174
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
401
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 ...