jamesallardice / jslint-error-explanations Goto Github PK
View Code? Open in Web Editor NEW:memo: Explanations of all the (sometimes cryptic) error messages thrown by JSLint and JSHint
Home Page: http://linterrors.com
:memo: Explanations of all the (sometimes cryptic) error messages thrown by JSLint and JSHint
Home Page: http://linterrors.com
The use of GitHub pages for hosting the built version of the site is quickly becoming a point of failure when it comes to new features, mainly due to the lack of Jekyll plugin support.
Here are a couple of the features I would like to implement:
/es5
will redirect to a bucket page linking to all related errors, and /asi
will link directly to the related message since it only relates to a single message)Actually the current error page delivered by Cloudflare is confusing. It does not only look ugly, but I really thought this would be such a usual error message by Cloudflare saying the webserver is down. But actually, it is not!
So you could prevent such confusing by creating a real 404 error page.
Hi, first thanks for this site.
Here's how this happened:
code with the error:
(function () {
"use strict";
var array = [1, 2, 3];
if (!!array.indexOf(2)) {
console.dir('in array');
}
}());
After running jslint spits this error:
1 Weird condition.
if (!!array.indexOf(2)) { // Line 6, Pos 22
Changing the code to this fix it:
(function () {
"use strict";
var
array = [1, 2, 3],
test = array.indexOf(2);
if (!!test) {
console.dir('in array');
}
}());
Could you make a page about this I still don't know why using the first is a bad practice, or is't just a false error.
Thanks in advance.
Explain JSLint "Unexpected assignment expression."
Tolerate assignment expressions: true
if assignment should be allowed outside of statement position
ass: true
, if assignment expressions should be allowed
Example:
(function (console, window, HTMLElement) {
"use strict";
var children = [];
var document = window.document;
var element = document.body;
while ((element = element.firstElementChild) instanceof HTMLElement) {
children.push(element);
}
console.log(children);
}(this.console, this, this.HTMLElement));
When invoking the API's /lint request endpoint, I seem to be always getting a 400 error saying:
"Missing parameter: code"
This is despite providing the "code" or "c" as a parameter in a json body to the url as POST or GET request to: http://api.jslinterrors.com/lint and providing "application/json" as the "Content-type" in the header.
{ "c": "var b = 1;" }
OR
{ "code": "var b = 1;" }
JSLint has an experimental feature to lint CSS files. This mostly covers checking for whitespace-related matters but does also cover some CSS-specific issues that are wholly not relevant to JavaScript.
The list of pages needed includes all errors that could potentially be raised by JSLint, including some that are not relevant to the linting of JavaScript.
As jslinterrors.com is "designed to help you improve your JavaScript", should the focus of the site be purely on JavaScript-related improvement and if so should the CSS-only errors be removed from the list of pages needed?
I suppose this question could be generalised as: should the site cover all possible errors that can be raised by JSLint (and JSHint), or should the site instead focus only on the subset of errors that relate to JavaScript?
Expected 'while' to be in a function.
while ((pin < 1000) || (pin > 9999)) {
var json = {"content": "\u003c"};
causes the error: "Unexpected ''."
as does:
{"content": "\u003c"}
which also gives a "bad json" warning.
http://lint-explain.herokuapp.com/strings-must-use-singlequote/ (identifier W109) doesn't mention the configuration option "allow-avoiding-escaped-quotes", or contain a link to further documentation about quotmark. Is that normal for jslint-error-explanations?
would be nice to link to jslinterrors.com/asi
rather than jaslinterrors.com/missing-semicolon-error
The article is question: http://jslinterrors.com/move-the-invocation-into-the-parens-that-contain-the-function/
In this sentence in the second paragraph:
This error is raised to highlight a lack of convention. Your code will not run without error if you do not change it, but your code may be confusing to others.
Shouldn't that read:
This error is raised to highlight a lack of convention. Your code will
notrun without error if you do not change it, but your code may be confusing to others.
It is unclear about which error (jsHint or the JS interpreter) this 'without error' is referring too.
Hello,
first of all I want to say that I am really grateful for both JSLint and JSLintErrors projects.
I have a question regarding this classical idiom from the C language:
for (i = 0; i < someArray.length; i++) {
// do something
}
The JSLint gives me the following error and the reason is not clear to me.
Unexpected '++'.
Why does the JSLint tool discourage the usage of the ++ operator?
The error I am getting is Unexpected '.'.
Can't figure out how to get JSLint to let me do this but everywhere I am told to wrap my files in this (function () { ... }).call(this)
and that will pass along the window
to the function, but JSLint wants (function () { ... }()).call(this)
. The problem with the way JSLint wants it done this
isn't passed through to the function's this. I don't know if there is a setting to prevent JSLint from caring about the }())
and let me just use the call method.
It is a linter for TypeScript, which is as you know a superset of vanilla JS so has most of the same errors (if not more). We meet good-ol' eqeqeq
, evil
, curly
etc.
As of now still early in the project, could be cool later on.
JSLint:
Unexpected 'typeof'. Use '===' to compare directly with undefined.
Debatable message. undefined is not real keyword and can be easily reassigned. Shouldn't I compare with typeof instead?
the website http://jslinterrors.com/ is not available...
the same for https://jamesallardice.github.com/jslint-error-explanations/
If there is a variable in the error message which is longer than two character, you'll get a Not Found error.
http://api.jslinterrors.com/explain?message=%27ab%27%20is%20not%20defined. - Works
http://api.jslinterrors.com/explain?message=%27abc%27%20is%20not%20defined. - Doesn't work
http://cl.ly/image/1q2L232u3537
I think the screenshot and issue title can speak for themselves :)
Any thoughts on that?
Thanks a lot :)
From https://github.com/jamesallardice/jslint-error-explanations:
๐ Explanations of all the (sometimes cryptic) error messages thrown by JSLint and JSHint http://jslinterrors.com
Should be changed to:
๐ Explanations of all the (sometimes cryptic) error messages thrown by JSLint and JSHint http://linterrors.com/
When converting a string like '9.59' to a number I have always used the syntax:
var a = '9.59';
a = a * 1;
JSLint seems to find this method odd and destructive. I thought my method was fairly standard and straight forward. It also happens to be the fastest to execute vs any other method like parseInt or parseFloat or Math.floor
My suggestion is about adding the kind of directives that would suppress some of the errors - for example, setting /*jslint plusplus: true */
to allow the usage of ++
without getting errors back from JSLint.
I'm thinking for each error -- include a section like "If you don't want to see this JSLint Error" to explain how to suppress, and explanations of the pros and cons of doing so.
The search doesn't seem to find all errors. Also it should be possible to search by code e.g. W014
Hello,
I love this site but I noticed that it lacks an explanation for Bad assignment
and how to disable it.
The error is raised in cases like this
callAFunction() = 12;
Thanks
I have this error with JSLint: W040 - Possible strict violation.
But i couldn't find an article about this error on the website.
This error happened when you use the strict mode and you want to call a function (to have a private method for example).
For example:
function Foo() {
this.toto = 42;
bar.call(this);
}
function bar() {
console.log(this.toto);
}
JSLint provides an error of 'Wrap the parameter in parens.' in some instances. I am having trouble figuring out what the cause of this error is and would appreciate it being included in this project. Sample of the code that produced this error. (The ellipsis marks where the code continues but I've left it out as unnecessary.) The error is triggered on the line, '.on("data", chunk => {'.
response
.on("data", chunk => {
responseBody += chunk;
})
.on("end", chunk => { ...
console.info('Hello world');
Explanation can be found here.
I think there is one more step between forking the repository and jekyll, that is checking out 'gh-pages' branch(or other branch, I am not sure which one). because when we fork the repository, the default branch of the repository is master, and what we get after we jekyll on master branch is not a web site. my problem is that I am not sure which branch to check out before I jekyll.
I see that it gets mentioned below errors but the link provided is a long page of documentation with no hint on how this "special" option syntax works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.