Tslint: no-redundant-jsdoc throws error when encountering @constructor tag

Created on 15 Dec 2017  路  7Comments  路  Source: palantir/tslint

Bug Report

  • __TSLint version__: 5.8.0
  • __TypeScript version__: 2.6.2
  • __Running TSLint via__: CLI

TypeScript code being linted

class Foo {
    /**
     * @constructor
     */
    constructor() { }
}

with tslint.json configuration:

{
    "rules": {
        "no-redundant-jsdoc": true
    }
}

Actual behavior

TSLint fails with an error:

Error: Unexpected tag kind: JSDocClassTag
    at checkTag (C:\Code\repro\node_modules\tslint\lib\rules\noRedundantJsdocRule.js:99:23)
    at cb (C:\Code\repro\node_modules\tslint\lib\rules\noRedundantJsdocRule.js:62:25)
    at visitNodes (C:\Code\repro\node_modules\typescript\lib\typescript.js:12699:30)
    at Object.forEachChild (C:\Code\repro\node_modules\typescript\lib\typescript.js:12950:21)
    at cb (C:\Code\repro\node_modules\tslint\lib\rules\noRedundantJsdocRule.js:67:19)
    at Array.forEach (native)
    at walk (C:\Code\repro\node_modules\tslint\lib\rules\noRedundantJsdocRule.js:55:34)
    at Rule.AbstractRule.applyWithFunction (C:\Code\repro\node_modules\tslint\lib\language\rule\abstractRule.js:39:9)
    at Rule.apply (C:\Code\repro\node_modules\tslint\lib\rules\noRedundantJsdocRule.js:35:21)
    at Linter.applyRule (C:\Code\repro\node_modules\tslint\lib\linter.js:177:29)

Expected behavior

TSLint should run without error and produce no tslint errors or warnings.

Accepting PRs Bug good first issue

Most helpful comment

Not reproducible in 5.11.0-32-g237fd905

All 7 comments

TSLint should run without error

Agreed.

... and produce no tslint errors or warnings.

I don't agree with this. To me it seems pretty redundant.

To me it seems pretty redundant.

True, it is a bit redundant, but if I'm also using completed-docs and _didn't_ add the @constructor tag, then wouldn't it complain that there is no JSDoc comment on the constructor? I haven't tried it, but I assume that's what would happen.

I should add that I'd be OK with it flagging the @constructor as redundant for now.

@reduckted completed-docs only cares about the comment part of JSDoc. It completely ignores any tags unless you use the new existence or content config options.

Hmm, that's interesting. I thought completed-docs would complain if there was no JSDoc comment on a constructor, but I just tried it out and that doesn't seem to be the case. Sounds like it might be a bug in that rule (or at least it might require an option to check constructors). I'll investigate that further and create another issue if necessary.

Not reproducible in 5.11.0-32-g237fd905

Yep, looks like it was fixed at some point. I'll close this issue then.

Was this page helpful?
0 / 5 - 0 ratings