Skip to content

Support override and private typescript modifiers #759

@Lusito

Description

@Lusito

Motivation

TypeScript supports override and private keywords, but overrideReplacesDocs and ignorePrivate do not work with them. They require the jsdoc annotations.

Current behavior

export abstract class A {
    /**
     * The update method called every tick.
     *
     * @param deltaTime The time passed since last frame in seconds.
     */
    public abstract update(deltaTime: number): void;

   // Missing JSDoc comment. eslint (jsdoc/require-jsdoc)
    private doStuff() {
        // ....
    }
}

export class B extends A {
   // Missing JSDoc comment. eslint (jsdoc/require-jsdoc)
    public override update(deltaTime: number) {
        // ...
    }
}

Desired behavior

export abstract class A {
    /**
     * The update method called every tick.
     *
     * @param deltaTime The time passed since last frame in seconds.
     */
    public abstract update(deltaTime: number): void;

   // OK
    private doStuff() {
        // ....
    }
}

export class B extends A {
   // OK
    public override update(deltaTime: number) {
        // ...
    }
}

Alternatives considered

  • Manually adding @private and @override to the jsdoc.
  • Disabling the eslint rule on a per line basis

Thanks for the good work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions