Repository navigation
v0.4.0
What changed
oxlint.json enables no-use-before-define as an error with { "functions": false }:
- Fails: a
const,let,var,classorenumin any scope — including an arrow-function constant and a
name in anexport { name }list — referenced above its declaration. TypeScript already rejected a direct
top-level read in the temporal dead zone; the new hits are mostly references inside function bodies. - Stays allowed: function declarations (
functions: false— they hoist, and an entry function above its
helpers is the intended top-down reading order) and type-only references (defaultignoreTypeReferences).
vite-plus.d.ts describes the new rule; the version bump and README are updated. No other rule changed.
What newly fails
export function headline(): string {
return status;
}
const status = "ready";
// error eslint(no-use-before-define): 'status' was used before it was defined.Arrow-function constants behave like variables, so this fails too:
const run = () => helper(); // error: 'helper' was used before it was defined
const helper = () => 1;How to fix
- Move the declaration above its first use.
- Or turn an arrow-function constant into a
functiondeclaration, which is exempt underfunctions: false. - For two callbacks that reference each other (a timer and its cleanup), declare the one used first as a
function, or declarelet timerfirst and assign it afterwards.
How to exempt
// oxlint-disable-next-line no-use-before-defineUse it only where the order is genuinely load-bearing. The shared config sets
reportUnusedDisableDirectives: "error", so the comment fails once the code no longer needs it. A repository can
also turn the rule off (or restrict it to directories) in its own config; local settings win over the shared ones.
Impact on consumers
Measured with oxlint 1.86.0 and a config that enables only this rule, over each consumer's default branch (authored
code only; Rush's vendored common/scripts/install-run*.js is not linted by these repositories):
| Repository | Hits |
|---|---|
| agent-kit | 18 |
| agent-task-loop | 16 |
| agent-presence | 1 |
| project-template-rush | 0 |
| two private repositories | 54 and 5 |
Upgrade
Change the dependency specifier from github:PerfectPan/lint-config#v0.3.2 to
github:PerfectPan/lint-config#v0.4.0 and reinstall. vite-plus consumers keep spreading ...lint.rules and
...lint.overrides as before; the new rule arrives through lint.rules.