Automated migration system for updating @angular-eslint across major versions, handling breaking changes and dependency updates automatically.
The migration system provides automated schematics for major version updates, ensuring smooth transitions between @angular-eslint releases.
/**
* Migration schematic for updating @angular-eslint to a specific version
* @param options - Migration configuration options
* @returns Schematic rule that performs the migration
*/
export default function migration(options: MigrationOptions): Rule;
interface MigrationOptions {
/** Target version for the migration */
version: string;
/** Whether to skip dependency installation */
skipInstall?: boolean;
}Available Migrations:
Each migration schematic handles:
interface MigrationSchema {
/** Version identifier for the migration */
version: string;
/** Human-readable description of the migration */
description: string;
/** Path to the migration factory function */
factory: string;
}The migration system includes utilities for updating package dependencies:
/**
* Update package.json dependencies during migrations
* @param dependencies - Array of package and version updates
* @returns Schematic rule that updates dependencies
*/
function updateDependencies(
dependencies: Array<{
packageName: string;
version: string;
type?: 'dependencies' | 'devDependencies' | 'peerDependencies';
}>
): Rule;Usage Examples:
import { updateDependencies } from "@angular-eslint/schematics";
// Update ESLint-related packages
const migrationRule = updateDependencies([
{ packageName: '@angular-eslint/eslint-plugin', version: '^20.0.0' },
{ packageName: '@angular-eslint/builder', version: '^20.0.0' },
{ packageName: 'eslint', version: '^9.0.0' }
]);The migration system handles transitions between ESLint configuration formats:
Migrations can convert between eslintrc format and flat config format:
/**
* Migrate ESLint configuration from legacy to modern format
* @param tree - The file tree
* @param projectPath - Path to the project to migrate
* @returns Updated configuration in modern format
*/
function migrateLegacyToFlatConfig(tree: Tree, projectPath: string): Rule;
/**
* Migrate ESLint configuration from modern to legacy format
* @param tree - The file tree
* @param projectPath - Path to the project to migrate
* @returns Updated configuration in legacy format
*/
function migrateFlatConfigToLegacy(tree: Tree, projectPath: string): Rule;The migration system handles ESLint rule changes:
/**
* Migration utilities for ESLint rule changes
*/
interface RuleMigration {
/** Original rule name */
from: string;
/** New rule name */
to: string;
/** Optional rule configuration transformation */
configTransform?: (config: any) => any;
}
/**
* Apply rule migrations to ESLint configuration
* @param ruleMigrations - Array of rule migration definitions
* @returns Schematic rule that applies the migrations
*/
function migrateRules(ruleMigrations: RuleMigration[]): Rule;v2.0.0 Migration:
v13.0.0 Migration:
v15.0.0 Migration:
v17.0.0+ Migrations:
v20.0.0 Migration:
Migrations are automatically executed by Angular CLI during updates:
# Automatic migration during ng update
ng update @angular-eslint/schematics
# Manual migration execution
ng generate @angular-eslint/schematics:update-20-0-0interface MigrationOptions {
version: string;
skipInstall?: boolean;
}
interface MigrationSchema {
version: string;
description: string;
factory: string;
}
interface RuleMigration {
from: string;
to: string;
configTransform?: (config: any) => any;
}
type DependencyUpdate = {
packageName: string;
version: string;
type?: 'dependencies' | 'devDependencies' | 'peerDependencies';
};