Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.07 KB

deny-constructor-di.md

File metadata and controls

46 lines (34 loc) · 1.07 KB

@rdlabo/rules/deny-constructor-di

This plugin disallows Dependency Injection within the constructor.

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

Rules for switching Dependency Injection from constructor to inject function.

Rule Details

Deny: Dependency Injection within the constructor.

@Component({
  selector: 'app-confirm',
  templateUrl: './confirm.page.html',
  styleUrls: ['./confirm.page.scss'],
})
export class SigninPage {
  constructor(public platform: Platform) {}
}

Allow: Dependency Injection within the inject function.

@Component({
  selector: 'app-confirm',
  templateUrl: './confirm.page.html',
  styleUrls: ['./confirm.page.scss'],
})
export class SigninPage {
  public readonly platform = inject(Platform);

  constructor() {}
}

Options

No Options.

Implementation