require-no-implicit-override
Require "noImplicitOverride": true in compilerOptions to prevent
subclasses from accidentally overriding base-class methods without the
override keyword.
Targeted pattern scopeโ
The compilerOptions.noImplicitOverride field in any tsconfig*.json file.
What this rule reportsโ
This rule reports when compilerOptions is present and noImplicitOverride is absent or set to false. The rule does not report if compilerOptions is not defined at all.
Why this rule existsโ
Without noImplicitOverride, a subclass method silently shadows a base-class
method of the same name. This makes it easy to accidentally override a method
when the developer intended to add a new one, or to continue calling a method
as "overriding" after the base class renames it.
With noImplicitOverride: true, TypeScript requires the override keyword
on any method that shadows a base-class method, and reports an error if
override is used on a method that does not exist in the base class.
This creates an explicit contract: all intentional overrides are marked, and accidental name collisions surface as compiler errors.
The auto-fixer adds "noImplicitOverride": true to compilerOptions.
โ Incorrectโ
{
"compilerOptions": {
"strict": true
}
}
noImplicitOverride is not part of strict and must be set explicitly.
โ Correctโ
{
"compilerOptions": {
"strict": true,
"noImplicitOverride": true
}
}
When not to use itโ
Disable this rule for codebases with a large number of class hierarchies that
have not yet adopted the override keyword and where the migration effort is
not currently planned.
Package documentationโ
Rule catalog ID: R020