What version of Oxlint are you using?
1.71.0
What happened?
The auto-fix for eslint/prefer-destructuring on assignment expressions produces code that triggers ASI (Automatic Semicolon Insertion) parsing errors.
Before fix:
switch (placement) {
case 'bottom-start':
left = triggerRect.left
break
}
After --fix (broken):
switch (placement) {
case 'bottom-start':
({ left } = triggerRect) // TS: This expression is not callable
break
}
TypeScript/JavaScript interprets ({ left } = triggerRect) on its own line as a function call because ( follows a newline with no preceding semicolon.
ESLint behavior: ESLint's prefer-destructuring rule does NOT auto-fix assignment expressions — only variable declarations get fixed. This avoids the ASI issue entirely.
Reproduction
// .oxlintrc.json
{ "rules": { "eslint/prefer-destructuring": "error" } }
const triggerRect = { left: 0, right: 100, top: 0, bottom: 50, width: 100, height: 50 }
let left = 0
left = triggerRect.left // ← oxlint fixer changes this to ({ left } = triggerRect)
Expected
The fixer should either:
- Insert a semicolon prefix when the replacement starts with
(: ;({ left } = triggerRect)
- Or skip auto-fix for assignment expressions (matching ESLint's behavior)
See generate_fix in crates/oxc_linter/src/rules/eslint/prefer_destructuring.rs — the is_assignment branch produces ({ prop } = obj) without checking for ASI hazards.
What version of Oxlint are you using?
1.71.0
What happened?
The auto-fix for
eslint/prefer-destructuringon assignment expressions produces code that triggers ASI (Automatic Semicolon Insertion) parsing errors.Before fix:
After
--fix(broken):TypeScript/JavaScript interprets
({ left } = triggerRect)on its own line as a function call because(follows a newline with no preceding semicolon.ESLint behavior: ESLint's
prefer-destructuringrule does NOT auto-fix assignment expressions — only variable declarations get fixed. This avoids the ASI issue entirely.Reproduction
Expected
The fixer should either:
(:;({ left } = triggerRect)See
generate_fixincrates/oxc_linter/src/rules/eslint/prefer_destructuring.rs— theis_assignmentbranch produces({ prop } = obj)without checking for ASI hazards.