Changelog - 2026-11-08
The strict oxlint preset allows || as an empty-string fallback
EnhancementIn one line. oxlintConfigs no longer reports || on a string, so value?.trim() || fallback passes without turning the rule off.
What changed
- Strings.
prefer-nullish-coalescingnow runs withignorePrimitives: { string: true }.name?.trim() || 'guest'and an env value that is''are an intentional fallback, and??would keep the''. - Everything else still reports.
||on an object, a number, a boolean or a bigint is flagged as before. - The ESLint preset follows.
eslintConfigssets the sameignorePrimitives: { string: true }on@typescript-eslint/prefer-nullish-coalescing, so the two presets agree on strings. lenientFallback.OxlintConfigs.create({ lenientFallback: true })still adds number to the allowed set, solimit || 20passes.BrowserOxlintConfigsandReactOxlintConfigsfollow the base.
Who is affected
- A project on
oxlintConfigs,OxlintConfigs.create(),BrowserOxlintConfigsorReactOxlintConfigs. The rule reports fewer sites; no action needed. A project that turned the rule off package by package only to allow string fallbacks can turn it back on. - A project on
eslintConfigs. No change: that preset keeps the rule as it was.
Details
typescript
declare const name: string | undefined;
declare const limit: number | undefined;
const label = name?.trim() || 'guest'; // before: reported, now: allowed
const size = limit || 20; // still reported, unless lenientFallback is on| File | Package |
|---|---|
src/linters/oxlint.ts | dev-configs |