{"action":"created","issue":{"url":"https://api.github.com/repos/prettier/prettier/issues/4172","repository_url":"https://api.github.com/repos/prettier/prettier","labels_url":"https://api.github.com/repos/prettier/prettier/issues/4172/labels{/name}","comments_url":"https://api.github.com/repos/prettier/prettier/issues/4172/comments","events_url":"https://api.github.com/repos/prettier/prettier/issues/4172/events","html_url":"https://github.com/prettier/prettier/issues/4172","id":306223781,"number":4172,"title":"RxJS pipe chaining get formatted on a single line","user":{"login":"yannickglt","id":1006426,"avatar_url":"https://avatars0.githubusercontent.com/u/1006426?v=4","gravatar_id":"","url":"https://api.github.com/users/yannickglt","html_url":"https://github.com/yannickglt","followers_url":"https://api.github.com/users/yannickglt/followers","following_url":"https://api.github.com/users/yannickglt/following{/other_user}","gists_url":"https://api.github.com/users/yannickglt/gists{/gist_id}","starred_url":"https://api.github.com/users/yannickglt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yannickglt/subscriptions","organizations_url":"https://api.github.com/users/yannickglt/orgs","repos_url":"https://api.github.com/users/yannickglt/repos","events_url":"https://api.github.com/users/yannickglt/events{/privacy}","received_events_url":"https://api.github.com/users/yannickglt/received_events","type":"User","site_admin":false},"labels":[{"id":707748687,"url":"https://api.github.com/repos/prettier/prettier/labels/lang:javascript","name":"lang:javascript","color":"006b75","default":false},{"id":516128597,"url":"https://api.github.com/repos/prettier/prettier/labels/status:needs%20discussion","name":"status:needs discussion","color":"5319e7","default":false},{"id":491115805,"url":"https://api.github.com/repos/prettier/prettier/labels/type:feature","name":"type:feature","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-18T08:57:36Z","updated_at":"2018-03-20T21:56:22Z","closed_at":null,"author_association":"NONE","body":"**Prettier 1.11.1**\r\n[Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBLAtgBwgJxgAmHxwEMoBzOfAX3wDMcJ18ByHADwCsBnAeggBG3ODgBuJAQBs4vUhTgsA3AB0oGbHkL50JTABp6qSfBwHuYMjXqNmbLnwiYRJGLm5LVqyFG4FuEAFccMDgAEnwAXmIySgAKAAYDAEZ4gEoVKFV-IJDQgDpMVCdY1XxDYxFY9kiAPnxqgFJ8ACZIiKi0vVLtXSra+vwAanrUrqgy8zJY2JIwMAN2VP7ZsCH6gzTVVNU87gChMBxUATg+iLrvf2k8yQhyKtTtqBA9EEcYVGhuZFASHEYAO4ABT+CG+KBIoggqAAJi8QCRfMg6CRJMJXgJSGAANZwGAAZUws1QFGQMBwATgrxhEDAyNR6LQPhEMCBpHIOnpaKpIB47AAQljcQSSOg4AAZElwLmMwIwTABGDNGU8ok4YQ4ZAgAQSACet2er0wR1gAHVYTAABbIAAciRAxogwlNpEwWuNcA1omlrxwcAAjgFUH62SQOSQVa9hOhUGSKTzuCTyNIAIoBCDwSMgGASc0wq3IZqvckkIxJgDCTE5KCg0B9IACwgAKhJwSjudRqEA)\r\n\r\n**Input:**\r\n```jsx\r\nimport { range } from 'rxjs/observable/range';\r\nimport { map, filter, scan } from 'rxjs/operators';\r\n\r\nconst source$ = range(0, 10);\r\n\r\nsource$.pipe(\r\n  filter(x => x % 2 === 0),\r\n  map(x => x + x),\r\n  scan((acc, x) => acc + x, 0)\r\n)\r\n.subscribe(x => console.log(x))\r\n\r\n```\r\n\r\n**Output:**\r\n```jsx\r\nimport { range } from \"rxjs/observable/range\";\r\nimport { map, filter, scan } from \"rxjs/operators\";\r\n\r\nconst source$ = range(0, 10);\r\n\r\nsource$\r\n  .pipe(filter(x => x % 2 === 0), map(x => x + x), scan((acc, x) => acc + x, 0))\r\n  .subscribe(x => console.log(x));\r\n\r\n```\r\n\r\n**Expected behavior:**\r\nAs in the [official RxJS documentation](https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md), the given input shouldn't be modified as it is considered as methods chaining. The piped functions `filter`, `map` and `scan` should remain on a separate line.\r\nI don't know how it can be handled by prettier without too much impacts, but maybe considering that a function call that includes at least 2 function calls as parameters (eg: `fn1(fn2(), fn3())`) could be printed as a chain as below:\r\n```js\r\nfn1(\r\n  fn2(),\r\n  fn3()\r\n)\r\n```\r\nIt would also help when using [Lo-Dash FP chaining](https://medium.com/making-internets/why-using-chain-is-a-mistake-9bc1f80d51ba) which encounters the same problem."},"comment":{"url":"https://api.github.com/repos/prettier/prettier/issues/comments/374770918","html_url":"https://github.com/prettier/prettier/issues/4172#issuecomment-374770918","issue_url":"https://api.github.com/repos/prettier/prettier/issues/4172","id":374770918,"user":{"login":"suchipi","id":1341513,"avatar_url":"https://avatars0.githubusercontent.com/u/1341513?v=4","gravatar_id":"","url":"https://api.github.com/users/suchipi","html_url":"https://github.com/suchipi","followers_url":"https://api.github.com/users/suchipi/followers","following_url":"https://api.github.com/users/suchipi/following{/other_user}","gists_url":"https://api.github.com/users/suchipi/gists{/gist_id}","starred_url":"https://api.github.com/users/suchipi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suchipi/subscriptions","organizations_url":"https://api.github.com/users/suchipi/orgs","repos_url":"https://api.github.com/users/suchipi/repos","events_url":"https://api.github.com/users/suchipi/events{/privacy}","received_events_url":"https://api.github.com/users/suchipi/received_events","type":"User","site_admin":false},"created_at":"2018-03-20T21:56:22Z","updated_at":"2018-03-20T21:56:22Z","author_association":"COLLABORATOR","body":"Prettier is not distinguishing this from a normal function call with three arguments, which is why this is formatted as you see. We could pursue special formatting for RxJS as a new feature if there is demand for it but I haven't seen much yet. "}}
{"actor":{"display_login":"suchipi"}}