Skip to content

Commit 2bcbce8

Browse files
committed
Add ESLint on angular 20
1 parent 0731fdb commit 2bcbce8

File tree

5 files changed

+2300
-81
lines changed

5 files changed

+2300
-81
lines changed

frontend-angular/angular.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,22 @@
8585
"src/styles.css"
8686
]
8787
}
88+
},
89+
"lint": {
90+
"builder": "@angular-eslint/builder:lint",
91+
"options": {
92+
"lintFilePatterns": [
93+
"src/**/*.ts",
94+
"src/**/*.html"
95+
]
96+
}
8897
}
8998
}
9099
}
100+
},
101+
"cli": {
102+
"schematicCollections": [
103+
"angular-eslint"
104+
]
91105
}
92106
}

frontend-angular/eslint.config.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// @ts-check
2+
const eslint = require("@eslint/js");
3+
const tseslint = require("typescript-eslint");
4+
const angular = require("angular-eslint");
5+
6+
module.exports = tseslint.config(
7+
{
8+
files: ["**/*.ts"],
9+
extends: [
10+
eslint.configs.recommended,
11+
...tseslint.configs.recommended,
12+
...tseslint.configs.stylistic,
13+
...angular.configs.tsRecommended,
14+
],
15+
processor: angular.processInlineTemplates,
16+
rules: {
17+
"@angular-eslint/directive-selector": [
18+
"error",
19+
{
20+
type: "attribute",
21+
prefix: "app",
22+
style: "camelCase",
23+
},
24+
],
25+
"@angular-eslint/component-selector": [
26+
"error",
27+
{
28+
type: "element",
29+
prefix: "app",
30+
style: "kebab-case",
31+
},
32+
],
33+
"@angular-eslint/component-class-suffix": [
34+
"error",
35+
{
36+
suffixes: ["","Component"]
37+
}
38+
],
39+
"no-undefined": "error",
40+
"no-var": "error",
41+
"prefer-const": "error",
42+
"func-names": "error",
43+
"id-length": "error",
44+
"newline-before-return": "error",
45+
"space-before-blocks": "error",
46+
"no-alert": "error"
47+
},
48+
},
49+
{
50+
files: ["**/*.html"],
51+
extends: [
52+
...angular.configs.templateRecommended,
53+
...angular.configs.templateAccessibility,
54+
],
55+
rules: {},
56+
}
57+
);

0 commit comments

Comments
 (0)