JSLINT (JavaScript Lint)

  • Thread starter Douglas Crockford
  • Start date
D

Douglas Crockford

JSLINT now includes a list of member names in its report, along with the
number of occurences of each member name. This is intended to make it
easier to find misspellings.

JSLINT takes a JavaScript source and scans it. If it finds a problem, it
returns a message describing the problem and an approximate location
within the source. The problem is not necessarily an error, although it
often is. JSLINT looks at some style conventions as well as structural
problems. It does not prove that your program is correct. It just
provides another set of eyes to help spot problems.

JSLINT defines a professional subset of JavaScript, a stricter language
than that defined by Edition 3 of the ECMAScript Language Specification.

http://www.crockford.com/javascript/lint.html
 
U

Ulrik Skovenborg

Douglas said:
JSLINT now includes a list of member names in its report, along with the
number of occurences of each member name. This is intended to make it
easier to find misspellings.

This may (or should) be a new question but when I used your JSLINT
(which is quite a nice tool) it said that the post-increment operator
was not allowed in my for-loop:
(i=0;i<something.length;i++) {
When I read your documentation it said that this was some kind of
security issue - but how is that? I never really thought that this
operator was considered bad coding or anything - merely a little quick
shortcut. Or is it just me?

Skovenborg
 
D

Douglas Crockford

JSLINT now includes a list of member names in its report, along with
This may (or should) be a new question but when I used your JSLINT
(which is quite a nice tool) it said that the post-increment operator
was not allowed in my for-loop:
for ( i = 0; i < something.length; i++) {
When I read your documentation it said that this was some kind of
security issue - but how is that? I never really thought that this
operator was considered bad coding or anything - merely a little quick
shortcut. Or is it just me?

The i++ tends to be misused. Most of the buffer overrun bugs that
Microsoft has been purging from its code base used i++. The ++i is less
prone to misuse. I like the i += 1 even better. JSLINT looks for errors,
but it also looks for bad practices that are known to be error prone.

http://www.crockford.com/javascript/lint.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top