What version of Oxlint are you using?
1.70.0
What command did you run?
oxlint
What does your .oxlintrc.json (or oxlint.config.ts) config file look like?
export default defineConfig({
plugins: ['unicorn'],
options: {
typeAware: true,
},
rules: {
'unicorn/explicit-length-check': 'warn',
},
});
What happened?
test.ts
interface Thing {
list?: number[];
}
const foo: Thing = {};
const hasList = Boolean(foo.list?.length);
Output from npx oxlint:
⚠ unicorn(explicit-length-check): Use `.length > 0` when checking length is not zero.
╭─[test.ts:5:25]
4 │ const foo: Thing = {};
5 │ const hasList = Boolean(foo.list?.length);
· ────────────────
╰────
help: Replace `foo.list?.length` with `foo.list?.length > 0`.
The suggested replacement is not valid: 'foo.list.length' is possibly 'undefined'. ts(18048).
What version of Oxlint are you using?
1.70.0
What command did you run?
oxlint
What does your
.oxlintrc.json(oroxlint.config.ts) config file look like?What happened?
test.ts
Output from
npx oxlint:The suggested replacement is not valid:
'foo.list.length' is possibly 'undefined'. ts(18048).