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

AssignmentExpression with ClassExpression are systematically wrapped regardless of length #9740

Closed
PyvesB opened this issue Nov 21, 2020 · 0 comments · Fixed by #9741
Closed
Assignees
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program

Comments

@PyvesB
Copy link

PyvesB commented Nov 21, 2020

Prettier 2.2.0
Playground link

--parser babel

Input:

module.exports = class A extends B {
  method () {
    console.log("foo");
  }
};

Output:

module.exports = class A extends (
  B
) {
  method() {
    console.log("foo");
  }
};

Expected behavior:

The input should not be modified by Prettier when the superclass name is of reasonable length and/or does not have any namespaces. This behavior was changed in Prettier 2.2.0 and is probably caused by this new feature which was implemented in #9341. The intent was to wrap assignments with long superclass names when using the Google Closure library for example. However, it applies to everything, even if the superclass name is a single letter. This seems to do more harm than good on code readability.

@sosukesuzuki sosukesuzuki added lang:javascript Issues affecting JS type:bug Issues identifying ugly output, or a defect in the program labels Nov 21, 2020
@sosukesuzuki sosukesuzuki self-assigned this Nov 21, 2020
@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Feb 21, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. 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