Skip to content

Commit 4e7b07a

Browse files
committed
Test precommit, update eslint config.
1 parent cbc0767 commit 4e7b07a

6 files changed

Lines changed: 666 additions & 127 deletions

File tree

.eslintrc.json

Lines changed: 0 additions & 40 deletions
This file was deleted.

.husky/pre-commit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pnpm run lint || exit 1
2-
pnpm run format || exit 1
1+
#!/usr/bin/env sh
2+
pnpm lint-staged

eslint.config.mjs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import angular from '@angular-eslint/eslint-plugin';
2+
import angularTemplate from '@angular-eslint/eslint-plugin-template';
3+
import angularParser from '@angular-eslint/template-parser';
4+
import tsParser from '@typescript-eslint/parser';
5+
6+
export default [
7+
// Ignore patterns
8+
{
9+
ignores: [
10+
'dist/**/*',
11+
'coverage/**/*',
12+
'node_modules/**/*',
13+
'projects/**/*',
14+
],
15+
},
16+
17+
// TypeScript files configuration
18+
{
19+
files: ['**/*.ts'],
20+
languageOptions: {
21+
parser: tsParser,
22+
parserOptions: {
23+
project: ['./tsconfig.json', './e2e/tsconfig.json'],
24+
},
25+
},
26+
plugins: {
27+
'@angular-eslint': angular,
28+
},
29+
rules: {
30+
...angular.configs.recommended.rules,
31+
'@angular-eslint/component-selector': [
32+
'error',
33+
{
34+
prefix: 'app',
35+
style: 'kebab-case',
36+
type: 'element',
37+
},
38+
],
39+
'@angular-eslint/directive-selector': [
40+
'error',
41+
{
42+
prefix: 'app',
43+
style: 'camelCase',
44+
type: 'attribute',
45+
},
46+
],
47+
},
48+
},
49+
50+
// HTML template files configuration
51+
{
52+
files: ['**/*.html'],
53+
languageOptions: {
54+
parser: angularParser,
55+
},
56+
plugins: {
57+
'@angular-eslint/template': angularTemplate,
58+
},
59+
rules: {
60+
...angularTemplate.configs.recommended.rules,
61+
},
62+
},
63+
];

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717
"bundle-report": "ng build --configuration production --source-map && source-map-explorer dist/*.js",
1818
"prepare": "husky"
1919
},
20+
"lint-staged": {
21+
"*.{js,jsx,ts,tsx}": [
22+
"eslint --fix",
23+
"prettier --write"
24+
],
25+
"*.{html,css,scss}": [
26+
"prettier --write"
27+
],
28+
"*.{json,md}": [
29+
"prettier --write"
30+
]
31+
},
2032
"private": true,
2133
"dependencies": {
2234
"@angular/animations": "^19.2.8",
@@ -60,6 +72,7 @@
6072
"husky": "^9.1.7",
6173
"jasmine-core": "~5.1.0",
6274
"jsdom": "^26.1.0",
75+
"lint-staged": "^16.0.0",
6376
"prettier": "^3.2.5",
6477
"source-map-explorer": "^2.5.3",
6578
"typescript": "~5.6.3",

0 commit comments

Comments
 (0)