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