Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.12 KB

import-inject-object.md

File metadata and controls

42 lines (29 loc) · 1.12 KB

@rdlabo/rules/import-inject-object

This plugin automatically imports when inject is used but not imported.

  • ✒️ The --fix option on the command line can automatically fix some of the problems reported by this rule.

Rules for automatically importing when inject is used but not imported. Since @rdlabo/rules/deny-constructor-di alone could not auto fix the import statement, made the rule independent.

Rule Details

Deny: use inject function, but not imported.

import { Component } from '@angular/core';

@Component(...)
export class SigninPage {
  private navCtrl = inject(NavController);
  public helper = inject(HelperService);
}

Allow: use inject function, and imported.

import { Component, inject } from '@angular/core';

@Component(...)
export class SigninPage {
  private navCtrl = inject(NavController);
  public helper = inject(HelperService);
}

Options

No Options.

Implementation