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

📎 Implement option preserve_quotes #2482

Closed
ematipico opened this issue Apr 22, 2022 · 4 comments · Fixed by #3065
Closed

📎 Implement option preserve_quotes #2482

ematipico opened this issue Apr 22, 2022 · 4 comments · Fixed by #3065
Assignees
Labels
A-Formatter Area: formatter good first issue Good for newcomers I-Normal Implementation: normal understanding of the tool and awareness task A task, an action that needs to be performed
Milestone

Comments

@ematipico
Copy link
Contributor

Description

See discussion for context: #2465 (comment)

The team agrees that we would give the possibility to preserve the quotes inside the properties an object, if requested.

Given the following input:

const a = { "a": 2 }

The default behaviour will format the snippet like this:

const a = { a: 2 }

While using the option --preserve-quotes will format the snippet like this:

const a = { "a": 2 }

Please refer to Prettier's documentation about the option: https://prettier.io/docs/en/options.html#quote-props

@ematipico ematipico added task A task, an action that needs to be performed A-Formatter Area: formatter labels Apr 22, 2022
@ematipico
Copy link
Contributor Author

ematipico commented Apr 22, 2022

This is where we should start having a look: https://github.com/rome/tools/blob/main/crates/rome_js_formatter/src/js/objects/property_object_member.rs

Then, the actual literal is here: https://github.com/rome/tools/blob/main/crates/rome_js_formatter/src/js/objects/literal_member_name.rs

We should mind the fact taht JsLiteralMemberName is also used inside TypeScript, which means that we have read what Prettier does in case of TypeScript (it says that we should not change things because "a" and a have two different meanings) and then apply the option accordingly.

@MichaReiser
Copy link
Contributor

This work depends on #2405

@ematipico ematipico added the good first issue Good for newcomers label Apr 22, 2022
@yassere yassere added this to Rome 2022 May 8, 2022
@ematipico ematipico added the I-Normal Implementation: normal understanding of the tool and awareness label Aug 3, 2022
@bhbs
Copy link
Contributor

bhbs commented Aug 15, 2022

I would like to work on this!

@MichaReiser
Copy link
Contributor

I would like to work on this!

Awesome. I assigned you the issue. Let me know if you need any help.

@ematipico ematipico added this to the 0.9.0 milestone Aug 16, 2022
@ematipico ematipico moved this to In Progress in Rome 2022 Aug 16, 2022
Repository owner moved this from In Progress to Done in Rome 2022 Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter good first issue Good for newcomers I-Normal Implementation: normal understanding of the tool and awareness task A task, an action that needs to be performed
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants