Tslint: completed-docs not working as expected with interfaces only

Created on 2 Apr 2019  ยท  5Comments  ยท  Source: palantir/tslint

Bug Report

  • __TSLint version__: 5.14.0
  • __TypeScript version__: 3.1.6
  • __Running TSLint via__: CLI

TypeScript code being linted

// code snippet

/**
* Documentation
*/
interface ISomething {
  /**
  * Documentation
  */
  mySecondAttribute: string;
}

class Something {
  public myAttribute: string;

}

with tslint.json configuration:

{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended",
        "tslint-config-prettier"
    ],
    "jsRules": {},
    "rules": {
        "completed-docs": [true, "interfaces", "properties"],
        "prettier": [true, ".prettierrc"],
        "no-magic-numbers": [true, 0, 1, 2]
    },
    "rulesDirectory": [
        "tslint-plugin-prettier"
    ]
}

Actual behavior

Documentation must exist for properties.

Expected behavior

No TSLint errors. I just want documentation for the properties of the interfaces and the interface itself

Rule Enhancement ๐ŸŒน R.I.P. ๐ŸŒน

Most helpful comment

@JoshuaKGoldberg Hi, thank you for the response, but for me I still not complaining for the interfaces properties, only for the interface itself. So in this example it's fine:

/**
 * Foo
 */
export interface IFoo {
  foo: string;
}

but I want this as the correct one:

export interface IFoo {
 /**
  * Foo
  */
  foo: string;
}

All 5 comments

I'm having the same issue. I want to require documentation for the interface properties and I can't do it. The maximum that I get it's requirement for all properties using: "completed-docs": [true, "interfaces", "properties"],

Interesting. This configuration should work to only enforce documentation on interface properties:

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

Does that work for you?

@JoshuaKGoldberg Hi, thank you for the response, but for me I still not complaining for the interfaces properties, only for the interface itself. So in this example it's fine:

/**
 * Foo
 */
export interface IFoo {
  foo: string;
}

but I want this as the correct one:

export interface IFoo {
 /**
  * Foo
  */
  foo: string;
}

โ˜ ๏ธ TSLint's time has come! โ˜ ๏ธ

TSLint is no longer accepting most feature requests per #4534. See typescript-eslint.io for the new, shiny way to lint your TypeScript code with ESLint. โœจ

It was a pleasure open sourcing with you all!

๐Ÿค– Beep boop! ๐Ÿ‘‰ TSLint is deprecated ๐Ÿ‘ˆ _(#4534)_ and you should switch to typescript-eslint! ๐Ÿค–

๐Ÿ”’ This issue is being locked to prevent further unnecessary discussions. Thank you! ๐Ÿ‘‹

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cateyes99 picture cateyes99  ยท  3Comments

SwintDC picture SwintDC  ยท  3Comments

jacob-robertson picture jacob-robertson  ยท  3Comments

allbto picture allbto  ยท  3Comments

ghost picture ghost  ยท  3Comments