README.md
May 7, 2026 ยท View on GitHub
Angular Strict ESLint
Modern ESLint configuration with strict rules for Angular development
Overview
A production-ready, opinionated ESLint configuration that enforces best practices for Angular applications. Combines rules from industry-leading plugins into a single package with zero additional configuration required.
Features
๐
ฐ๏ธ Angular: 40+ rules for standalone, lifecycle, components/directives standards, metadata, signals, pipes,...
๐ TypeScript: Promise-async, type imports, strict typing, type safety, extraneous classes,...
โจ Code Quality: Complexity max, file length control, import cycles detection, 100+ Unicorn best practices,...
๐จ Style: Airbnb extended, max line length, object/class newlines, sorted classes/imports/objects/types,...
๐ Templates: 30+ rules with alphabetical attrs, complexity max, control flow, trackBy, a11y, no-any,...
What's Included
โจ No additional ESLint installation needed! Everything is bundled.
- ๐ฉ Airbnb Extended - Airbnb style guide
- ๐ ฐ๏ธ Angular ESLint - Angular-specific rules
- โ๏ธ ESLint - Core linting engine
- ๐ฆ Import-X - Import/export validation and cycle detection
- ๐ Perfectionist - Take Your Code to a Beauty Salon
- ๐จ Stylistic - Code formatting rules
- ๐ TypeScript ESLint - TypeScript linting
- ๐ฆ Unicorn - More than 100 powerful ESLint rules
Installation
1. Install Package
yarn add eslint-config-angular-strict --dev
โ ๏ธ Important: Remove any existing
eslintdependency from your project - it's included!
2. Configure ESLint
Create an eslint.config.js file (flat config format):
import angularStrict from 'eslint-config-angular-strict';
export default [
...angularStrict,
// Your custom overrides here
];
3. Update package.json
Add the following to your package.json:
{
// ...
"type": "module"
}
TypeScript Configuration
Make sure your tsconfig.json is properly configured:
{
"compilerOptions": {
// ...
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noImplicitOverride": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true
},
"angularCompilerOptions": {
// ...
"extendedDiagnostics": { "defaultCategory": "error" },
"strictInjectionParameters": true,
"strictStandalone": true,
"strictTemplates": true,
"typeCheckHostBindings": true
}
}
Prettier
This config handles TypeScript formatting via ESLint. Prettier should only be used for HTML templates.
Recommended .prettierrc
{
"printWidth": 165,
"singleQuote": true,
"overrides": [
{
"files": "*.html",
"options": { "parser": "angular" }
}
]
}
Recommended lint scripts (package.json)
{
"scripts": {
// ...
"lint": "ng lint && prettier --check \"src/**/*.html\"",
"lint:fix": "ng lint --fix && prettier --write \"src/**/*.html\""
}
}
โ ๏ธ Important: Only target
*.htmlfiles with Prettier. Running Prettier on.tsfiles will conflict with ESLint Stylistic rules.
Recommended VS Code settings
{
// ...
"[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"editor.formatOnType": true,
"eslint.format.enable": true,
"eslint.validate": [ /*...*/, "html", "typescript"],
}
This ensures ESLint handles .ts formatting on save, while Prettier handles .html templates.
Contributing
Contributions are welcome! Please open an issue or submit a PR.
License
MIT ยฉ Jean-benoit Gautier