Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

☂️ Documentation changes 0.9.0 #2991

Closed
ematipico opened this issue Aug 2, 2022 · 3 comments · Fixed by #3134
Closed

☂️ Documentation changes 0.9.0 #2991

ematipico opened this issue Aug 2, 2022 · 3 comments · Fixed by #3134
Assignees
Labels
umbrella Issue to track a collection of other issues
Milestone

Comments

@ematipico
Copy link
Contributor

ematipico commented Aug 2, 2022

Tentative date, 6th September 2022

https://github.com/orgs/rome/projects/3/views/4?query=is%3Aopen+sort%3Aupdated-desc

Focus of this release

  • stabilize configuration file, make sure it's exhaustive but minimal at the same time
  • correctness, make sure that parser and linter work as expected, we catch errors early, and we monitor possible performance regressions
  • formatter stability
  • Node.js API
@ematipico ematipico added the umbrella Issue to track a collection of other issues label Aug 2, 2022
@ematipico ematipico pinned this issue Aug 2, 2022
@ematipico ematipico added this to the 0.9.0 milestone Aug 3, 2022
@ematipico ematipico self-assigned this Aug 4, 2022
@MichaReiser
Copy link
Contributor

Documentation changes

Document the decision on how Rome parenthesizesclass, function, and object expressions at the begin of a statement and optional chain expressions differently:

ObjectExpression, FunctionExpression, or ClassExpression at the beginning of a statement.

// input
{}.b

// Prettier
({}.b)

// Rome
({}).b 

Prettier parenthesizes the whole expression whereas Rome parenthesizes the object/function/class expression only.

The main reason for diverging is that parenthesizing the whole expression requires that the logic is implemented in any expression that starts with another child expression (tagged template, binary expressions, computed member/assignment, sequence, conditional, ... ) and it requires traversing the first expression until it reaches an object expression or any expression that doesn't start with another expression. This is rather expensive and Rome's approach avoids the expensive traversal except for object/function and class expressions, of which there should be fewer.

Parenthesized optional chain

// Input
(a?.b).c
a?.b.c

// Prettier
(a?.b).c
a?.b.c

// Rome
a?.b.c
a?.b.c

Prettier keeps the parentheses if they were present in the source document but never adds them if they were missing. This is the only case where I found that the fact that parens are present in the source document changed how Prettier parenthesizes formatted expression.

My take is that Rome should apply a consistent formatting regardless if parentheses were or were not present in the source document.

#3057

@MichaReiser
Copy link
Contributor

Document quote properties option #3065

@xunilrj
Copy link
Contributor

xunilrj commented Aug 29, 2022

Two examples of valid noUnusedVariables:
1 - Starting with an underscore;
2 - Named React.
See https://github.com/rome/tools/pull/3124/files#diff-78c747a14dde0733f5baaa828d4ad30bcca527d46dfd380688bbad45eb291448R67

@ematipico ematipico unpinned this issue Sep 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
umbrella Issue to track a collection of other issues
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants