or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.mdmigration-system.mdproject-configuration.mdproject-generation.mdutility-functions.mdworkspace-setup.md
tile.json

tessl/npm-angular-eslint--schematics

Angular CLI Schematics that automate the setup and configuration of ESLint in Angular workspaces

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@angular-eslint/schematics@20.2.x

To install, run

npx @tessl/cli install tessl/npm-angular-eslint--schematics@20.2.0

index.mddocs/

@angular-eslint/schematics

@angular-eslint/schematics is a collection of Angular CLI schematics that automate the setup and configuration of ESLint in Angular workspaces. It provides schematics for adding ESLint to new and existing projects, creating workspace and project-level configurations, and migrating between versions.

Package Information

  • Package Name: @angular-eslint/schematics
  • Package Type: npm
  • Language: TypeScript
  • Installation: ng add angular-eslint

Core Imports

For using utilities in custom schematics:

import { 
  readJsonInTree, 
  updateJsonInTree, 
  createESLintConfigForProject,
  addESLintTargetToProject 
} from "@angular-eslint/schematics";

For using Angular Devkit types:

import { Rule, Tree, SchematicContext } from "@angular-devkit/schematics";

Basic Usage

The primary way to use this package is through Angular CLI commands:

# Add ESLint to an existing Angular workspace
ng add angular-eslint

# Create a new Angular application with ESLint pre-configured
ng generate @angular-eslint/schematics:application my-app

# Create a new Angular library with ESLint pre-configured  
ng generate @angular-eslint/schematics:library my-lib

# Add ESLint to a specific project
ng generate @angular-eslint/schematics:add-eslint-to-project --project=my-project

Architecture

The package is built around several key components:

  • Schematics Collection: Core schematics for workspace setup and project generation
  • Migration System: Automated migrations for version updates with extensive version-specific migration schematics
  • Utility Functions: Reusable functions for ESLint configuration and project management
  • Schema Validation: Type-safe options for all schematics
  • Configuration Management: Handles both legacy eslintrc and modern flat config formats

Capabilities

Workspace Setup

Add ESLint to existing Angular workspaces and configure workspace-level settings.

interface NgAddSchema {
  skipInstall?: boolean;
}

export default function (options: NgAddSchema): Rule;

Workspace Setup

Project Generation

Create new Angular applications and libraries with ESLint pre-configured.

interface ApplicationSchema extends AngularApplicationSchema {
  setParserOptionsProject?: boolean;
}

interface LibrarySchema extends AngularLibrarySchema {
  setParserOptionsProject?: boolean;
}

export default function (options: ApplicationSchema): Rule;  // application schematic
export default function (options: LibrarySchema): Rule;      // library schematic

Project Generation

Project Configuration

Add ESLint configuration to existing Angular projects.

interface AddESLintToProjectSchema {
  project?: string;
  setParserOptionsProject?: boolean;
}

function addESLintToProject(schema: AddESLintToProjectSchema): Rule;

Project Configuration

Utility Functions

Helper functions for custom schematics and ESLint configuration management.

function readJsonInTree<T>(host: Tree, path: string): T;
function updateJsonInTree<T, O>(path: string, callback: (json: T, context: SchematicContext) => O): Rule;
function createESLintConfigForProject(projectName: string, setParserOptionsProject: boolean): Rule;
function addESLintTargetToProject(projectName: string, targetName: 'eslint' | 'lint'): Rule;

Utility Functions

Migration System

Automated migrations for updating @angular-eslint across major versions.

interface MigrationSchema {
  version: string;
  description: string;
  factory: string;
}

Migration System

TSLint to ESLint Conversion

Legacy schematic for converting TSLint configurations to ESLint (hidden but available).

interface ConvertTSLintToESLintSchema {
  project?: string;
  ignoreExistingTslintConfig?: boolean;
  removeTSLintIfNoMoreTSLintTargets?: boolean;
  setParserOptionsProject?: boolean;
}

export default function (options: ConvertTSLintToESLintSchema): Rule;

Types

Core Types

type TargetsConfig = Record<string, { builder: string; options: unknown }>;
type ProjectType = 'application' | 'library';

interface NgAddSchema {
  skipInstall?: boolean;
}

interface AddESLintToProjectSchema {
  project?: string;
  setParserOptionsProject?: boolean;
}

interface ApplicationSchema extends AngularApplicationSchema {
  setParserOptionsProject?: boolean;
}

interface LibrarySchema extends AngularLibrarySchema {
  setParserOptionsProject?: boolean;
}

interface ConvertTSLintToESLintSchema {
  project?: string;
  ignoreExistingTslintConfig?: boolean;
  removeTSLintIfNoMoreTSLintTargets?: boolean;
  setParserOptionsProject?: boolean;
}

interface MigrationSchema {
  version: string;
  description: string;
  factory: string;
}

Angular DevKit Re-exports

type Rule = import("@angular-devkit/schematics").Rule;
type Tree = import("@angular-devkit/schematics").Tree;
type SchematicContext = import("@angular-devkit/schematics").SchematicContext;
type Path = import("@angular-devkit/core").Path;
type ProjectConfiguration = import("@nx/devkit").ProjectConfiguration;

External Schema Re-exports

type AngularApplicationSchema = import("@schematics/angular/application/schema").Schema;
type AngularLibrarySchema = import("@schematics/angular/library/schema").Schema;

Constants

const supportedFlatConfigNames: string[] = [
  'eslint.config.js', 
  'eslint.config.mjs', 
  'eslint.config.cjs', 
  'eslint.config.ts', 
  'eslint.config.mts', 
  'eslint.config.cts'
];

const DEFAULT_PREFIX = 'app';
const FIXED_ESLINT_V8_VERSION = '8.57.1';
const FIXED_TYPESCRIPT_ESLINT_V7_VERSION = '7.11.0';