Skip to content

Functional Composition Heuristic Is Too Broad #5060

@bdwain

Description

@bdwain

Prettier 1.14.2
Playground link

--parser babylon

Input:

connect(foo, bar)

Output:

connect(
  foo,
  bar
);

Expected behavior:
The functional composition heuristic discussed in #4172 is too broad. If I am not using Redux, the above styling is ugly and annoying. And even if I am using redux, if I don't define mapStateToProps and mapDispatchToProps inline, it's ugly and annoying to split that on multiple lines.

Rather than have prettier assume you are using all libraries, could I not list the libraries I am using in my config file? I'd rather opt in to redux specific styles than have them applied to my non-redux project.

In general though, it seems odd to hard code certain libraries anyway. It will leave prettier in the position of always judging which libraries are popular enough to support, and limits its support for less popular libraries. Why not consider an approach like the one mentioned in this comment? It seems like the eventual solution was proposed in the very next comment and no one really ever replied to this one. I think it would be much better than picking and choosing which libraries get full support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWe're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue!lang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.status:needs discussionIssues needing discussion and a decision to be made before action can be taken

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions