Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status of reversibility solution #11856

Closed
nullromo opened this issue Nov 23, 2021 · 2 comments
Closed

Status of reversibility solution #11856

nullromo opened this issue Nov 23, 2021 · 2 comments
Labels
type:duplicate Issues that are a duplicate of a previous issue

Comments

@nullromo
Copy link

Background

Prettier still isn't fully "deterministic." Running identical-except-for-whitespace files through Prettier with the same options should always yield the same results. The Rationale pages calls this "reversibility." It also states:

the team is still looking for heuristics that would allow either to remove this behavior completely or at least to reduce the number of situations where it’s applied

with regard to the problem of object literals not being reversible.

Question

I haven't seen anything about the progress of this in the issues, so my question is, what is the current status? Will this problem ever be solved? Since adding new options/modes to Prettier is not allowed, what is the team working on that will allow for Prettier to finally become fully deterministic?

Example

For completeness, here's an explicit example of the problem.

Input 1:

const x = { y:
0 };

Output 1:

const x = { y: 0 };

Input 2:

const x = {
y: 0 };

Output 2:

const x = {
    y: 0,
};

Expected behavior:

Since inputs 1 and 2 are syntactically identical, outputs 1 and 2 should be exactly the same. I don't even care what the outputs look like (that's for my fancy opinionated formatter to decide), as long as they are the same. I want my opinionated formatter to have more opinions! Don't make/let me decide how my object literals should look.

@sosukesuzuki
Copy link
Member

As you can see on the rational page, we recognize this as an issue. However, as far as I know, no contributor is currently actively working on this.

@sosukesuzuki sosukesuzuki added the type:question Questions and support requests. Please use Stack Overflow for them, not the issue tracker. label Dec 8, 2021
@github-actions github-actions bot closed this as completed Dec 8, 2021
@prettier prettier deleted a comment from github-actions bot Dec 8, 2021
@sosukesuzuki sosukesuzuki reopened this Dec 8, 2021
@github-actions github-actions bot removed the type:question Questions and support requests. Please use Stack Overflow for them, not the issue tracker. label Dec 8, 2021
@thorn0
Copy link
Member

thorn0 commented Dec 10, 2021

Duplicate of #2068

@thorn0 thorn0 marked this as a duplicate of #2068 Dec 10, 2021
@github-actions github-actions bot added the type:duplicate Issues that are a duplicate of a previous issue label Dec 10, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:duplicate Issues that are a duplicate of a previous issue
Projects
None yet
Development

No branches or pull requests

3 participants