]>
git.proxmox.com Git - pve-jslint.git/blob - rhino.js
2 var e
, i
, input
, filename
, defaults
;
4 print("Usage: jslint.js file.js ...");
9 predef
: ['Ext', 'PVE', 'PMG', 'PVE_vnc_console_event', 'FormData', 'gettext'],
11 'continue': true, /// Allow continue statement
12 bitwise
: true, // Allow bitwise operators
13 browser
: true, // Assume a browser
14 css
: true, // Tolerate CSS workarounds
15 eqeq
: true, // Allow `==` && `!=`
16 //immed: true, // Immediate invocations must be wrapped in parens.
17 //nomen: true, // Allow dangling `_` in identifiers
18 newcap
: false, // Require initial caps for constructors
19 vars
: true, // Allow multiple `var` statements.
20 plusplus
: true, // Allow `++` and `--`
21 regexp
: true, // Allow `.` and `[^...]` in regex
22 sloppy
: true, // Don't require `use strict;`
23 undef
: false, // Disallow undeclared variables
24 white
: true // Don't apply strict whitespace rules
27 for (i
= 0; i
< a
.length
; ++i
) {
29 input
= readFile( filename
);
31 print("jslint: Couldn't open file '" + filename
+ "'.");
35 if (!JSLINT(input
, defaults
)) {
36 for (i
= 0; i
< JSLINT
.errors
.length
; i
+= 1) {
39 print('[' + filename
+ '] Lint at line ' + e
.line
+ ' character ' +
40 e
.character
+ ': ' + e
.reason
);
41 print((e
.evidence
|| '').
42 replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
48 print("jslint: " + filename
+ " OK");