What version of Oxlint are you using?
v0.52.0
What command did you run?
vp lint
What does your .oxlintrc.json (or oxlint.config.ts) config file look like?
VITE+ library template's default config:
import { defineConfig } from "vite-plus";
export default defineConfig({
staged: {
"*": "vp check --fix",
},
pack: {
dts: {
tsgo: true,
},
exports: true,
},
lint: {
options: {
typeAware: true,
typeCheck: true,
},
},
fmt: {},
});
What happened?
A conditionally-run while (true) statement with a return and no break statements causes all following code to be considered unreachable.
Minimal repro with vp create, choose library template, then update index.ts to:
export function fn() {
const random = Math.random();
if (random === .5) {
// if this is `while (random === .5)` or even `while (!false)` it works as expected.
// if it's `while (true)`, it causes an unreachable code issue.
while (true) {
return 'greetings!'
}
}
// if the line below is in an `else` statement it works as expected
return "Hello, tsdown!";
// ^ oxc: Unreachable code.
// ^ help: Remove the unreachable code or fix the control flow to make it reachable. eslint(no-unreachable)
}
What version of Oxlint are you using?
v0.52.0
What command did you run?
vp lintWhat does your
.oxlintrc.json(oroxlint.config.ts) config file look like?VITE+ library template's default config:
What happened?
A conditionally-run
while (true)statement with areturnand nobreakstatements causes all following code to be considered unreachable.Minimal repro with
vp create, choose library template, then updateindex.tsto: