{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/tslint/pulls/comments/108315242","pull_request_review_id":29338936,"id":108315242,"diff_hunk":"@@ -0,0 +1,97 @@\n+/**\n+ * @license\n+ * Copyright 2016 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+\n+export class Rule extends Lint.Rules.TypedRule {\n+\n+    /* tslint:disable:object-literal-sort-keys */\n+    public static metadata: Lint.IRuleMetadata = {\n+        ruleName: \"deprecation\",\n+        description: \"Warns when deprecated APIs are used.\",\n+        descriptionDetails: Lint.Utils.dedent`Any usage of an identifier\n+            with the @deprecated JSDoc annotation will trigger a warning.\n+            See http://usejsdoc.org/tags-deprecated.html`,\n+        rationale: Lint.Utils.dedent`\n+            Deprecated APIs should be avoided, and usage updated.`,\n+        optionsDescription: \"\",\n+        options: null,\n+        optionExamples: [],\n+        type: \"maintainability\",\n+        typescriptOnly: false,\n+        requiresTypeInfo: true,\n+    };\n+    /* tslint:enable:object-literal-sort-keys */\n+    public applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[] {\n+        return this.applyWithWalker(new Walker(sourceFile, this.getOptions(), program));\n+    }\n+}\n+\n+class Walker extends Lint.ProgramAwareRuleWalker {\n+  // Implementation inspired by angular/tsickle:\n+  // https://github.com/angular/tsickle/blob/cad7c180a2155db6f6fb8d22c44151d7e8a9149f/src/decorator-annotator.ts#L42\n+  protected visitIdentifier(node: ts.Identifier) {\n+    let decSym = this.getTypeChecker().getSymbolAtLocation(node);\n+\n+    if (decSym && Lint.isSymbolFlagSet(decSym, ts.SymbolFlags.Alias)) {\n+        decSym = this.getTypeChecker().getAliasedSymbol(decSym);\n+    }\n+    if (!decSym || !decSym.getDeclarations()) {\n+        super.visitIdentifier(node);\n+        return;\n+    }\n+    for (const d of decSym.getDeclarations()) {\n+      // Switch to the TS JSDoc parser in the future to avoid false positives here.\n+      // For example using '@deprecated' in a true comment.\n+      // However, a new TS API would be needed, track at\n+      // https://github.com/Microsoft/TypeScript/issues/7393.\n+      let commentNode: ts.Node = d;\n+\n+      if (commentNode.kind === ts.SyntaxKind.VariableDeclaration) {\n+          if (!commentNode.parent) { continue; }","path":"src/rules/deprecationRule.ts","position":66,"original_position":66,"commit_id":"9baeb594797baaa69c75fccd4a57c969dd646c5b","original_commit_id":"9baeb594797baaa69c75fccd4a57c969dd646c5b","user":{"login":"andy-hanson","id":5387404,"avatar_url":"https://avatars3.githubusercontent.com/u/5387404?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-hanson","html_url":"https://github.com/andy-hanson","followers_url":"https://api.github.com/users/andy-hanson/followers","following_url":"https://api.github.com/users/andy-hanson/following{/other_user}","gists_url":"https://api.github.com/users/andy-hanson/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-hanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-hanson/subscriptions","organizations_url":"https://api.github.com/users/andy-hanson/orgs","repos_url":"https://api.github.com/users/andy-hanson/repos","events_url":"https://api.github.com/users/andy-hanson/events{/privacy}","received_events_url":"https://api.github.com/users/andy-hanson/received_events","type":"User","site_admin":false},"body":"Just use the null assertion (`!`) operator here. Parent pointers should be set within lint rules.","created_at":"2017-03-28T01:06:40Z","updated_at":"2017-03-28T01:06:40Z","html_url":"https://github.com/palantir/tslint/pull/2395#discussion_r108315242","pull_request_url":"https://api.github.com/repos/palantir/tslint/pulls/2395","_links":{"self":{"href":"https://api.github.com/repos/palantir/tslint/pulls/comments/108315242"},"html":{"href":"https://github.com/palantir/tslint/pull/2395#discussion_r108315242"},"pull_request":{"href":"https://api.github.com/repos/palantir/tslint/pulls/2395"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/tslint/pulls/2395","id":112359126,"html_url":"https://github.com/palantir/tslint/pull/2395","diff_url":"https://github.com/palantir/tslint/pull/2395.diff","patch_url":"https://github.com/palantir/tslint/pull/2395.patch","issue_url":"https://api.github.com/repos/palantir/tslint/issues/2395","number":2395,"state":"open","locked":false,"title":"deprecation rule","user":{"login":"alexeagle","id":47395,"avatar_url":"https://avatars1.githubusercontent.com/u/47395?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeagle","html_url":"https://github.com/alexeagle","followers_url":"https://api.github.com/users/alexeagle/followers","following_url":"https://api.github.com/users/alexeagle/following{/other_user}","gists_url":"https://api.github.com/users/alexeagle/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeagle/subscriptions","organizations_url":"https://api.github.com/users/alexeagle/orgs","repos_url":"https://api.github.com/users/alexeagle/repos","events_url":"https://api.github.com/users/alexeagle/events{/privacy}","received_events_url":"https://api.github.com/users/alexeagle/received_events","type":"User","site_admin":false},"body":"#### PR checklist\r\n\r\nFixes #825\r\n\r\n#### Overview of change:\r\n\r\nWarn when @deprecated APIs are used.\r\n\r\n#### Is there anything you'd like reviewers to focus on?\r\n\r\nMissing lots of test cases.\r\n\r\n#### CHANGELOG.md entry:\r\n\r\n<!-- optional (example: \"[new-rule] `arrow-return-shorthand`\") -->\r\n\r\n[new-rule]\r\n","created_at":"2017-03-23T23:22:34Z","updated_at":"2017-03-28T01:06:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4980fd5b6e6996ea7738f3fe85224a870b1301d5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/palantir/tslint/pulls/2395/commits","review_comments_url":"https://api.github.com/repos/palantir/tslint/pulls/2395/comments","review_comment_url":"https://api.github.com/repos/palantir/tslint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/tslint/issues/2395/comments","statuses_url":"https://api.github.com/repos/palantir/tslint/statuses/9baeb594797baaa69c75fccd4a57c969dd646c5b","head":{"label":"alexeagle:deprecated","ref":"deprecated","sha":"9baeb594797baaa69c75fccd4a57c969dd646c5b","user":{"login":"alexeagle","id":47395,"avatar_url":"https://avatars1.githubusercontent.com/u/47395?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeagle","html_url":"https://github.com/alexeagle","followers_url":"https://api.github.com/users/alexeagle/followers","following_url":"https://api.github.com/users/alexeagle/following{/other_user}","gists_url":"https://api.github.com/users/alexeagle/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeagle/subscriptions","organizations_url":"https://api.github.com/users/alexeagle/orgs","repos_url":"https://api.github.com/users/alexeagle/repos","events_url":"https://api.github.com/users/alexeagle/events{/privacy}","received_events_url":"https://api.github.com/users/alexeagle/received_events","type":"User","site_admin":false},"repo":{"id":38075540,"name":"tslint","full_name":"alexeagle/tslint","owner":{"login":"alexeagle","id":47395,"avatar_url":"https://avatars1.githubusercontent.com/u/47395?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeagle","html_url":"https://github.com/alexeagle","followers_url":"https://api.github.com/users/alexeagle/followers","following_url":"https://api.github.com/users/alexeagle/following{/other_user}","gists_url":"https://api.github.com/users/alexeagle/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeagle/subscriptions","organizations_url":"https://api.github.com/users/alexeagle/orgs","repos_url":"https://api.github.com/users/alexeagle/repos","events_url":"https://api.github.com/users/alexeagle/events{/privacy}","received_events_url":"https://api.github.com/users/alexeagle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexeagle/tslint","description":"A linter for the TypeScript language.","fork":true,"url":"https://api.github.com/repos/alexeagle/tslint","forks_url":"https://api.github.com/repos/alexeagle/tslint/forks","keys_url":"https://api.github.com/repos/alexeagle/tslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexeagle/tslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexeagle/tslint/teams","hooks_url":"https://api.github.com/repos/alexeagle/tslint/hooks","issue_events_url":"https://api.github.com/repos/alexeagle/tslint/issues/events{/number}","events_url":"https://api.github.com/repos/alexeagle/tslint/events","assignees_url":"https://api.github.com/repos/alexeagle/tslint/assignees{/user}","branches_url":"https://api.github.com/repos/alexeagle/tslint/branches{/branch}","tags_url":"https://api.github.com/repos/alexeagle/tslint/tags","blobs_url":"https://api.github.com/repos/alexeagle/tslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexeagle/tslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexeagle/tslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexeagle/tslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexeagle/tslint/statuses/{sha}","languages_url":"https://api.github.com/repos/alexeagle/tslint/languages","stargazers_url":"https://api.github.com/repos/alexeagle/tslint/stargazers","contributors_url":"https://api.github.com/repos/alexeagle/tslint/contributors","subscribers_url":"https://api.github.com/repos/alexeagle/tslint/subscribers","subscription_url":"https://api.github.com/repos/alexeagle/tslint/subscription","commits_url":"https://api.github.com/repos/alexeagle/tslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexeagle/tslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexeagle/tslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexeagle/tslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexeagle/tslint/contents/{+path}","compare_url":"https://api.github.com/repos/alexeagle/tslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexeagle/tslint/merges","archive_url":"https://api.github.com/repos/alexeagle/tslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexeagle/tslint/downloads","issues_url":"https://api.github.com/repos/alexeagle/tslint/issues{/number}","pulls_url":"https://api.github.com/repos/alexeagle/tslint/pulls{/number}","milestones_url":"https://api.github.com/repos/alexeagle/tslint/milestones{/number}","notifications_url":"https://api.github.com/repos/alexeagle/tslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexeagle/tslint/labels{/name}","releases_url":"https://api.github.com/repos/alexeagle/tslint/releases{/id}","deployments_url":"https://api.github.com/repos/alexeagle/tslint/deployments","created_at":"2015-06-25T21:36:13Z","updated_at":"2016-07-12T01:19:56Z","pushed_at":"2017-03-27T16:54:13Z","git_url":"git://github.com/alexeagle/tslint.git","ssh_url":"git@github.com:alexeagle/tslint.git","clone_url":"https://github.com/alexeagle/tslint.git","svn_url":"https://github.com/alexeagle/tslint","homepage":null,"size":11400,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"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":"palantir:master","ref":"master","sha":"da6ce1b0215f16686ecf26b46ad6bf6283ed4cd9","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars3.githubusercontent.com/u/303157?v=3","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,"name":"tslint","full_name":"palantir/tslint","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars3.githubusercontent.com/u/303157?v=3","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},"private":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":"2017-03-27T21:19:06Z","pushed_at":"2017-03-28T01:03:56Z","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":11778,"stargazers_count":1615,"watchers_count":1615,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":366,"mirror_url":null,"open_issues_count":383,"forks":366,"open_issues":383,"watchers":1615,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/tslint/pulls/2395"},"html":{"href":"https://github.com/palantir/tslint/pull/2395"},"issue":{"href":"https://api.github.com/repos/palantir/tslint/issues/2395"},"comments":{"href":"https://api.github.com/repos/palantir/tslint/issues/2395/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/tslint/pulls/2395/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/tslint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/tslint/pulls/2395/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/tslint/statuses/9baeb594797baaa69c75fccd4a57c969dd646c5b"}}}}
{"actor":{"display_login":"andy-hanson"}}