Skip to content

Commit 2c0d673

Browse files
committed
Add Angular eslint package
1 parent 3fb38cf commit 2c0d673

4 files changed

Lines changed: 1351 additions & 110 deletions

File tree

angular.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@
9292
],
9393
"scripts": []
9494
}
95+
},
96+
"lint": {
97+
"builder": "@angular-eslint/builder:lint",
98+
"options": {
99+
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
100+
}
95101
}
96102
}
97103
}

eslint.config.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// @ts-check
2+
const eslint = require("@eslint/js");
3+
const { defineConfig } = require("eslint/config");
4+
const tseslint = require("typescript-eslint");
5+
const angular = require("angular-eslint");
6+
7+
module.exports = defineConfig([
8+
{
9+
files: ["**/*.ts"],
10+
extends: [
11+
eslint.configs.recommended,
12+
tseslint.configs.recommended,
13+
tseslint.configs.stylistic,
14+
angular.configs.tsRecommended,
15+
],
16+
processor: angular.processInlineTemplates,
17+
rules: {
18+
"@angular-eslint/directive-selector": [
19+
"error",
20+
{
21+
type: "attribute",
22+
prefix: "app",
23+
style: "camelCase",
24+
},
25+
],
26+
"@angular-eslint/component-selector": [
27+
"error",
28+
{
29+
type: "element",
30+
prefix: "app",
31+
style: "kebab-case",
32+
},
33+
],
34+
},
35+
},
36+
{
37+
files: ["**/*.html"],
38+
extends: [
39+
angular.configs.templateRecommended,
40+
angular.configs.templateAccessibility,
41+
],
42+
rules: {},
43+
}
44+
]);

0 commit comments

Comments
 (0)