Skip to content

Rule Proposal: Override checking #293

@mzyil

Description

@mzyil

Hi, we would like to have an officially supported rule to check for overrides. In a massive code base that is written entirely in TypeScript, small functionalities like these makes a big difference.

There is already a plugin we use (and contribute to) for tslint: https://github.com/hmil/tslint-override

There was a lot of issues surrounding this, but since this project aims to re-design some of the functionality may be it's possible to include support for this as well?

This is the excerpt from the said package README.md: (notice the new lines, we believe it was much prettier)

export class Basic {
    public overridePlease(): void { }
    public doNotOverride(): void { }
}

export class Child extends Basic {
    public doNotOverride(): void { } // ERROR: Method Child#doNotOverride is overriding Basic#doNotOverride. Use the @override JSDoc tag if the override is intended

    // Make it explicit that you intend to override this member
    /** @override */
    public overridePlease(): void { }

    // Alternatively, you can use the decorator syntax
    @override
    public overridePlease(): void { }

    // Typos won't bother you anymore
    /** @override */ public overidePlease(): void { } // ERROR: Method with @override tag is not overriding anything
}

We would also want to contribute to this project if this proposal is seen acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy