JSLint′
A fork with some bad partsOne of the few tools that I consider truly indispensable when developing websites is JSLint. Too bad it’s almost impossible to contribute back to the project, and that the project’s run by someone who “will hurt your feelings.”
Instead of complaining too much, I forked the official project and started adding in some bugfixes and additions that I find useful (which generally seem to focus on the CSS parser). Periodically, I merge the current trunk into my branch in the hopes that Crockford might, someday, do the reverse. We’ll see.
Each change that I make to Crockford’s official JSLint is backed up with QUnit
tests. You’ll find them in the /test
directory of the project.
If you use JSLint Utils, I’d recommend hopping into the project’s
lib/vendor
directory, and running make fork
. That’ll drop the official
JSLint, and bring you up to date with the latest version of JSLint′. It’s
awesome.
JSLint has an official GitHub presence! Excellent! I’ve reworked this
repository entirely so that it’s based on the official repository, which
means that the mirror
branch has been dropped entirely, and that all
the SHA1 IDs have changed. If you’ve forked this repository, or stored
it locally for any reason at all, you’ll run into problems. Please
reclone and start over.
It’s inconvenient, I know, but this will make it much simpler to keep in step with changes in the official repo.
Updating to the official 2010-10-06 release.
Backing out my url(...)
fix in favour of the official fix in the
aforementioned release.
Fixing a bug in yesterday’s fix for font shorthand syntax. The line-height doesn’t have to be specified. It can be inherited.
Fixing support for url(/path/to/image.jpg)
in background
shorthand
syntax. The following should pass linting now, when the css
option
is set:
div {
background: url(/path/to/image.jpg);
}
In the current JSLint trunk, it throws a JavaScript error. That’s bad.
Updated to the official JSLint version from 2010-10-01.
Fixed simple font
shorthand syntax. The following should pass
linting now, when the css
flag is set:
p {
font: 12px/1 Helvetica;
}
In trunk, it throws an error when it hits the /
, which cascades
into errors for the line-height and font-family.
Added last-child
as an acceptable pseudoclass. The following
should pass linting now, when the CSS flag is set:
p:last-child {}
In trunk, it throws an error, claiming that last-child
isn’t a
pseudoclass.
Updated to version of JSLint from 2010-09-08.
Adding an args
option to support the arguments.callee
and
arguments.caller
properties that I use quite often.
Updated to version of JSLint from 2010-04-06
Added support for #RRGGBBAA
style hex colours for alpha support via
IE’s filter
attribute. The following should pass linting now, when
the css
option is set:
.myclass {
filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr=#FFFFFF50,EndColorStr=#FFFFFF50);
}
In the current JSLint trunk, it throws a “Bad hex value” warning.
Added support for CSS3’s ::
selector to designate pseudo-elements.
The following should pass linting now, when the css
option is set:
.myclass::first-line {
color: red;
}
In the current JSLint trunk, it throws a “Expected pseudo, found ‘:first-line’ warning.
Added support for vendor-specific prefixes in pseudo-selectors. The
following should pass linting now, when the css
option is set:
input::-moz-focus-inner {
padding: 0;
}
This is especially important, given Gecko’s tendency to add 3px of
padding to input elements that can only be removed via manipulation
of input::-moz-focus-inner
, but was rejected when
submitted to the list.