no-httpclientmodule

August 20, 2026 · View on GitHub

Restrict the usage of deprecated HttpClientModule.

HttpClient service can be used directly in Angular >= 21. If you need configuration (like interceptors), use provideHttpClient() instead.

Documentation

Configuration

{
  rules: {
    'eslint-plugin-angular-modern/no-httpclientmodule': 'error'
  }
}

Tip

This rule is not in the recommended or the standalone presets because @typescript-eslint/no-deprecated already reports this. See the documentation.

❌ Invalid

@NgModule({
  imports: [
    HttpClientModule,
  ],
})
export class AppModule {}

✅ Valid

  • in Angular >= 21, if no special configuration, no import at all

  • with configuration, or in Angular < 21:

export const appConfig: ApplicationConfig = {
  providers: [
    provideHttpClient(),
  ],
};

Back to README