Skip to content

ksom/biome-plugin-angular

Repository files navigation

biome-plugin-angular

npm version CI codecov License: MIT Node.js >=18

Biome 2.x plugin that ports @angular-eslint rules to GritQL and adds modern Angular signal-based rules. For Angular 17-21 projects migrating from ESLint to Biome.


Features

  • 20 GritQL rules for Biome 2.x plugin system
  • Ports the most-used @angular-eslint rules
  • 6 new rules for modern Angular (signals, inject, host properties)
  • CLI helper: biome-angular init|merge|remove|rules
  • recommended and strict presets
  • Zero runtime dependencies

Requirements

Tool Version
Node.js >= 18
@biomejs/biome >= 2.4.8
Angular >= 17

Installation

npm install --save-dev biome-plugin-angular @biomejs/biome

Getting Started

Option A — CLI (recommended)

# Create a biome.json from scratch
npx biome-angular init

# Or add the plugin to your existing biome.json
npx biome-angular merge

Option B — Manual configuration

Add the plugin to your biome.json:

{
  "$schema": "https://biomejs.dev/schemas/2.4.8/schema.json",
  "plugins": ["biome-plugin-angular"]
}

Biome will load biome-manifest.jsonc from the plugin package automatically.


Rules

High Priority

Rule ESLint equivalent Severity Notes
prefer-standalone @angular-eslint/prefer-standalone error
no-empty-lifecycle-method @angular-eslint/no-empty-lifecycle-method warn

Conventions

Rule ESLint equivalent Severity Notes
no-component-suffix (new — Angular v20+) warn heuristic*
no-directive-suffix (new — Angular v20+) warn heuristic*
no-service-suffix (new — Angular v20+) warn heuristic*
component-selector @angular-eslint/component-selector warn
no-input-rename @angular-eslint/no-input-rename error
no-output-rename @angular-eslint/no-output-rename error
no-output-on-prefix @angular-eslint/no-output-on-prefix error
pipe-prefix @angular-eslint/pipe-prefix warn
sort-ngmodule-metadata-arrays @angular-eslint/sort-ngmodule-metadata-arrays warn limited**

Quality

Rule ESLint equivalent Severity Notes
use-lifecycle-interface @angular-eslint/use-lifecycle-interface warn
use-pipe-transform-interface @angular-eslint/use-pipe-transform-interface warn non-functional***
contextual-lifecycle @angular-eslint/contextual-lifecycle error non-functional***

Modern (Angular 17+)

Rule ESLint equivalent Severity Notes
prefer-signal-inputs (new) warn Angular 17.1+
prefer-output-function (new) warn Angular 17.3+
prefer-signal-queries (new) warn Angular 17.2+
prefer-model-signal (new) warn Angular 17.2+
prefer-host-property (new) warn
prefer-inject-function (new) warn heuristic*

GritQL Limitations

Biome's GritQL engine (2.4.8) cannot match @Decorator + class as a single pattern unit. This affects some rules:

  • * heuristic: Rules match by class name or constructor shape without verifying the Angular decorator. Accurate in Angular projects; may false-positive in non-Angular code.
  • ** limited: sort-ngmodule-metadata-arrays detects the presence of metadata arrays but cannot verify sort order.
  • *** non-functional: Rules compile but cannot detect violations at runtime. Kept for forward-compatibility.

CLI Reference

biome-angular init [--strict] [--force]
  Create a new biome.json preconfigured with this plugin.
  --strict   Use the strict preset (all rules as errors)
  --force    Overwrite existing biome.json

biome-angular merge [--strict]
  Add this plugin to your existing biome.json without overwriting.

biome-angular remove
  Remove all biome-plugin-angular rules and plugin reference from biome.json.

biome-angular rules
  Print all available rules and their implementation status.

Presets

Two presets are available:

Preset Description
recommended All high-priority rules; no-empty-lifecycle-method as warn
strict All high-priority rules as errors

Reference them in biome.json:

{ "extends": ["biome-plugin-angular/presets/strict"] }

Migration from @angular-eslint

If you are migrating from ESLint + @angular-eslint, you can remove the following packages once the corresponding rules are available in this plugin:

npm uninstall eslint @angular-eslint/eslint-plugin @angular-eslint/template-parser

See rules-to-migrate.json for the full migration tracking list.


Contributing

See CONTRIBUTING.md.


License

MIT

About

Biome plugin for Angular — TypeScript lint rules with auto-fix (GritQL)

Resources

License

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors