{"action":"created","issue":{"url":"https://api.github.com/repos/prettier/prettier/issues/4401","repository_url":"https://api.github.com/repos/prettier/prettier","labels_url":"https://api.github.com/repos/prettier/prettier/issues/4401/labels{/name}","comments_url":"https://api.github.com/repos/prettier/prettier/issues/4401/comments","events_url":"https://api.github.com/repos/prettier/prettier/issues/4401/events","html_url":"https://github.com/prettier/prettier/issues/4401","id":318988472,"number":4401,"title":"Typescript inline function with curly brackets as argument to wrapped function call breaks argument alignment","user":{"login":"alantreadway","id":17544187,"avatar_url":"https://avatars3.githubusercontent.com/u/17544187?v=4","gravatar_id":"","url":"https://api.github.com/users/alantreadway","html_url":"https://github.com/alantreadway","followers_url":"https://api.github.com/users/alantreadway/followers","following_url":"https://api.github.com/users/alantreadway/following{/other_user}","gists_url":"https://api.github.com/users/alantreadway/gists{/gist_id}","starred_url":"https://api.github.com/users/alantreadway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alantreadway/subscriptions","organizations_url":"https://api.github.com/users/alantreadway/orgs","repos_url":"https://api.github.com/users/alantreadway/repos","events_url":"https://api.github.com/users/alantreadway/events{/privacy}","received_events_url":"https://api.github.com/users/alantreadway/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-30T18:28:38Z","updated_at":"2018-04-30T18:57:06Z","closed_at":null,"author_association":"NONE","body":"**Prettier 1.12.1**\r\n[Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEcAeAHCAnGACAMwFcowYBLaPeAZxgAoBKJPANwnIBM9gAdKPHhpwYAFXIBbOBCIN+gwUzwBeAHw88kKDQgAbOADoA7gENsUesAC+AGjwByADImJAI04m8JjBmwQTYAAW5FAA5tSS0rIG9ox4tvIKALImMIEGEiZo9FrwaDAGoSIASnCZISGh4lIAklBJ5Lq65DRKALR4AOoAgsUAcgD6ojVJAKIA8gCqogNJAMp2AAyMNomMANyC-Fb8IDYgEBgU0DTIoGZ+RgAKZginKCbsXHsgrtgBANYicxgBlcgwbBEOD7ELCXBXd6hTLIAgmXTCfYAKxoaAAQu8wF8YHMXHBHCE4LD4YiQL9sODkCAYABPDBwGhgbDkI4vXwhGCdLhpZAADkW+18EGEnXeGCpvgZcGwrCJ+2wcAAjkRyArISZoSZiQiQSBhBJyACgbqaJV9ABFIgQeDa0kwEyuLmcHlIABM+0BJkalQAwhAJDCHk0XkRhKIHfc4TqrFYgA)\r\n```sh\r\n--parser typescript\r\n--trailing-comma all\r\n```\r\n\r\n**Input:**\r\n```tsx\r\nexport function test(): void {\r\n  setTimeout(\r\n    () => { console.warn({}, 'Lambda approaching timeout.') },\r\n    Math.max(context.getRemainingTimeInMillis() - WARN_TIMEOUT_MS, 0),\r\n  );  \r\n}\r\n\r\n```\r\n\r\n**Output:**\r\n```tsx\r\nexport function test(): void {\r\n  setTimeout(() => {\r\n    console.warn({}, \"Lambda approaching timeout.\");\r\n  }, Math.max(context.getRemainingTimeInMillis() - WARN_TIMEOUT_MS, 0));\r\n}\r\n\r\n```\r\n\r\n**Expected output:**\r\n```tsx\r\nexport function test(): void {\r\n  setTimeout(\r\n    () => {\r\n      console.warn({}, 'Lambda approaching timeout.');\r\n    },\r\n    Math.max(context.getRemainingTimeInMillis() - WARN_TIMEOUT_MS, 0),\r\n  );  \r\n}\r\n```\r\n\r\nThis appears to be a bug relating to the use of curly-brackets? If I remove them, the output is formatted in terms of line breaks and indentation as follows:\r\n\r\n```tsx\r\nexport function test(): void {\r\n  setTimeout(\r\n    () => console.warn({}, 'Lambda approaching timeout.'),\r\n    Math.max(context.getRemainingTimeInMillis() - WARN_TIMEOUT_MS, 0),\r\n  );  \r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/prettier/prettier/issues/comments/385495076","html_url":"https://github.com/prettier/prettier/issues/4401#issuecomment-385495076","issue_url":"https://api.github.com/repos/prettier/prettier/issues/4401","id":385495076,"user":{"login":"duailibe","id":1574588,"avatar_url":"https://avatars3.githubusercontent.com/u/1574588?v=4","gravatar_id":"","url":"https://api.github.com/users/duailibe","html_url":"https://github.com/duailibe","followers_url":"https://api.github.com/users/duailibe/followers","following_url":"https://api.github.com/users/duailibe/following{/other_user}","gists_url":"https://api.github.com/users/duailibe/gists{/gist_id}","starred_url":"https://api.github.com/users/duailibe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duailibe/subscriptions","organizations_url":"https://api.github.com/users/duailibe/orgs","repos_url":"https://api.github.com/users/duailibe/repos","events_url":"https://api.github.com/users/duailibe/events{/privacy}","received_events_url":"https://api.github.com/users/duailibe/received_events","type":"User","site_admin":false},"created_at":"2018-04-30T18:57:06Z","updated_at":"2018-04-30T18:57:06Z","author_association":"COLLABORATOR","body":"This is the intended behavior as it's really common to have this form:\r\n\r\n```js\r\nsetTimeout(() => {\r\n  /* code */\r\n}, 20);\r\n```\r\n\r\ninstead of\r\n\r\n```js\r\nsetTimeout(\r\n  () => {\r\n    /* code\r\n  },\r\n  20\r\n);\r\n```\r\n\r\nMaybe we can tweak the heuristics a bit when the 2nd argument is not a number literal."}}
{"actor":{"display_login":"duailibe"}}