Skip to content

matchDescription doesn't check block description on class definition #420

@Leedehai

Description

@Leedehai

Hi, I found rule jsdoc/match-description is not checking the block description on class definition.

Repro example:

// this doesn't match the regex, but no error was reported
/**
 * blabla
 * @extends Base
 */
class C1 extends Base {
    constructor() {
        super();
        this.a = 1;
    }
}

// this doesn't match the regex either, but no error was reported
/**
 * ?blabla
 * @extends Base
 */
class C2 extends Base {
    constructor() {
        super();
        this.a = 1;
    }
}

// this also doesn't match the regex, but no error was reported
/**
 * blabla
 * @extends Base
 */
const C3 = class extends Base {
    constructor() {
        super();
        this.a = 1;
    }
};

// error reported: JSDoc description does not satisfy the regex
// pattern  jsdoc/match-description
/**
 * aa
 * @param {*} a aaaa
 * @param {*} b aaaa
 */
function foo(a, b) {

}

The .eslintrc config is:

      "jsdoc/match-description": [ "error", {
            "matchDescription": "^([A-Z]|[`\\d_])[\\s\\S]*[.?!`]$",
            "tags": {
                "param": "(|^[A-Za-z][\\s\\S]*$)",
                "returns": "(|^[A-Za-z][\\s\\S]*$)"
            }
        }],

Versions:
"eslint": "^6.6.0",
"eslint-plugin-jsdoc": "^15.12.2",
"npm -v": 6.11.3
"node -v": v12.10.0
OS: macOS 10.14.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions