Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Issue Description
Angular contains some classes that are deprecated. Because you access these types using dependency injection and don't create an instance of them yourself, the no-deprecated
rule will not report that they are deprecated.
For example, given this code:
import { inject, ComponentFactoryResolver } from '@angular/core';
const f1: ComponentFactoryResolver = new ComponentFactoryResolver();
const f2: ComponentFactoryResolver = inject(ComponentFactoryResolver);
The usage of ComponentFactoryResolver
on line 3 (the f1
instance) is reported at column 42 (new ComponentFactoryResolver
). However, that is not how you would use this type. Instead, you would get an instance of ComponentFactoryResolver
using dependency injection, either by using the inject
function (the f2
instance), or by using a constructor parameter like
constructor(factory: ComponentFactoryResolver) {}
Because of this style of usage, the no-deprecated
rule does not report any usage of deprecated classes.
Reproduction Repository Link
https://github.com/reduckted/repro-tseslint-no-deprecated
Repro Steps
- clone the repo
npm install
npm run lint
Versions
package | version |
---|---|
typescript-eslint |
8.4.0 |
TypeScript |
5.5.4 |
ESLint |
9.9.1 |
node |
22.2.0 |