tools icon indicating copy to clipboard operation
tools copied to clipboard

☂️ Formatter 0.9.0

Open MichaReiser opened this issue 3 years ago • 2 comments
trafficstars

Description

This is an umbrella issue for the work on the Formatter for the 0.9.0 release.

Goals

  • Rome removes unnecessary parentheses and adds parentheses to improve readability.
  • Improve Prettier compatibility of some core syntax nodes.

Tasks

  • [ ] Parentheses (2 weeks) #2427
    • [ ] Implement parentheses handling for expressions #3057, #3079 #2449
    • [ ] Implement parentheses handling for assignments
    • [ ] Implement parentheses handling for types
  • [ ] Prettier compatibility (2 weeks)
    • [x] JsConditionalExpression
    • [x] Hug function parameters
    • [x] Parameter and return type formatting
    • [x] return and throw argument
    • [x] JsTemplate #2446 #3063
    • [ ] JsBinaryExpression #3079
    • [ ] JsArrowFunctionExpression
    • [ ] JsCallArguments
    • [ ] CallExpression (Member Chain)
    • [ ] JsStaticMemberAssignment and JsComputedMemberAssignment #3061

MichaReiser avatar Aug 11 '22 12:08 MichaReiser

This is a follow up question after https://github.com/rome/tools/pull/3057.

Is there a specific reason why the "needs parentheses" information is tracked inside the formatter phase?

Have you considered some other solutions, such as a visitor approach, or even computing this information during the parsing phase and storing it inside our green tree?

I would like to know what are the implications of your decisions in the future developments

ematipico avatar Aug 14 '22 09:08 ematipico

@ematipico I replied on the PR as these questions seem relevant to the implementation.

MichaReiser avatar Aug 15 '22 06:08 MichaReiser

I start working on the Arrow function formatting

MichaReiser avatar Aug 26 '22 09:08 MichaReiser

I'll start looking into JSX formatting tomorrow

MichaReiser avatar Aug 29 '22 17:08 MichaReiser

We are getting close to 90% prettier compatibility, that's awesome.

IWANABETHATGUY avatar Sep 02 '22 14:09 IWANABETHATGUY