Skip to content

New generics printing causes very long lines #5370

@xixixao

Description

@xixixao

Prettier 1.15.1
Playground link

--parser babylon

Input:

const durabilityMetricsSelectable: Immutable.OrderedSet<
  SomeReportingMetric,
> = myExperienceSelectable.concat(otherDurabilityMetricsSelectable);

Output:

const durabilityMetricsSelectable: Immutable.OrderedSet<SomeReportingMetric> = myExperienceSelectable.concat(
  otherDurabilityMetricsSelectable
);

Expected behavior:
Ideally, we should make it work like this:

const durabilityMetricsSelectable: Immutable.OrderedSet<SomeReportingMetric> =
  myExperienceSelectable.concat(otherDurabilityMetricsSelectable);

This is hard, I know prettier hasn't been doing breaking after equals because it's hard to know what's on its left side, but maybe there's a heuristic here? (same one as the one causing the generic to be one line?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions