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

Comment duplication with experimental ternaries #15875

Open
agriffis opened this issue Jan 4, 2024 · 0 comments · May be fixed by #15965
Open

Comment duplication with experimental ternaries #15875

agriffis opened this issue Jan 4, 2024 · 0 comments · May be fixed by #15965
Labels
area:comments Issues with how Prettier prints comments lang:javascript Issues affecting JS type:bug Issues identifying ugly output, or a defect in the program

Comments

@agriffis
Copy link

agriffis commented Jan 4, 2024

Prettier 3.1.1
Playground link

--parser babel
--experimental-ternaries

Input:

x = IS_AUTOTEST || (IS_DEV && !IS_TEST)
        ? [
            /*FooBlock*/
          ]
        : []

Output:

x =
  IS_AUTOTEST || (IS_DEV && !IS_TEST) ?
    /*FooBlock*/
    [
      /*FooBlock*/
    ]
  : [];

Expected behavior:

Keep the comment in the output array, don't insert a new one above.

@fisker fisker added type:bug Issues identifying ugly output, or a defect in the program area:comments Issues with how Prettier prints comments lang:javascript Issues affecting JS labels Jan 10, 2024
@sosukesuzuki sosukesuzuki linked a pull request Jan 19, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:comments Issues with how Prettier prints comments lang:javascript Issues affecting JS type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants