Eslint-plugin-jsdoc: require-jsdoc ignores TypeScript interface members

Created on 8 Oct 2020  路  2Comments  路  Source: gajus/eslint-plugin-jsdoc

I see some work has been done recently to support TypeScript interfaces for the require-jsdoc rule. Thanks! I can get it to require documentation for the interface itself, but unfortunately not for any of its members.

Expected behavior


Given this TypeScript interface:

export interface Foo {
    bar: number;
    baz: string;
    quux(): void;
}

I would expect lint warnings for missing documentation for bar, baz, and quux, given the presence of "TSPropertySignature" and "TSMethodSignature" in contexts in my config (see below).

Actual behavior


I only receive a lint warning for the missing docs on the Foo interface, but not for any of its properties or methods.

ESLint Config

"jsdoc/require-jsdoc": [
    "warn",
    {
        "publicOnly": true,
        "require": {
            "ArrowFunctionExpression": true,
            "ClassDeclaration": true,
            "ClassExpression": true,
            "FunctionDeclaration": true,
            "FunctionExpression": true,
            "MethodDefinition": true
        },
        "contexts": [
            "ArrowFunctionExpression",
            "FunctionDeclaration",
            "FunctionExpression",
            "MethodDefinition",
            "Property",
            "TSDeclareFunction",
            "TSEnumDeclaration",
            "TSInterfaceDeclaration",
            "TSMethodSignature",
            "TSPropertySignature",
            "TSTypeAliasDeclaration",
            "VariableDeclaration"
        ],
        "checkGetters": true,
        "enableFixer": false
    }
]

ESLint sample

See interface in Actual behavior above.

Environment

  • Node version: 12.18.0
  • ESLint version 7.10.0
  • eslint-plugin-jsdoc version: 30.6.3
bug released

Most helpful comment

Thanks for the quick fix! Seems to be working. Now I have a bunch of documentation to write :smile:.

All 2 comments

:tada: This issue has been resolved in version 30.6.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Thanks for the quick fix! Seems to be working. Now I have a bunch of documentation to write :smile:.

Was this page helpful?
0 / 5 - 0 ratings