tools
tools copied to clipboard
`noUnexpectedMultiline`, no-unexpected-multiline
https://eslint.org/docs/latest/rules/no-unexpected-multiline
@MichaReiser is there some logic that we can borrow/share from the formatter, in order to implement this rule?
👋 @rome/staff please triage this issue by adding one of the following labels: S-Bug: confirmed, S-Planned , S-Wishlist or umbrella
@MichaReiser is there some logic that we can borrow/share from the formatter, in order to implement this rule?
Whoops. I missed this comment sorry.
yes, you can implement the needs_semicolons as a method on AnyExpressionStatement
https://github.com/rome/tools/blob/2655264565608e29229490101f7abbfa89a35598/crates/rome_js_formatter/src/js/statements/expression_statement.rs#L98-L156
You'll need to also move get_expression_left_side to rome_js_syntax but that shouldn't be difficult as well.
https://github.com/rome/tools/blob/2655264565608e29229490101f7abbfa89a35598/crates/rome_js_formatter/src/parentheses.rs#L317-L394
and here the corresponding logic for class members (in case this is something the rule should cover as well)
https://github.com/rome/tools/blob/2655264565608e29229490101f7abbfa89a35598/crates/rome_js_formatter/src/js/classes/property_class_member.rs#L93-L154
Edit: One challenge is that the expression logic calls into expression.needs_parentheses which is specific to the formatter. The linter could test if the expression is a ParenthesizedExpression.
Closing. The formatter takes care of it, it wouldn't make sense to have a rule for it.