Environment information
CLI:
Version: 2.3.6
Color support: true
Platform:
CPU Architecture: aarch64
OS: macos
Environment:
BIOME_LOG_PATH: unset
BIOME_LOG_PREFIX_NAME: unset
BIOME_CONFIG_PATH: unset
BIOME_THREADS: unset
NO_COLOR: unset
TERM: xterm-256color
JS_RUNTIME_VERSION: v22.21.1
JS_RUNTIME_NAME: node
NODE_PACKAGE_MANAGER: pnpm/9.13.2
Biome Configuration:
Status: Loaded successfully
Formatter enabled: true
Linter enabled: true
Rule name
nursery/useConsistentArrowReturn
Playground link
https://biomejs.dev/playground/?lintRules=useConsistentArrowReturn&files.main.tsx=YwBvAG4AcwB0ACAAZwBlAHQAUwBjAGgAZQBtAGEAUgBvAHcAVAB5AHAAZQBzACAAPQAgACgAbAA6ACAAcwB0AHIAaQBuAGcAKQAgAD0APgAKACAAIABsAAoAIAAgACAAIAAuAHMAcABsAGkAdAAoACIAXABuACIAKQA%3D&files.biome.json=ewAKACAAIAAiAGwAaQBuAHQAZQByACIAOgAgAHsACgAgACAAIAAgACIAZQBuAGEAYgBsAGUAZAAiADoAIAB0AHIAdQBlACwACgAgACAAIAAgACIAcgB1AGwAZQBzACIAOgAgAHsACgAgACAAIAAgACAAIAAiAG4AdQByAHMAZQByAHkAIgA6ACAAewAKACAAIAAgACAAIAAgACAAIAAiAHUAcwBlAEMAbwBuAHMAaQBzAHQAZQBuAHQAQQByAHIAbwB3AFIAZQB0AHUAcgBuACIAOgAgAHsACgAgACAAIAAgACAAIAAgACAAIAAgACIAbABlAHYAZQBsACIAOgAgACIAZQByAHIAbwByACIALAAKACAAIAAgACAAIAAgACAAIAAgACAAIgBvAHAAdABpAG8AbgBzACIAOgAgAHsAIAAiAHMAdAB5AGwAZQAiADoAIAAiAGEAbAB3AGEAeQBzACIAIAB9AAoAIAAgACAAIAAgACAAIAAgAH0ACgAgACAAIAAgACAAIAB9AAoAIAAgACAAIAB9AAoAIAAgAH0ACgB9AA%3D%3D
Expected result
Current Behavior (Bug)
When running biome lint --fix via CLI with the useConsistentArrowReturn rule configured with style: "always", the autofix produces semantically incorrect code that changes the function's behavior.
Input code:
const foo = (l: string) =>
l
.split('\n')
CLI autofix output (INCORRECT):
const foo = (l: string) =>
{
return
l
.split("\n");
}
Problem: The function now returns undefined instead of the split array because there's a newline after return, triggering JavaScript's automatic semicolon insertion (ASI). This silently breaks working code by changing its runtime behavior.
Expected Behavior
The autofix should produce:
const foo = (l: string) => {
return l.split('\n');
};
This is what VS Code's Quick Fix (source.fixAll.biome) correctly produces when applying the same lint rule fix.
Configuration Used
{
"linter": {
"rules": {
"nursery": {
"useConsistentArrowReturn": {
"level": "warn",
"options": { "style": "always" }
}
}
}
}
}
Steps to Reproduce
- Save the input code to a file (e.g.,
test.ts)
- Run:
biome lint --fix test.ts
- Observe the incorrect output with
return on a separate line from the value
Impact
This bug can silently break working code by changing its runtime behavior:
- The function returns
undefined instead of the intended value
- The code remains syntactically valid, so the error may not be caught until runtime
- This is a critical semantic change that could cause production bugs
Additional Context
- VS Code's Quick Fix works correctly, suggesting the issue is specific to the CLI autofix implementation
- According to Discord discussion, VS Code likely runs format after applying the fix, which corrects the incorrect return placement
- The CLI autofix should produce correct code without requiring a subsequent format pass
- This was discussed in the Biome Discord where maintainer Siketyan confirmed this is a bug
Environment information
Rule name
nursery/useConsistentArrowReturnPlayground link
https://biomejs.dev/playground/?lintRules=useConsistentArrowReturn&files.main.tsx=YwBvAG4AcwB0ACAAZwBlAHQAUwBjAGgAZQBtAGEAUgBvAHcAVAB5AHAAZQBzACAAPQAgACgAbAA6ACAAcwB0AHIAaQBuAGcAKQAgAD0APgAKACAAIABsAAoAIAAgACAAIAAuAHMAcABsAGkAdAAoACIAXABuACIAKQA%3D&files.biome.json=ewAKACAAIAAiAGwAaQBuAHQAZQByACIAOgAgAHsACgAgACAAIAAgACIAZQBuAGEAYgBsAGUAZAAiADoAIAB0AHIAdQBlACwACgAgACAAIAAgACIAcgB1AGwAZQBzACIAOgAgAHsACgAgACAAIAAgACAAIAAiAG4AdQByAHMAZQByAHkAIgA6ACAAewAKACAAIAAgACAAIAAgACAAIAAiAHUAcwBlAEMAbwBuAHMAaQBzAHQAZQBuAHQAQQByAHIAbwB3AFIAZQB0AHUAcgBuACIAOgAgAHsACgAgACAAIAAgACAAIAAgACAAIAAgACIAbABlAHYAZQBsACIAOgAgACIAZQByAHIAbwByACIALAAKACAAIAAgACAAIAAgACAAIAAgACAAIgBvAHAAdABpAG8AbgBzACIAOgAgAHsAIAAiAHMAdAB5AGwAZQAiADoAIAAiAGEAbAB3AGEAeQBzACIAIAB9AAoAIAAgACAAIAAgACAAIAAgAH0ACgAgACAAIAAgACAAIAB9AAoAIAAgACAAIAB9AAoAIAAgAH0ACgB9AA%3D%3D
Expected result
Current Behavior (Bug)
When running
biome lint --fixvia CLI with theuseConsistentArrowReturnrule configured withstyle: "always", the autofix produces semantically incorrect code that changes the function's behavior.Input code:
CLI autofix output (INCORRECT):
Problem: The function now returns
undefinedinstead of the split array because there's a newline afterreturn, triggering JavaScript's automatic semicolon insertion (ASI). This silently breaks working code by changing its runtime behavior.Expected Behavior
The autofix should produce:
This is what VS Code's Quick Fix (
source.fixAll.biome) correctly produces when applying the same lint rule fix.Configuration Used
{ "linter": { "rules": { "nursery": { "useConsistentArrowReturn": { "level": "warn", "options": { "style": "always" } } } } } }Steps to Reproduce
test.ts)biome lint --fix test.tsreturnon a separate line from the valueImpact
This bug can silently break working code by changing its runtime behavior:
undefinedinstead of the intended valueAdditional Context