You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/rules/no-use-before-define.md
+138Lines changed: 138 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,6 +157,18 @@ export { foo };
157
157
These references are safe even if the variables are declared later in the code.
158
158
Default is `false`.
159
159
160
+
This rule additionally supports TypeScript type syntax. The following options enable checking for the references to `type`, `interface` and `enum` declarations:
161
+
162
+
*`enums` (`boolean`) -
163
+
If it is `true`, the rule warns every reference to an `enum` before it is defined.
164
+
Defult is `true`.
165
+
*`typedefs` (`boolean`) -
166
+
If it is `true`, this rule warns every reference to a type `alias` or `interface` before its declaration. If `false`, the rule allows using type `alias`es and `interface`s before they are defined.
167
+
Default is `true`.
168
+
*`ignoreTypeReferences` (`boolean`) -
169
+
If it is `true`, rule will ignore all type references, such as in type annotations and assertions.
170
+
Default is `true`.
171
+
160
172
This rule accepts `"nofunc"` string as an option.
161
173
`"nofunc"` is the same as `{ "functions": false, "classes": true, "variables": true, "allowNamedExports": false }`.
162
174
@@ -350,3 +362,129 @@ const d = 1;
350
362
```
351
363
352
364
:::
365
+
366
+
### enums (TypeScript only)
367
+
368
+
Examples of **incorrect** code for the `{ "enums": true }` option:
0 commit comments