-
-
Notifications
You must be signed in to change notification settings - Fork 877
Closed
Labels
A-linterArea - LinterArea - Linter
Description
Summary
When running oxlint with --fix, valid JSX boolean shorthand props like autoFocus are being removed from elements. This breaks functionality as the prop is simply deleted with no replacement.
Reproduction
// Original code - input receives focus on mount
<input
aria-label="Search"
autoComplete="off"
autoFocus
className={style.input}
/>
// After autofix - autoFocus prop is deleted
<input
aria-label="Search"
autoComplete="off"
className={style.input}
/>Impact
- Tests that verify
element.toHaveFocus()fail - User experience degrades as inputs no longer auto-focus
Files affected
In our codebase, 13 files had autoFocus props removed:
- Search forms
- Login/password forms
- Modal dialogs
- Text editors
Expected behavior
Valid JSX boolean shorthand props should not be removed by autofix. autoFocus is equivalent to autoFocus={true} and is a standard HTML/React attribute.
Unknown
I was unable to determine which specific rule's autofix caused this deletion. The prop was simply removed with no diagnostic message indicating why.
Workaround
Manually restore the props after autofix, or identify and disable the offending rule.
Environment
- oxlint version: latest (via npm)
- React codebase with TypeScript
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-linterArea - LinterArea - Linter