Tslint: [completed-docs] Interface members are not checked

Created on 30 Nov 2017  路  5Comments  路  Source: palantir/tslint

Bug Report

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

TypeScript code being linted

/**
 * Some interface.
 */
interface SomeInterface {
    prop: number;
    method(): number;
 }

with tslint.json configuration:

{
  "rules": {
    "completed-docs": [
      true,
      "interfaces",
      "methods",
      "properties"
    ]
  }
}

Actual behavior

No errors.

Expected behavior

prop and method should require documentation.

In Discussion Enhancement

All 5 comments

This seemed like it would be a fairly simple fix - the rule wasn't checking PropertySignature or MethodSignature nodes. After adding cases to check those nodes, it started producing errors where the properties and methods didn't have comments, but it _also_ produced errors where the properties and methods _did_ have comments. 馃槙

From what I could tell, symbol.getDocumentationComment() wasn't finding the documentation comments.

https://github.com/palantir/tslint/blob/fc4e6d314bf1bac10709cb38e76c0976da3af761/src/rules/completedDocsRule.ts#L387-L389

This seems like an upstream issue with TypeScript, but maybe this could be solved if #3376 is implemented.

This makes the rule pretty much useless to anyone who embraces functional class-free programming 馃檨

Since #3376 is a bit controversial, is there an upstream issue filed on TypeScript?

Hey @felixfbecker, thanks for bumping this!

I just took another look to see if anything might have changed in TypeScript since I last looked at this.

As it turns out, the changes I originally made to fix this _were_ working correctly, but the code that I was linting in my tests didn't have proper JSDoc comments. 馃槷 So TypeScript was correctly _not_ finding the JSDoc comments, even though I thought it should.

I fixed that test and everything worked. I've just submitted a PR with the changes to fix this bug. 馃榿

Fixed in #4032 and released in 5.12.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zewa666 picture zewa666  路  3Comments

cretz picture cretz  路  3Comments

dashmug picture dashmug  路  3Comments

ghost picture ghost  路  3Comments

DanielKucal picture DanielKucal  路  3Comments