linter: `eslint/arrow-body-style` autofix folds the next statement into the arrow body (ASI hazard)
What version of Oxlint are you using?
1.86.0 (also reproduces on main @ adb1139e)
What command did you run?
oxlint -A all -D arrow-body-style --fix t.jsWhat happened?
arrow-body-style is a safe fix, but when the arrow function ends a statement without a semicolon and the next line starts with (, [, `, /, + or -, removing the braces changes what the program does.
// input
var foo = () => { return bar }
(1).toString()// output of --fix
var foo = () => bar
(1).toString()The input has two statements: a block-bodied arrow can't be a callee, so ASI ends the first statement after }. The output has one: var foo = () => bar(1).toString(). (1).toString() no longer runs, and foo now returns something else.
If the next line starts with a regex, the output doesn't parse at all:
var foo = () => { return bar }
/re/.test(x)
// --fix → `var foo = () => bar \n/re/.test(x)` → parse errorExpected
Report the problem but skip the fix, as ESLint does. ESLint's rule has hasASIProblem and these cases in its tests (output null, "Not fixed; fixing would cause ASI issues"):
var foo = () => { return bar }\n[1, 2, 3].map(foo)
var foo = () => { return bar }\n(1).toString();Those tests were never ported to crates/oxc_linter/src/rules/eslint/arrow_body_style.rs, and fix_block_to_concise doesn't check the token after the arrow.
AI-assisted: I used Claude Code while investigating; I reviewed, ran and verified every change myself.
Source: oxc-project/oxc