no-httpinterceptors-token
August 20, 2026 · View on GitHub
Restrict the usage of HTTP_INTERCEPTORS which was the way to provide legacy class-based interceptors.
Use provideHttpClient(withInterceptors()) with functional interceptors instead.
Documentation
Configuration
- in the
recommendedpreset - in the
functionalpreset - or just this rule:
{
rules: {
'eslint-plugin-angular-modern/no-httpinterceptors-token': 'error'
}
}
Tip
See the README for the global and presets configuration.
❌ Invalid
@NgModule({
imports: [
HttpClientModule,
],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
],
})
export class AppModule {}
✅ Valid
export const appConfig: ApplicationConfig = {
providers: [
provideHttpClient(
withInterceptors([authInterceptor]),
),
],
};