{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/tslint/pulls/comments/234718310","pull_request_review_id":176419983,"id":234718310,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNDcxODMxMA==","diff_hunk":"@@ -0,0 +1,126 @@\n+/**\n+ * @license\n+ * Copyright 2018 Palantir Technologies, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+import * as ts from \"typescript\";\n+import * as Lint from \"../index\";\n+import { codeExamples } from \"./code-examples/noAsyncWithoutAwait.examples\";\n+\n+export class Rule extends Lint.Rules.AbstractRule {\n+    public static FAILURE_STRING = \"Functions marked async must contain an await or return statement.\";\n+\n+    public static metadata: Lint.IRuleMetadata = {\n+        codeExamples,\n+        description: Rule.FAILURE_STRING,\n+        hasFix: false,\n+        optionExamples: [true],\n+        options: null,\n+        optionsDescription: \"Not configurable.\",\n+        rationale: \"Cleaner code, can possibly reduce transpiled output\",\n+        ruleName: \"no-async-without-await\",\n+        type: \"functionality\",\n+        typescriptOnly: false,\n+    };\n+\n+    public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {\n+        return this.applyWithWalker(new Walk(sourceFile, this.getOptions()));\n+    }\n+}\n+\n+class Walk extends Lint.RuleWalker {\n+    protected visitFunctionDeclaration(node: ts.FunctionDeclaration) {\n+        this.addFailureIfAsyncFunctionHasNoAwait(node);\n+        super.visitFunctionDeclaration(node);\n+    }\n+\n+    protected visitArrowFunction(node: ts.ArrowFunction) {\n+        this.addFailureIfAsyncFunctionHasNoAwait(node);\n+        super.visitArrowFunction(node);\n+    }\n+\n+    protected visitMethodDeclaration(node: ts.MethodDeclaration) {\n+        this.addFailureIfAsyncFunctionHasNoAwait(node);\n+        super.visitMethodDeclaration(node);\n+    }\n+\n+    private isAsyncFunction(node: ts.Node): boolean {\n+        return this.getAsyncModifier(node) !== undefined;\n+    }\n+\n+    private getAsyncModifier(node: ts.Node) {","path":"src/rules/noAsyncWithoutAwaitRule.ts","position":63,"original_position":63,"commit_id":"4f51780833fa28bdb1bc60eccb06b7caff01e1d2","original_commit_id":"7e11840892b8db8a6302b9761218a898975644f0","user":{"login":"eranshabi","id":18072755,"node_id":"MDQ6VXNlcjE4MDcyNzU1","avatar_url":"https://avatars3.githubusercontent.com/u/18072755?v=4","gravatar_id":"","url":"https://api.github.com/users/eranshabi","html_url":"https://github.com/eranshabi","followers_url":"https://api.github.com/users/eranshabi/followers","following_url":"https://api.github.com/users/eranshabi/following{/other_user}","gists_url":"https://api.github.com/users/eranshabi/gists{/gist_id}","starred_url":"https://api.github.com/users/eranshabi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eranshabi/subscriptions","organizations_url":"https://api.github.com/users/eranshabi/orgs","repos_url":"https://api.github.com/users/eranshabi/repos","events_url":"https://api.github.com/users/eranshabi/events{/privacy}","received_events_url":"https://api.github.com/users/eranshabi/received_events","type":"User","site_admin":false},"body":"it is actually used in line 120 to get some data about the modifier","created_at":"2018-11-19T17:48:26Z","updated_at":"2018-11-19T17:48:26Z","html_url":"https://github.com/palantir/tslint/pull/3945#discussion_r234718310","pull_request_url":"https://api.github.com/repos/palantir/tslint/pulls/3945","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/palantir/tslint/pulls/comments/234718310"},"html":{"href":"https://github.com/palantir/tslint/pull/3945#discussion_r234718310"},"pull_request":{"href":"https://api.github.com/repos/palantir/tslint/pulls/3945"}},"in_reply_to_id":231348596},"pull_request":{"url":"https://api.github.com/repos/palantir/tslint/pulls/3945","id":193036452,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMDM2NDUy","html_url":"https://github.com/palantir/tslint/pull/3945","diff_url":"https://github.com/palantir/tslint/pull/3945.diff","patch_url":"https://github.com/palantir/tslint/pull/3945.patch","issue_url":"https://api.github.com/repos/palantir/tslint/issues/3945","number":3945,"state":"open","locked":false,"title":"[New Rule] add noAsyncWithoutAwait rule","user":{"login":"eranshabi","id":18072755,"node_id":"MDQ6VXNlcjE4MDcyNzU1","avatar_url":"https://avatars3.githubusercontent.com/u/18072755?v=4","gravatar_id":"","url":"https://api.github.com/users/eranshabi","html_url":"https://github.com/eranshabi","followers_url":"https://api.github.com/users/eranshabi/followers","following_url":"https://api.github.com/users/eranshabi/following{/other_user}","gists_url":"https://api.github.com/users/eranshabi/gists{/gist_id}","starred_url":"https://api.github.com/users/eranshabi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eranshabi/subscriptions","organizations_url":"https://api.github.com/users/eranshabi/orgs","repos_url":"https://api.github.com/users/eranshabi/repos","events_url":"https://api.github.com/users/eranshabi/events{/privacy}","received_events_url":"https://api.github.com/users/eranshabi/received_events","type":"User","site_admin":false},"body":"#### PR checklist\r\n\r\n- [X] Addresses an existing issue:  #3937\r\n- [X] New feature\r\n  - [X] Includes tests\r\n- [X] Documentation update\r\n\r\n#### Overview of change:\r\nAdd a new rule (\"noAsyncWithoutAwait\"). The rule makes sure that a function will not be an `async` function, unless it has an `await`;\r\n\r\n#### Is there anything you'd like reviewers to focus on?\r\n\r\n<!-- optional -->\r\n\r\n#### CHANGELOG.md entry:\r\n\r\n[new-rule] `no-async-without-await`\r\n","created_at":"2018-06-06T14:39:06Z","updated_at":"2018-11-19T17:48:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34fe06093eb69f81bfc10ec53136c5adeb0afb36","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":236421827,"node_id":"MDU6TGFiZWwyMzY0MjE4Mjc=","url":"https://api.github.com/repos/palantir/tslint/labels/PR:%20waiting%20for%20author","name":"PR: waiting for author","color":"FBEA92","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/palantir/tslint/pulls/3945/commits","review_comments_url":"https://api.github.com/repos/palantir/tslint/pulls/3945/comments","review_comment_url":"https://api.github.com/repos/palantir/tslint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/tslint/issues/3945/comments","statuses_url":"https://api.github.com/repos/palantir/tslint/statuses/4f51780833fa28bdb1bc60eccb06b7caff01e1d2","head":{"label":"eranshabi:master","ref":"master","sha":"4f51780833fa28bdb1bc60eccb06b7caff01e1d2","user":{"login":"eranshabi","id":18072755,"node_id":"MDQ6VXNlcjE4MDcyNzU1","avatar_url":"https://avatars3.githubusercontent.com/u/18072755?v=4","gravatar_id":"","url":"https://api.github.com/users/eranshabi","html_url":"https://github.com/eranshabi","followers_url":"https://api.github.com/users/eranshabi/followers","following_url":"https://api.github.com/users/eranshabi/following{/other_user}","gists_url":"https://api.github.com/users/eranshabi/gists{/gist_id}","starred_url":"https://api.github.com/users/eranshabi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eranshabi/subscriptions","organizations_url":"https://api.github.com/users/eranshabi/orgs","repos_url":"https://api.github.com/users/eranshabi/repos","events_url":"https://api.github.com/users/eranshabi/events{/privacy}","received_events_url":"https://api.github.com/users/eranshabi/received_events","type":"User","site_admin":false},"repo":{"id":136190234,"node_id":"MDEwOlJlcG9zaXRvcnkxMzYxOTAyMzQ=","name":"tslint","full_name":"eranshabi/tslint","private":false,"owner":{"login":"eranshabi","id":18072755,"node_id":"MDQ6VXNlcjE4MDcyNzU1","avatar_url":"https://avatars3.githubusercontent.com/u/18072755?v=4","gravatar_id":"","url":"https://api.github.com/users/eranshabi","html_url":"https://github.com/eranshabi","followers_url":"https://api.github.com/users/eranshabi/followers","following_url":"https://api.github.com/users/eranshabi/following{/other_user}","gists_url":"https://api.github.com/users/eranshabi/gists{/gist_id}","starred_url":"https://api.github.com/users/eranshabi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eranshabi/subscriptions","organizations_url":"https://api.github.com/users/eranshabi/orgs","repos_url":"https://api.github.com/users/eranshabi/repos","events_url":"https://api.github.com/users/eranshabi/events{/privacy}","received_events_url":"https://api.github.com/users/eranshabi/received_events","type":"User","site_admin":false},"html_url":"https://github.com/eranshabi/tslint","description":":vertical_traffic_light: An extensible linter for the TypeScript language","fork":true,"url":"https://api.github.com/repos/eranshabi/tslint","forks_url":"https://api.github.com/repos/eranshabi/tslint/forks","keys_url":"https://api.github.com/repos/eranshabi/tslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eranshabi/tslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eranshabi/tslint/teams","hooks_url":"https://api.github.com/repos/eranshabi/tslint/hooks","issue_events_url":"https://api.github.com/repos/eranshabi/tslint/issues/events{/number}","events_url":"https://api.github.com/repos/eranshabi/tslint/events","assignees_url":"https://api.github.com/repos/eranshabi/tslint/assignees{/user}","branches_url":"https://api.github.com/repos/eranshabi/tslint/branches{/branch}","tags_url":"https://api.github.com/repos/eranshabi/tslint/tags","blobs_url":"https://api.github.com/repos/eranshabi/tslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eranshabi/tslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eranshabi/tslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/eranshabi/tslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eranshabi/tslint/statuses/{sha}","languages_url":"https://api.github.com/repos/eranshabi/tslint/languages","stargazers_url":"https://api.github.com/repos/eranshabi/tslint/stargazers","contributors_url":"https://api.github.com/repos/eranshabi/tslint/contributors","subscribers_url":"https://api.github.com/repos/eranshabi/tslint/subscribers","subscription_url":"https://api.github.com/repos/eranshabi/tslint/subscription","commits_url":"https://api.github.com/repos/eranshabi/tslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/eranshabi/tslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/eranshabi/tslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/eranshabi/tslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/eranshabi/tslint/contents/{+path}","compare_url":"https://api.github.com/repos/eranshabi/tslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eranshabi/tslint/merges","archive_url":"https://api.github.com/repos/eranshabi/tslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eranshabi/tslint/downloads","issues_url":"https://api.github.com/repos/eranshabi/tslint/issues{/number}","pulls_url":"https://api.github.com/repos/eranshabi/tslint/pulls{/number}","milestones_url":"https://api.github.com/repos/eranshabi/tslint/milestones{/number}","notifications_url":"https://api.github.com/repos/eranshabi/tslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eranshabi/tslint/labels{/name}","releases_url":"https://api.github.com/repos/eranshabi/tslint/releases{/id}","deployments_url":"https://api.github.com/repos/eranshabi/tslint/deployments","created_at":"2018-06-05T14:31:32Z","updated_at":"2018-11-19T17:23:13Z","pushed_at":"2018-11-19T17:23:04Z","git_url":"git://github.com/eranshabi/tslint.git","ssh_url":"git@github.com:eranshabi/tslint.git","clone_url":"https://github.com/eranshabi/tslint.git","svn_url":"https://github.com/eranshabi/tslint","homepage":"http://palantir.github.io/tslint/","size":13678,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"palantir:master","ref":"master","sha":"6a4edd6d61808f9cf2be546cd699520a2d176d4d","user":{"login":"palantir","id":303157,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMzE1Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":11672345,"node_id":"MDEwOlJlcG9zaXRvcnkxMTY3MjM0NQ==","name":"tslint","full_name":"palantir/tslint","private":false,"owner":{"login":"palantir","id":303157,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMzE1Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/palantir/tslint","description":":vertical_traffic_light: An extensible linter for the TypeScript language","fork":false,"url":"https://api.github.com/repos/palantir/tslint","forks_url":"https://api.github.com/repos/palantir/tslint/forks","keys_url":"https://api.github.com/repos/palantir/tslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/tslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/tslint/teams","hooks_url":"https://api.github.com/repos/palantir/tslint/hooks","issue_events_url":"https://api.github.com/repos/palantir/tslint/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/tslint/events","assignees_url":"https://api.github.com/repos/palantir/tslint/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/tslint/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/tslint/tags","blobs_url":"https://api.github.com/repos/palantir/tslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/tslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/tslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/tslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/tslint/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/tslint/languages","stargazers_url":"https://api.github.com/repos/palantir/tslint/stargazers","contributors_url":"https://api.github.com/repos/palantir/tslint/contributors","subscribers_url":"https://api.github.com/repos/palantir/tslint/subscribers","subscription_url":"https://api.github.com/repos/palantir/tslint/subscription","commits_url":"https://api.github.com/repos/palantir/tslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/tslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/tslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/tslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/tslint/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/tslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/tslint/merges","archive_url":"https://api.github.com/repos/palantir/tslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/tslint/downloads","issues_url":"https://api.github.com/repos/palantir/tslint/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/tslint/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/tslint/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/tslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/tslint/labels{/name}","releases_url":"https://api.github.com/repos/palantir/tslint/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/tslint/deployments","created_at":"2013-07-25T22:19:18Z","updated_at":"2018-11-19T17:41:08Z","pushed_at":"2018-11-19T17:23:06Z","git_url":"git://github.com/palantir/tslint.git","ssh_url":"git@github.com:palantir/tslint.git","clone_url":"https://github.com/palantir/tslint.git","svn_url":"https://github.com/palantir/tslint","homepage":"http://palantir.github.io/tslint/","size":13837,"stargazers_count":4222,"watchers_count":4222,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":768,"mirror_url":null,"archived":false,"open_issues_count":540,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":768,"open_issues":540,"watchers":4222,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/tslint/pulls/3945"},"html":{"href":"https://github.com/palantir/tslint/pull/3945"},"issue":{"href":"https://api.github.com/repos/palantir/tslint/issues/3945"},"comments":{"href":"https://api.github.com/repos/palantir/tslint/issues/3945/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/tslint/pulls/3945/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/tslint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/tslint/pulls/3945/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/tslint/statuses/4f51780833fa28bdb1bc60eccb06b7caff01e1d2"}},"author_association":"NONE"}}
{"actor":{"display_login":"eranshabi"}}