-
Notifications
You must be signed in to change notification settings - Fork 660
🐛 Files with fn(() => (aborted = true));
cause - entered unreachable code - when --apply-unsafe
#4464
Comments
I believe this issue was fixed. Could you try one of our latest nightlies? We're going to do a new release soon. |
I've checked the reason why Rome crashes here. tools/crates/rome_js_analyze/src/analyzers/suspicious/no_assign_in_expressions.rs Lines 107 to 125 in 22ce6c6
We replace the token here with I guess that the solution is to convert |
…entered unreachable code - when --apply-unsafe #4464
…entered unreachable code - when --apply-unsafe #4464
…entered unreachable code - when --apply-unsafe #4464
You should certainly rewrite your code in the following way: res.onAborted(() => { aborted = true; return aborted }); Or if you don't need to return: res.onAborted(() => { aborted = true }); |
This is the point of my issue, I expected this suggestion from linter in console not as comment on github |
The linter is not able to know if you mean |
We have big codebase where code written by different people. It's obviously that code should be rewritten, but I expected this information from linter |
@mrazorvin We totally agree. This should be fixed by #4473 in the following release :) |
For now you can disable the rule that creates the issue: {
"linter": {
"enabled": true,
"rules": {
"suspicious": {
"noAssignInExpressions": "off"
}
}
}
} |
thanks, It just not always easy to change code immediately, especially when there more of those places and you need to find them manually (there not info which file contains wrong code) |
This is a bug. Rome is not intended to behave in this way. Thanks for the reporting! |
Environment information
What happened?
command
./node_modules/.bin/rome check ./packages --apply-unsafe
cause entered unreachable code
Expected result
Fixed XXXX file(s) in YYYYms
Code of Conduct
The text was updated successfully, but these errors were encountered: