no-use-before-define
Added in v0.4.2Configuration
rslint.config.ts
Rule Details
Disallow the use of variables before they are defined.
This rule extends the base ESLint no-use-before-define rule to add support for TypeScript-specific constructs like type, interface, and enum declarations.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
functions(boolean, defaulttrue) - Whether to check function declarationsclasses(boolean, defaulttrue) - Whether to check class declarationsvariables(boolean, defaulttrue) - Whether to check variable declarationsenums(boolean, defaulttrue) - Whether to check enum declarationstypedefs(boolean, defaulttrue) - Whether to check type/interface declarations and type parametersignoreTypeReferences(boolean, defaulttrue) - Whether to ignore references in type annotationsallowNamedExports(boolean, defaultfalse) - Whether to allow references in named exports
Also accepts "nofunc" as a shorthand for { functions: false }.
With allowNamedExports: true, named exports follow the other options. The
default ignoreTypeReferences: true ignores them, but setting it to false
checks them according to the referenced declaration. For example,
export { value }; const value = 1; is reported with
{ allowNamedExports: true, ignoreTypeReferences: false }.