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

Composed functions not put on own line anymore after 1.14.0 update #4925

Closed
felixfbecker opened this issue Aug 1, 2018 · 6 comments
Closed
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Milestone

Comments

@felixfbecker
Copy link

felixfbecker commented Aug 1, 2018

Getting these diffs a lot after the 1.14 update. Seems like the functional composition detection doesn't work anymore

         this.subscriptions.add(
             this.componentUpdates
-                .pipe(
-                    startWith(this.props),
-                    distinctUntilChanged(isEqual)
-                )
+                .pipe(startWith(this.props), distinctUntilChanged(isEqual))
                 .subscribe((props: Props) => {
                     const newParentPath = props.activePathIsDir ? props.activePath : dirname(props.activePath)
                     const queryParams = new URLSearchParams(this.props.history.location.search)

Prettier 1.14.0
Playground link

Input:

this.subscriptions.add(
            this.componentUpdates
                .pipe(startWith(this.props), distinctUntilChanged(isEqual))
                .subscribe(props => {
                    
                })
        )

Output:

this.subscriptions.add(
  this.componentUpdates
    .pipe(startWith(this.props), distinctUntilChanged(isEqual))
    .subscribe(props => {})
);

Expected behavior:

this.subscriptions.add(
  this.componentUpdates
    .pipe(
      startWith(this.props),
      distinctUntilChanged(isEqual)
     )
    .subscribe(props => {})
);

as it was with 1.13

@duailibe duailibe added type:bug Issues identifying ugly output, or a defect in the program lang:javascript Issues affecting JS labels Aug 2, 2018
@suchipi
Copy link
Member

suchipi commented Aug 3, 2018

We recently blacklisted anything with this in it to try to cut down some of the false positives, but I didn't think about this use-case. We'll have to revert it.

@ikatyang
Copy link
Member

ikatyang commented Aug 3, 2018

I'd like to release 1.14.1 (ref: #4916 (comment) and #4932 (comment)), do you plan to fix this one in 1.14.1?

@suchipi
Copy link
Member

suchipi commented Aug 3, 2018

@ikatyang made a PR, it can go in 1.14.1

@ikatyang ikatyang added this to the 1.14.1 milestone Aug 3, 2018
@ikatyang ikatyang added the status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! label Aug 3, 2018
@felixfbecker
Copy link
Author

This is still happening in 1.14.2:

diff --git a/web/src/search/input/SearchFilterChips.tsx b/web/src/search/input/SearchFilterChips.tsx
index fabd6119b7..5acfd50d53 100644
--- a/web/src/search/input/SearchFilterChips.tsx
+++ b/web/src/search/input/SearchFilterChips.tsx
@@ -96,9 +96,7 @@ export class SearchFilterChips extends React.PureComponent<Props, State> {
         return (
             <div className="search-filter-chips">
                 {/* Filtering out empty strings because old configurations have "All repositories" with empty value, which is useless with new chips design. */}
-                {scopes
-                    .filter(scope => scope.value !== '')
-                    .map((scope, i) => (
+                {scopes.filter(scope => scope.value !== '').map((scope, i) => (
                     <FilterChip
                         query={this.props.query}
                         onFilterChosen={this.onSearchScopeClicked}

@ikatyang
Copy link
Member

ikatyang commented Sep 2, 2018

It does not look related to this issue, we only special-cased these functions:

const functionCompositionFunctionNames = new Set([
"pipe", // RxJS, Ramda
"pipeP", // Ramda
"pipeK", // Ramda
"compose", // Ramda, Redux
"composeFlipped", // Not from any library, but common in Haskell, so supported
"composeP", // Ramda
"composeK", // Ramda
"flow", // Lodash
"flowRight", // Lodash
"connect" // Redux
]);

Could you open a new issue?

@felixfbecker
Copy link
Author

#5042

@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Dec 1, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Dec 1, 2018
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. status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

4 participants