-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathjshint.node_cli.txt
165 lines (151 loc) · 10.1 KB
/
jshint.node_cli.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
┏━━━━━━━━━━━━┓
┃ JSHINT ┃
┗━━━━━━━━━━━━┛
ALTERNATIVES ==> #See eslint
VERSION ==> #2.9.5
jshint FILE|DIR #Prints lint problems for JavaScript
#FILE can be - for stdin
#Configuration can be done:
# - using a JSON config file specified with:
# - --config FILE
# - package.json jshintConfig OBJ property
# - .jshintrc file (for current directory and all below, unless there is another one below)
# - as a comment, e.g. /* jshint OPTION: VAL[, OPTION2: VAL2]... */
# - /* */ not //
# - If in a function, is for this function. If not, is for whole file.
# - some options can only be used as comments
#Warnings vs errors
# - depends on reporter, e.g. color
# - both exit code 2
# - --show-non-errors show warnings/errors toggled off
--extra-ext STR,... #Check others that ".js"
--extract=STR #Extract embedded JavaScript: "auto" (HTML file), "always", "never"
--exclude PATH... #
--exclude-path=FILE #.gitignore-style FILE (def: ./.jshintignore)
--reporter=FILE #How to output
#Is a Node module OBJ.reporter(OBJ2_ARR), where OBJ2:
# - file PATH
# - error:
# - id STR, e.g. "(error)"
# - code STR
# - reason STR
# - evidence STR
# - line NUM
# - character NUM
# - scope STR, e.g. "(main)"
#Default MODULE: "default" (def) and "non-error" (uses --non-errors)
#(needs to look into node_modules/jshint/src/reporters/ for the files)
##Other interesting reporters:
## - Jshint-stylish: prettier
RELAXING OPTIONS ==> #Turning to true suppresses default warnings/errors (if nothing specified, is BOOL)
maxerr NUM #After this number of warnings, produces as an error (def: 50)
ignore:start|end #Ignore all warnings|errors in-between.
#Can only be declared in comments
asi #Missing semicolons
lastsemic #Same but only for one line statements
boss #Using = where == is expected
eqnull #== null
debug #debugger statement
evil #eval
esnext #ECMAScript 6
iterator #__iterator__ (poor cross browser)
proto #__proto__
moz #Firefox-specific JavaScript
expr #Expression that are neither assignment nor function call
funcscope #Accessing variable outside of the non-function block they have been declared.
#This works in JavaScript but might confuse people.
globalstrict #Allow strict mode to be in global scope
validthis #In strict mode, using this in a non-constructor function.
#Can only be relaxed for a given function, not globally
multistr #Trailing backslashes (accidential space after it can break code)
laxbreak #Unsafe line breaks
laxcomma #Starting line with comma
elision #Sparse ARR
loopfunc #Functions assigns in a for loop
notypeof #typeof compared to a STR that typeof doesn't return (e.g. "function")
scripturl #javascript:... URL
shadow #Redeclaring a variable declared in an outer scope
sub #VAR[VAR2_STR] instead of VAR.VAR2 where it is possible
supernew #new function or new Object
noyield #Generator function with no yield
ENFORCING OPTIONS ==> #Turning to true creates warnings/errors
indent NUM #Tab width
strict #Strict mode must be used, and be in function-scope
#Can be false, true (at each FUNC), "global" (at each FILE) or "implied"
#(parse as if it was strict)
futurehostile #Using future reserved keywords
bitwise #Bitwise operators (to avoid typos)
camelcase #Variable names either camelCase or UPPER_CASE with underscores
curly #Using {} for one liners
eqeqeq #=== instead of ==
es3 #Compatible to ECMAScript 3 (and so to IE 9<)
varstmt #Using var instead of let|const
forin #for ( VAR in OBJ ) { ... } with no if statement in ...
freeze #Overriding of native objects prototypes
immed #function(){}() instead of (function(){})()
latedef #Using variables before declared
newcap #Capitalize constructor function names and not others (to know whether using new)
noarg #arguments.caller|callee
noempty #Empty {}
nonbsp #Non-breaking whitespace UTF-8 characters
nonew #new FUNC() with no assignment
plusplus #VAR++, VAR--
quotmark VAL #Either "single|double" or true (any of both, but consistently)
trailingcomma #Trailing commas in ARR|OBJ
undef #Using undeclared variables
globals VAL,... #Global variables declared in a different file (for undef). Can be:
# - VAR
# - VAR: false: declare as read-only
# - -VAR: blacklist
#Can only be declared in comments as /* globals VAL,... */
couch|dojo|jquery|mootols|
phantom|prototypejs|yui #Same as global but for specific library (and can be declared normally)
browser #Same for BOM/DOM
worker #Same for BOM/DOM Workers
devel #Same for console, alert, etc.
node #Same for Node.js globals
nonstandard #Same for [un]escape()
wsh #Same for Windows Script Host
unused VAL #Declaring unused variables.
#Checks also parameters according to VAL: "strict" (yes), "vars" (no)
#(def) or true (no if followed by used parameter).
exported VAL,... #Global variables used in a different file (for unused).
#Can only be declared in comments as /* exporter VAL,... */
module #To use if current env is ES6 module
esversion #3|5|6
maxparams NUM #Max function parameters
maxdepth NUM #Max block nesting
maxstatements NUM #Max number of statements per function
maxcomplexity NUM #Max cyclomatic complexity, i.e. number of linear paths from main code. if cases add 1.
maxlen NUM #Max line length
┌───────────┐
│ TOOLS │
└───────────┘
grunt-contrib-jshint ##Grunt plugin (0.11.2) that copies files (not dirs)
## - TASK "jshint"
## - TARGET src[, dest]
## - options:
## - same as jshint options above
## - globals OBJ: same as jhsint option global
## - jshintrc STR or true (def, auto)
## - ignores FILE|DIR_ARR: instead of .jshintignore
## - reporter MODULE
## - reporterOutput FILE
## - force BOOL: if false (def), fails if error
## - extensions STR: beyond ".js"
GULP-JSHINT([OBJ]) #Fires jshint and populates VINYL.jshint:
# - success BOOL: true if exit code 2
# - errorCount NUM (or null): errors only, not warnings
# - results OBJ_ARR: file PATH, error OBJ
# - data OBJ_ARR: functions STR_ARR, options OBJ, errors OBJ, implied OBJ, member OBJ, file STR
# - opt OBJ2
#Version 1.9.0
#OBJ.lookup BOOL: if true (def), looks up .jshintrc files.
#Any other options to jshint work too using OBJ.
GULP-JSHINT.reporter #Changes reporter, e.g. "default" or "jshint-stylish". Def: nothing printed.
(STR[,OBJ]) #Can use "fail", which stops task if success is false
#Can be done several times.
GULP-JSHINT.extract(STR) #Like jshint --extract
GULP-JSHINT-CACHED[.cached] #Same as GULP-JSHINT, but if "cached", faster: it keeps results from a specific file according to
([OBJ]) #its hashed content, the Jshint version and options.
#Version 1.4.2