From 57a52a2ee362f7ff62956da2e6511533d4a7af6b Mon Sep 17 00:00:00 2001 From: Tom Lakesman Date: Wed, 1 May 2019 12:22:44 +0100 Subject: [PATCH] Fixes "no-redundant-jsdoc" exception on this tag ``` The 'no-redundant-jsdoc' rule threw an error in 'some-file.ts': Error: Unexpected tag kind: JSDocThisTag ``` This appears to be similar to #3413 --- src/rules/noRedundantJsdocRule.ts | 1 + test/rules/no-redundant-jsdoc/test.ts.lint | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/rules/noRedundantJsdocRule.ts b/src/rules/noRedundantJsdocRule.ts index b249d8abac6..3b7dc681fd9 100644 --- a/src/rules/noRedundantJsdocRule.ts +++ b/src/rules/noRedundantJsdocRule.ts @@ -79,6 +79,7 @@ function walk(ctx: Lint.WalkContext): void { break; case ts.SyntaxKind.JSDocClassTag: + case ts.SyntaxKind.JSDocThisTag: case ts.SyntaxKind.JSDocTypeTag: case ts.SyntaxKind.JSDocTypedefTag: case ts.SyntaxKind.JSDocPropertyTag: diff --git a/test/rules/no-redundant-jsdoc/test.ts.lint b/test/rules/no-redundant-jsdoc/test.ts.lint index b22e99be1bd..2b0becdb727 100644 --- a/test/rules/no-redundant-jsdoc/test.ts.lint +++ b/test/rules/no-redundant-jsdoc/test.ts.lint @@ -1,8 +1,11 @@ /** @typedef {number} T */ ~~~~~~~ [tag % ('typedef')] -/** @function */ +/** @function ~~~~~~~~ [tag % ('function')] + * @this + ~~~~ [tag % ('this')] + */ function f() {} /** @type number */ @@ -12,6 +15,8 @@ const x = 0; /** * @class ~~~~~ [tag % ('class')] + * @this {} + ~~~~ [tag % ('this')] * @param {number} x Is a number ~~~~~~~~ [type] * @param y @@ -25,11 +30,17 @@ const x = 0; */ declare function g(x: number, y: number, z: number): number; +/** + * @this {SomeClass} + ~~~~ [tag % ('this')] + */ +declare function h(); + /** * @param x Useful comment * @returns Useful comment */ -declare function h(x: number): number; +declare function i(x: number): number; /** * @template T, U @@ -38,7 +49,7 @@ declare function h(x: number): number; #endif * @template V Some additional information */ -declare function i(x: T, y: V): U; +declare function j(x: T, y: V): U; [tag]: JSDoc tag '@%s' is redundant in TypeScript code. [type]: Type annotation in JSDoc is redundant in TypeScript code.