New Rule: `no-useless-override`
See original GitHub issueRule details
same as no-useless-constructor
but with overridden methods
Related ECMAScript feature
how new? es6 classes?
What type of rule is this?
Warns about a potential problem
Example code
// fail
class Foo {
bar() {}
}
class Bar extends Foo {
bar() {
super.bar()
}
}
// pass
class Foo {
bar() {}
}
class Bar extends Foo {
bar() {
console.log("doing something else")
super.bar()
}
}
Why should this rule be in the core instead of a plugin?
because no-useless-constructor
is already a core rule and i see no reason why it shouldn’t also check for useless method overrides
Participation
- I am willing to submit a pull request to implement this rule.
Additional comments
originally raised here https://github.com/typescript-eslint/typescript-eslint/issues/4747
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:12 (10 by maintainers)
Top Results From Across the Web
New no-useless-override rule #3423 - palantir/tslint - GitHub
It would be great to have a new rule "no-useless-override" which triggers a warning or error when you use an override to disable...
Read more >Proposed Rules - GovInfo
The proposed rule would rescind certain regulatory changes made effective on November. 16, 2020 and implements new statutory.
Read more >State Enforcement of Inland Navigation Rules - Federal Register
This interim rule will not impose any new costs on vessel operators, or on State and local governments. State and local governments were...
Read more >Employment Law Update 2023: New Compliance Obligations ...
Littler Workplace Policy Institute (WPI) has been tracking a host of new employment laws as they have been debated over the past few...
Read more >Latest Updates | 2023 Federal Rules of Civil Procedure
The following rules were updated: Rules 5, 23, 62, and 65.1. The changes are listed below. New text is underlined while deleted text...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This code actually has a bug - if you call
(new Bar()).bar()
it will throw an error because there is nosuper.bar
. Arrow function instance fields are not methods.bar = () => { super.bar() }
does not have to be useless. Consider the following example: