{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/jest/pulls/comments/140149792","pull_request_review_id":64179454,"id":140149792,"diff_hunk":"@@ -47,5 +49,50 @@ function parse(docblock: string): {[key: string]: string} {\n   return result;\n }\n \n+function print(\n+  object: {[key: string]: string} = {},\n+  comments: string = '',\n+): string {\n+  const head = '/**';\n+  const start = ' *';\n+  const tail = ' */';\n+\n+  const keys = Object.keys(object);\n+  const line = os.EOL;\n+\n+  const printedObject = keys\n+    .map(key => start + ' ' + printKeyValue(key, object[key]) + line)\n+    .join('');\n+\n+  if (!comments) {\n+    if (keys.length === 0) {\n+      return '';\n+    }\n+    if (keys.length === 1) {\n+      return `${head} ${printKeyValue(keys[0], object[keys[0]])}${tail}`;\n+    }\n+  }\n+\n+  const printedComments =\n+    comments\n+      .split(os.EOL)","path":"packages/jest-docblock/src/index.js","position":72,"original_position":39,"commit_id":"c0b6a97edb5b5446a0a8602d8c9cb41b18a7785b","original_commit_id":"66fdd4a78c80ab9e8e6eb4cdd8c9c54021eb69a5","user":{"login":"azz","id":1297597,"avatar_url":"https://avatars3.githubusercontent.com/u/1297597?v=4","gravatar_id":"","url":"https://api.github.com/users/azz","html_url":"https://github.com/azz","followers_url":"https://api.github.com/users/azz/followers","following_url":"https://api.github.com/users/azz/following{/other_user}","gists_url":"https://api.github.com/users/azz/gists{/gist_id}","starred_url":"https://api.github.com/users/azz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azz/subscriptions","organizations_url":"https://api.github.com/users/azz/orgs","repos_url":"https://api.github.com/users/azz/repos","events_url":"https://api.github.com/users/azz/events{/privacy}","received_events_url":"https://api.github.com/users/azz/received_events","type":"User","site_admin":false},"body":"Should I do the same for the existing `parse`, which has a hard-coded `\\n`?","created_at":"2017-09-21T05:08:57Z","updated_at":"2017-09-21T05:08:58Z","html_url":"https://github.com/facebook/jest/pull/4517#discussion_r140149792","pull_request_url":"https://api.github.com/repos/facebook/jest/pulls/4517","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/facebook/jest/pulls/comments/140149792"},"html":{"href":"https://github.com/facebook/jest/pull/4517#discussion_r140149792"},"pull_request":{"href":"https://api.github.com/repos/facebook/jest/pulls/4517"}},"in_reply_to_id":140002073},"pull_request":{"url":"https://api.github.com/repos/facebook/jest/pulls/4517","id":142084175,"html_url":"https://github.com/facebook/jest/pull/4517","diff_url":"https://github.com/facebook/jest/pull/4517.diff","patch_url":"https://github.com/facebook/jest/pull/4517.patch","issue_url":"https://api.github.com/repos/facebook/jest/issues/4517","number":4517,"state":"open","locked":false,"title":"[WIP] [jest-docblock] add docblock.print()","user":{"login":"azz","id":1297597,"avatar_url":"https://avatars3.githubusercontent.com/u/1297597?v=4","gravatar_id":"","url":"https://api.github.com/users/azz","html_url":"https://github.com/azz","followers_url":"https://api.github.com/users/azz/followers","following_url":"https://api.github.com/users/azz/following{/other_user}","gists_url":"https://api.github.com/users/azz/gists{/gist_id}","starred_url":"https://api.github.com/users/azz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azz/subscriptions","organizations_url":"https://api.github.com/users/azz/orgs","repos_url":"https://api.github.com/users/azz/repos","events_url":"https://api.github.com/users/azz/events{/privacy}","received_events_url":"https://api.github.com/users/azz/received_events","type":"User","site_admin":false},"body":"**Summary**\r\n\r\nPrettier is implementing a `--prependPragma` flag to add `/** @format */` to docblock, and ideally we'd be able to augment existing docblocks rather than prepending a new one, which will break tools which only look at the first one.\r\n\r\nContext: https://github.com/prettier/prettier/pull/2865#discussion_r139935035\r\n\r\nThis PR adds a simple `docblock.print({ flow: '' })` function.\r\n\r\n```js\r\ndocblock.print({ flow: '' }); \r\n/** @flow */\r\n\r\ndocblock.print({ providesModule: \"x/y\" }, \"My module\");\r\n/**\r\n * My module\r\n *\r\n * @providesModule x/y\r\n */\r\n```\r\n\r\nIn practice:\r\n\r\n```js\r\nconst pragmas = docblock.parse(\"/** @flow */\");\r\nconst updated = docblock.print({ ...pragmas, format: '' });\r\n/**\r\n * @flow\r\n * @format\r\n */\r\n```\r\n\r\n**Test plan**\r\n\r\nUnit tests are covering most cases are included.","created_at":"2017-09-20T12:19:16Z","updated_at":"2017-09-21T05:08:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e642275775213c5579e9307f207c98212ca1954b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/jest/pulls/4517/commits","review_comments_url":"https://api.github.com/repos/facebook/jest/pulls/4517/comments","review_comment_url":"https://api.github.com/repos/facebook/jest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/jest/issues/4517/comments","statuses_url":"https://api.github.com/repos/facebook/jest/statuses/c0b6a97edb5b5446a0a8602d8c9cb41b18a7785b","head":{"label":"azz:docblock-print","ref":"docblock-print","sha":"c0b6a97edb5b5446a0a8602d8c9cb41b18a7785b","user":{"login":"azz","id":1297597,"avatar_url":"https://avatars3.githubusercontent.com/u/1297597?v=4","gravatar_id":"","url":"https://api.github.com/users/azz","html_url":"https://github.com/azz","followers_url":"https://api.github.com/users/azz/followers","following_url":"https://api.github.com/users/azz/following{/other_user}","gists_url":"https://api.github.com/users/azz/gists{/gist_id}","starred_url":"https://api.github.com/users/azz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azz/subscriptions","organizations_url":"https://api.github.com/users/azz/orgs","repos_url":"https://api.github.com/users/azz/repos","events_url":"https://api.github.com/users/azz/events{/privacy}","received_events_url":"https://api.github.com/users/azz/received_events","type":"User","site_admin":false},"repo":{"id":104203310,"name":"jest","full_name":"azz/jest","owner":{"login":"azz","id":1297597,"avatar_url":"https://avatars3.githubusercontent.com/u/1297597?v=4","gravatar_id":"","url":"https://api.github.com/users/azz","html_url":"https://github.com/azz","followers_url":"https://api.github.com/users/azz/followers","following_url":"https://api.github.com/users/azz/following{/other_user}","gists_url":"https://api.github.com/users/azz/gists{/gist_id}","starred_url":"https://api.github.com/users/azz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azz/subscriptions","organizations_url":"https://api.github.com/users/azz/orgs","repos_url":"https://api.github.com/users/azz/repos","events_url":"https://api.github.com/users/azz/events{/privacy}","received_events_url":"https://api.github.com/users/azz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/azz/jest","description":"🃏 Delightful JavaScript Testing.","fork":true,"url":"https://api.github.com/repos/azz/jest","forks_url":"https://api.github.com/repos/azz/jest/forks","keys_url":"https://api.github.com/repos/azz/jest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azz/jest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azz/jest/teams","hooks_url":"https://api.github.com/repos/azz/jest/hooks","issue_events_url":"https://api.github.com/repos/azz/jest/issues/events{/number}","events_url":"https://api.github.com/repos/azz/jest/events","assignees_url":"https://api.github.com/repos/azz/jest/assignees{/user}","branches_url":"https://api.github.com/repos/azz/jest/branches{/branch}","tags_url":"https://api.github.com/repos/azz/jest/tags","blobs_url":"https://api.github.com/repos/azz/jest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azz/jest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azz/jest/git/refs{/sha}","trees_url":"https://api.github.com/repos/azz/jest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azz/jest/statuses/{sha}","languages_url":"https://api.github.com/repos/azz/jest/languages","stargazers_url":"https://api.github.com/repos/azz/jest/stargazers","contributors_url":"https://api.github.com/repos/azz/jest/contributors","subscribers_url":"https://api.github.com/repos/azz/jest/subscribers","subscription_url":"https://api.github.com/repos/azz/jest/subscription","commits_url":"https://api.github.com/repos/azz/jest/commits{/sha}","git_commits_url":"https://api.github.com/repos/azz/jest/git/commits{/sha}","comments_url":"https://api.github.com/repos/azz/jest/comments{/number}","issue_comment_url":"https://api.github.com/repos/azz/jest/issues/comments{/number}","contents_url":"https://api.github.com/repos/azz/jest/contents/{+path}","compare_url":"https://api.github.com/repos/azz/jest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azz/jest/merges","archive_url":"https://api.github.com/repos/azz/jest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azz/jest/downloads","issues_url":"https://api.github.com/repos/azz/jest/issues{/number}","pulls_url":"https://api.github.com/repos/azz/jest/pulls{/number}","milestones_url":"https://api.github.com/repos/azz/jest/milestones{/number}","notifications_url":"https://api.github.com/repos/azz/jest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azz/jest/labels{/name}","releases_url":"https://api.github.com/repos/azz/jest/releases{/id}","deployments_url":"https://api.github.com/repos/azz/jest/deployments","created_at":"2017-09-20T10:51:39Z","updated_at":"2017-09-20T10:51:44Z","pushed_at":"2017-09-21T01:11:28Z","git_url":"git://github.com/azz/jest.git","ssh_url":"git@github.com:azz/jest.git","clone_url":"https://github.com/azz/jest.git","svn_url":"https://github.com/azz/jest","homepage":"http://facebook.github.io/jest/","size":21507,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"246da7f5b9eb92538d692b204c257eaa8c800a9f","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":15062869,"name":"jest","full_name":"facebook/jest","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/jest","description":"🃏 Delightful JavaScript Testing.","fork":false,"url":"https://api.github.com/repos/facebook/jest","forks_url":"https://api.github.com/repos/facebook/jest/forks","keys_url":"https://api.github.com/repos/facebook/jest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/jest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/jest/teams","hooks_url":"https://api.github.com/repos/facebook/jest/hooks","issue_events_url":"https://api.github.com/repos/facebook/jest/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/jest/events","assignees_url":"https://api.github.com/repos/facebook/jest/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/jest/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/jest/tags","blobs_url":"https://api.github.com/repos/facebook/jest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/jest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/jest/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/jest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/jest/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/jest/languages","stargazers_url":"https://api.github.com/repos/facebook/jest/stargazers","contributors_url":"https://api.github.com/repos/facebook/jest/contributors","subscribers_url":"https://api.github.com/repos/facebook/jest/subscribers","subscription_url":"https://api.github.com/repos/facebook/jest/subscription","commits_url":"https://api.github.com/repos/facebook/jest/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/jest/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/jest/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/jest/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/jest/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/jest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/jest/merges","archive_url":"https://api.github.com/repos/facebook/jest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/jest/downloads","issues_url":"https://api.github.com/repos/facebook/jest/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/jest/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/jest/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/jest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/jest/labels{/name}","releases_url":"https://api.github.com/repos/facebook/jest/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/jest/deployments","created_at":"2013-12-10T00:18:04Z","updated_at":"2017-09-21T03:29:08Z","pushed_at":"2017-09-21T04:34:34Z","git_url":"git://github.com/facebook/jest.git","ssh_url":"git@github.com:facebook/jest.git","clone_url":"https://github.com/facebook/jest.git","svn_url":"https://github.com/facebook/jest","homepage":"http://facebook.github.io/jest/","size":21810,"stargazers_count":12195,"watchers_count":12195,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1558,"mirror_url":null,"open_issues_count":198,"forks":1558,"open_issues":198,"watchers":12195,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/jest/pulls/4517"},"html":{"href":"https://github.com/facebook/jest/pull/4517"},"issue":{"href":"https://api.github.com/repos/facebook/jest/issues/4517"},"comments":{"href":"https://api.github.com/repos/facebook/jest/issues/4517/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/jest/pulls/4517/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/jest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/jest/pulls/4517/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/jest/statuses/c0b6a97edb5b5446a0a8602d8c9cb41b18a7785b"}},"author_association":"NONE"}}
{"actor":{"display_login":"azz"}}