Angular + Husky + lint-staged
Git pre-commit hook that lints and formats staged files. This page shows exactly what pickstack adds to a Angular project for Husky + lint-staged: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework angular --modules eslint,husky-lint-staged --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
@angular-eslint/builder | ^22.8.0 | dev |
@eslint/js | ^10.0.1 | dev |
angular-eslint | ^22.8.0 | dev |
eslint | ^10.15.0 | dev |
husky | ^9.1.7 | dev |
lint-staged | ^17.6.2 | dev |
typescript-eslint | ^8.74.0 | dev |
New files
lint-staged
// @ts-check
import eslint from "@eslint/js";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
import angular from "angular-eslint";
export default defineConfig([
{
files: ["**/*.ts"],
extends: [
eslint.configs.recommended,
tseslint.configs.recommended,
tseslint.configs.stylistic,
angular.configs.tsRecommended,
],
processor: angular.processInlineTemplates,
rules: {
"@angular-eslint/directive-selector": [
"error",
{ type: "attribute", prefix: "app", style: "camelCase" },
],
"@angular-eslint/component-selector": [
"error",
{ type: "element", prefix: "app", style: "kebab-case" },
],
},
},
{
files: ["**/*.html"],
extends: [
angular.configs.templateRecommended,
angular.configs.templateAccessibility,
],
rules: {},
},
]);
Changes to existing files
⋯ 2 unchanged lines "version": 1, "cli": { "packageManager": "npm",+ "analytics": false,+ "schematicCollections": ["angular-eslint"]− "analytics": false }, "newProjectRoot": "projects", "projects": {⋯ 52 unchanged lines } }, "defaultConfiguration": "development"+ },+ "lint": {+ "builder": "@angular-eslint/builder:lint",+ "options": {+ "lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]+ } } } }⋯ 3 unchanged lines
<section class="page"> <h1 class="title">About</h1>+ <p class="text">+ Built with Angular 22, TypeScript, ESLint, Husky, lint-staged.+ </p>− <p class="text">Built with Angular 22, TypeScript.</p> </section>
Project files
.gitignore.husky/pre-commitREADME.mdangular.jsoneslint.config.jspackage.jsonpublic/robots.txtsrc/app/app.config.tssrc/app/app.htmlsrc/app/app.routes.tssrc/app/app.tssrc/app/components/counter/counter.htmlsrc/app/components/counter/counter.tssrc/app/pages/about/about.htmlsrc/app/pages/about/about.tssrc/app/pages/home/home.htmlsrc/app/pages/home/home.tssrc/index.htmlsrc/main.tssrc/styles.csstsconfig.app.jsontsconfig.json