File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,24 @@ scope in which it should be available:
134
134
var x = 10 ;
135
135
```
136
136
137
+ If you understand the concept of hoisting and prefer to define functions after
138
+ they are used (perhaps at the end of a file) you can tell JSHint to allow that
139
+ specific use case by setting the ` latedef ` option to ` nofunc ` :
140
+
141
+ <!-- -
142
+ {
143
+ "linter": "jshint"
144
+ }
145
+ -->
146
+ ``` javascript
147
+ /* jshint latedef: nofunc */
148
+ doStuff ();
149
+
150
+ function doStuff () {
151
+ return 1 ;
152
+ }
153
+ ```
154
+
137
155
In the case of environment-specific global identifiers (like ` window ` or
138
156
` document ` in the browser or ` module ` in Node.js) there are a few JSLint/JSHint
139
157
options that you can set to let the linter know what environment the code is
You can’t perform that action at this time.
0 commit comments