mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-22 11:16:12 +10:00
315 lines
7.3 KiB
Groff
315 lines
7.3 KiB
Groff
.\" Generated with Ronnjs 0.4.0
|
|
.\" http://github.com/kapouer/ronnjs
|
|
.
|
|
.TH "JSLINT" "1" "December 2013" "" ""
|
|
.
|
|
.SH "NAME"
|
|
\fBjslint\fR \-\- a code quality tool
|
|
.
|
|
.SH "SYNOPSIS"
|
|
jslint\.js [\-\-anon] [\-\-ass] [\-\-bitwise] [\-\-browser] [\-\-closure] [\-\-color] [\-\-continue] [\-\-debug] [\-\-devel] [\-\-edition] [\-\-eqeq] [\-\-es5] [\-\-evil] [\-\-forin] [\-\-indent] [\-\-json] [\-\-maxerr] [\-\-maxlen] [\-\-newcap] [\-\-node] [\-\-nomen] [\-\-on] [\-\-passfail] [\-\-plusplus] [\-\-predef] [\-\-properties] [\-\-regexp] [\-\-rhino] [\-\-sloppy] [\-\-stupid] [\-\-sub] [\-\-terse] [\-\-todo] [\-\-undef] [\-\-unparam] [\-\-vars] [\-\-white] [\-\-] <scriptfile>\.\.\.
|
|
.
|
|
.SH "DESCRIPTION"
|
|
JSLint is a static analysis tool to locate and correct style problems in Javascript (ECMAScript etc\.) source code\.
|
|
.
|
|
.SH "META OPTIONS"
|
|
\fB\-\-color\fR write output in color
|
|
.
|
|
.P
|
|
\fB\-\-terse\fR report one error per line with parseable source file/line
|
|
.
|
|
.P
|
|
\fB\-\-json\fR output in JSON format
|
|
.
|
|
.P
|
|
\fB\-\-edition\fR specify which edition of jslint to use
|
|
.
|
|
.SH "LINTING OPTIONS"
|
|
\fB\-\-ass\fR Tolerate assignment expressions
|
|
.
|
|
.P
|
|
\fB\-\-bitwise\fR Tolerate bitwise operators
|
|
.
|
|
.P
|
|
\fB\-\-browser\fR Assume a browser
|
|
.
|
|
.P
|
|
\fB\-\-closure\fR Tolerate Google Closure idioms
|
|
.
|
|
.P
|
|
\fB\-\-continue\fR Tolerate continue
|
|
.
|
|
.P
|
|
\fB\-\-debug\fR Tolerate debugger statements
|
|
.
|
|
.P
|
|
\fB\-\-devel\fR Assume console,alert, \.\.\.
|
|
.
|
|
.P
|
|
\fB\-\-eqeq\fR Tolerate == and !=
|
|
.
|
|
.P
|
|
\fB\-\-evil\fR Tolerate eval
|
|
.
|
|
.P
|
|
\fB\-\-forin\fR Tolerate unfiltered for in
|
|
.
|
|
.P
|
|
\fB\-\-indent\fR Strict white space indentation
|
|
.
|
|
.P
|
|
\fB\-\-maxerr\fR Maximum number of errors
|
|
.
|
|
.P
|
|
\fB\-\-maxlen\fR Maximum line length
|
|
.
|
|
.P
|
|
\fB\-\-newcap\fR Tolerate uncapitalized constructors
|
|
.
|
|
.P
|
|
\fB\-\-node\fR Assume Node\.js
|
|
.
|
|
.P
|
|
\fB\-\-nomen\fR Tolerate dangling underscore in identifiers
|
|
.
|
|
.P
|
|
\fB\-\-passfail\fR Stop on first error
|
|
.
|
|
.P
|
|
\fB\-\-plusplus\fR Tolerate ++ and \-\-
|
|
.
|
|
.P
|
|
\fB\-\-predef\fR Declare additional predefined globals
|
|
.
|
|
.P
|
|
\fB\-\-properties\fR Require all property names to be declared with /\fIproperties\fR/
|
|
.
|
|
.P
|
|
\fB\-\-regexp\fR Tolerate \. and [^\.\.\.]\. in /RegExp/
|
|
.
|
|
.P
|
|
\fB\-\-rhino\fR Assume Rhino
|
|
.
|
|
.P
|
|
\fB\-\-sloppy\fR Tolerate missing \'use strict\' pragma
|
|
.
|
|
.P
|
|
\fB\-\-stupid\fR Tolerate stupidity (typically, use of sync functions)
|
|
.
|
|
.P
|
|
\fB\-\-sub\fR Tolerate inefficient subscripting
|
|
.
|
|
.P
|
|
\fB\-\-todo\fR Tolerate TODO comments
|
|
.
|
|
.P
|
|
\fB\-\-unparam\fR Tolerate unused parameters
|
|
.
|
|
.P
|
|
\fB\-\-vars\fR Tolerate many var statements per function
|
|
.
|
|
.P
|
|
\fB\-\-white\fR Tolerate messy white space
|
|
.
|
|
.SH "DEPRECATED OPTIONS"
|
|
\fB\-\-anon\fR Tolerate no space in anonymous function definition
|
|
.
|
|
.P
|
|
\fB\-\-es5\fR Tolerate ECMAScript 5 syntax
|
|
.
|
|
.P
|
|
\fB\-\-undef\fR Tolerate variables used before declaration
|
|
.
|
|
.P
|
|
\fB\-\-on\fR Tolerate HTML event handlers
|
|
.
|
|
.P
|
|
\fB\-\-windows\fR Assume existence of Windows globals
|
|
.
|
|
.SH "EXAMPLES"
|
|
\fIMultiple files:\fR
|
|
.
|
|
.IP "" 4
|
|
.
|
|
.nf
|
|
jslint lib/color\.js lib/reporter\.js
|
|
.
|
|
.fi
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.P
|
|
\fIAll JSLint options supported\fR
|
|
.
|
|
.IP "" 4
|
|
.
|
|
.nf
|
|
jslint \-\-white \-\-vars \-\-regexp lib/color\.js
|
|
.
|
|
.fi
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.P
|
|
\fIDefaults to true, but you can specify false\fR
|
|
.
|
|
.IP "" 4
|
|
.
|
|
.nf
|
|
jslint \-\-bitwise false lib/color\.js
|
|
.
|
|
.fi
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.P
|
|
\fIPass arrays\fR
|
|
.
|
|
.IP "" 4
|
|
.
|
|
.nf
|
|
jslint \-\-predef $ \-\-predef Backbone lib/color\.js
|
|
.
|
|
.fi
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.P
|
|
\fIJSLint your entire project\fR
|
|
.
|
|
.IP "" 4
|
|
.
|
|
.nf
|
|
find \. \-name "*\.js" \-print0 | xargs \-0 jslint
|
|
.
|
|
.fi
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.P
|
|
\fIUsing JSLint with a config file\fR
|
|
.
|
|
.P
|
|
Start with the included example jslintrc file and customize your options per project
|
|
or copy it to $HOME/\.jslintrc to apply your setting globally
|
|
.
|
|
.SH "INSTALLATION"
|
|
To install jslint globally, use
|
|
npm install jslint \-g
|
|
.
|
|
.P
|
|
To install jslint locally, use
|
|
npm install jslint
|
|
.
|
|
.P
|
|
When installed locally, jslint can be run as
|
|
\./node_modules/\.bin/jslint
|
|
.
|
|
.SH "FILES"
|
|
jslint looks for the following config files at startup:
|
|
.
|
|
.P
|
|
$HOME/\.jslintrc
|
|
\./jslintrc
|
|
\./\.jslintrc
|
|
.
|
|
.P
|
|
The format of a jslint options file is a JSON file containing a single object
|
|
where the keys are jslint option names and the values are the option argument;
|
|
use \fBtrue\fR to enable and \fBfalse\fR to disable boolean options\. An example of a
|
|
valid option file is:
|
|
.
|
|
.P
|
|
{
|
|
vars: true,
|
|
white: true,
|
|
maxlen: 100,
|
|
predef: "foo,bar,baz"
|
|
}
|
|
.
|
|
.P
|
|
Comments are not allowed in option files\.
|
|
.
|
|
.SH "PRECEDENCE"
|
|
The order of precedence for options is as follows:
|
|
.
|
|
.IP "1" 4
|
|
in the $HOME/\.jslintrc
|
|
.
|
|
.IP "2" 4
|
|
in \./jslintrc or \./\.jslintrc
|
|
.
|
|
.IP "3" 4
|
|
on the command line
|
|
.
|
|
.IP "4" 4
|
|
in a /*jslint*/ comment
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.P
|
|
A higher number indicates a higher precedence, i\.e\. command line options
|
|
override options specified by an options file, and /*jslint*/ comments
|
|
in the file being examined have the highest precedence\.
|
|
.
|
|
.SH "EDITIONS"
|
|
You can now specify the edition of jslint with the \fI\-\-edition\fR option\.
|
|
.
|
|
.P
|
|
Future versions of this package may include newer editions of jslint;
|
|
to always use the latest edition of jslint, specify \-\-edition=latest:
|
|
.
|
|
.IP "" 4
|
|
.
|
|
.nf
|
|
jslint \-\-edition=latest lib/*\.js
|
|
.
|
|
.fi
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.P
|
|
The default edition of jslint will remain stable as long as the leading
|
|
two components of the version number are the same\. New minor editions
|
|
may have a different default edition\.
|
|
.
|
|
.P
|
|
The previous version of this package (0\.1\.9) shipped an older edition
|
|
(2013\-02\-03) of jslint\. To revert to that behavior but still have the
|
|
new config file features, upgrade to 0\.2\.1 of this package and specify \fBedition: \'2012\-02\-03\'\fR in your jslintrc file or \fB\-\-edition=2013\-02\-03\fR
|
|
on the command line\.
|
|
.
|
|
.P
|
|
We recommend the following practices:
|
|
.
|
|
.SS "If your project is in maintenance mode"
|
|
Choose an edition of jslint and hardcode it into your project\'s lint config files, e\.g\., \fBedition: \'2012\-02\-03\'\fR\|\. Specify a fixed version of jslint (e\.g\., "0\.2\.1") as a
|
|
devDependency in package\.json
|
|
.
|
|
.SS "If your project needs temporary stability (e\.g\., release phase)"
|
|
Use the default edition of jslint (no \fB\-\-edition\fR argument needed) and specify
|
|
a fixed minor version (e\.g, "~0\.2") as a devDependency in package\.json
|
|
.
|
|
.SS "If you want the bleeding\-edge version"
|
|
Specify \fBedition: \'latest\'\fR and use any \'latest version\' behavior in package\.json,
|
|
e\.g\., "*" or ">0\.2\.1"
|
|
.
|
|
.SH "RETURN VALUES"
|
|
jslint returns 1 if it found any problems, 0 otherwise\.
|
|
.
|
|
.SH "AUTHOR"
|
|
jslint is written and maintained by Douglas Crockford \fIhttps://github\.com/douglascrockford/JSLint\fR
|
|
.
|
|
.P
|
|
This package is node\-jslint, which provides a command\-line interface for
|
|
running jslint using the nodejs platform\. node\-jslint was written by Reid Burke
|
|
and is maintained by Reid Burke, Ryuichi Okumura, and Sam Mikes\.
|
|
.
|
|
.SH "BUGS"
|
|
There are no known bugs\. Submit bugs to \fIhttps://github\.com/reid/node\-jslint/issues\fR
|
|
.
|
|
.P
|
|
Note that if you are reporting a problem with the way jslint works rather than the way
|
|
the command\-line tools work, we will probably refer you to the JSLint community \fIhttps://plus\.google\.com/communities/104441363299760713736\fR or the issue tracker at
|
|
\fIhttps://github\.com/douglascrockford/JSLint/issues\fR
|