From e609d6311de5b7db61dbfa96745fc591a852f6b3 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 18 Sep 2020 08:49:43 -0700 Subject: [PATCH] Add @see tag (#310) * Add support for @see tag Also fix no-redundant-jsdoc2 test. It was not testing anything before. * Move test to correctly named folder --- src/rules/noRedundantJsdoc2Rule.ts | 7 ++++--- .../test.ts.lint} | 2 ++ .../tslint.json | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) rename test/{no-redundant-jsdoc/declarationFile.d.ts => no-redundant-jsdoc2/test.ts.lint} (53%) rename test/{no-redundant-jsdoc => no-redundant-jsdoc2}/tslint.json (65%) diff --git a/src/rules/noRedundantJsdoc2Rule.ts b/src/rules/noRedundantJsdoc2Rule.ts index 803d6bfd..f19547ba 100644 --- a/src/rules/noRedundantJsdoc2Rule.ts +++ b/src/rules/noRedundantJsdoc2Rule.ts @@ -59,11 +59,12 @@ function walk(ctx: Lint.WalkContext): void { }); function checkTag(tag: ts.JSDocTag): void { - // @ts-ignore (until support for 4.0 is added) - const jsdocDeprecatedTag = ts.SyntaxKind.JSDocDeprecatedTag || 0; + const jsdocSeeTag = (ts.SyntaxKind as any).JSDocSeeTag || 0; + const jsdocDeprecatedTag = (ts.SyntaxKind as any).JSDocDeprecatedTag || 0; switch (tag.kind) { + case jsdocSeeTag: case jsdocDeprecatedTag: - // A deprecated tag always has meaning + // @deprecated and @see always have meaning break; case ts.SyntaxKind.JSDocTag: { const { tagName } = tag; diff --git a/test/no-redundant-jsdoc/declarationFile.d.ts b/test/no-redundant-jsdoc2/test.ts.lint similarity index 53% rename from test/no-redundant-jsdoc/declarationFile.d.ts rename to test/no-redundant-jsdoc2/test.ts.lint index 074a3ca8..99bcb1f1 100644 --- a/test/no-redundant-jsdoc/declarationFile.d.ts +++ b/test/no-redundant-jsdoc2/test.ts.lint @@ -1,2 +1,4 @@ /** @deprecated */ export const x: number; +/** @see x */ +export const y: number; diff --git a/test/no-redundant-jsdoc/tslint.json b/test/no-redundant-jsdoc2/tslint.json similarity index 65% rename from test/no-redundant-jsdoc/tslint.json rename to test/no-redundant-jsdoc2/tslint.json index a1e6f1bd..222912b6 100644 --- a/test/no-redundant-jsdoc/tslint.json +++ b/test/no-redundant-jsdoc2/tslint.json @@ -1,6 +1,6 @@ { "rulesDirectory": ["../../bin/rules"], "rules": { - "no-redundant-jsdoc": true + "no-redundant-jsdoc2": true } }