Aller au contenu

Common rules

Copy of sumaris-app/.agents/rules/common.md (rule written for AI coding agents, always applied). Do not edit here: run npm run site:sync-rules to update it.

  • Write comments and console log in English;
  • Write unit test when possible, using Jasmine;
  • Write components without the .components.<extension> suffix. Use functional suffix instead:
    • .page.<extension> for a page (should extend AppEntityEditor or subclasses);
    • .form.<extension> for a reusable reactive form component (should extend AppForm - or subclasses);
    • .table.<extension> for a reusable table component (should extend AppTable or AppSyncTabke - or subclasses);
    • .service.ts for services;
    • .class.ts for abstract classes;
    • .utils.ts for helper classes or useful functions;
    • .config.ts for enumerations (configuration option, ...);
  • Use Ionic components when possible, or Angular Material components;
  • Use Ionic icons (<ion-icon> or Material icons (mat-icon - old version);
  • Use changeDetection: ChangeDetectionStrategy.OnPush for components;
  • By default, use standard Angular 21 conventions (e.g. prefer modern conditions like @if or @for, instead of *ngIf or *ngFor);
  • Prefer inject() (as a class field, declared above the constructor) over constructor-parameter injection for services and other dependencies — this is the convention used across the codebase since the Angular 21 migration;