Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enhancement: [naming-convention] Add "override" modifier support #5310

Closed
@eliasm307

Description

@eliasm307

Before You File a Proposal Please Confirm You Have Done The Following...

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Link to the rule's documentation

https://typescript-eslint.io/rules/naming-convention/#how-does-the-rule-automatically-order-selectors

Description

The rule currently supports a few class specific modifiers like 'static'|'public'|'protected'|'private'|'abstract' however it does not support override.

This would be useful in some cases, for example if you dont want private/protected class members to have a leading or trailing underscore in your code base but would like to allow them if you are extending third-party or legacy code class members with leading or trailing underscores where you cannot change them to suite the rule.

Currently, the above requires a lot of eslint ignore comments if the naming convention rule is to be strict (ie "error" level) or softening the rule to warnings.

Fail

// fail depends on what the naming convention is, but the following should trigger a selector with an `override` modifier

class Foo extends Bar {

    protected override attribute = '';

    protected override method() {}

}

Pass

// pass depends on what the naming convention is, but the following should NOT trigger a selector with an `override` modifier
class Foo extends Bar {

    protected attribute = '';

    protected method() {}

}

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulepackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions