Skip to content

Commit f136147

Browse files
committed
feat: add ESLint configuration for TypeScript and Angular components
1 parent 879eb28 commit f136147

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

eslint.config.mjs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import js from "@eslint/js";
5+
import { FlatCompat } from "@eslint/eslintrc";
6+
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
const compat = new FlatCompat({
10+
baseDirectory: __dirname,
11+
recommendedConfig: js.configs.recommended,
12+
allConfig: js.configs.all
13+
});
14+
15+
export default defineConfig([
16+
globalIgnores(["projects/**/*", "src/**/*-examples.component.html", "src/assets/video"]),
17+
{
18+
files: ["**/*.ts"],
19+
20+
extends: compat.extends(
21+
"eslint:recommended",
22+
"plugin:@typescript-eslint/recommended",
23+
"plugin:@angular-eslint/recommended",
24+
"plugin:@angular-eslint/template/process-inline-templates",
25+
"plugin:prettier/recommended",
26+
),
27+
28+
rules: {
29+
"@typescript-eslint/no-explicit-any": "off",
30+
"@typescript-eslint/no-var-requires": "off",
31+
"no-control-regex": "off",
32+
33+
"@angular-eslint/component-selector": ["error", {
34+
prefix: "it",
35+
style: "kebab-case",
36+
type: "element",
37+
}],
38+
39+
"@angular-eslint/prefer-standalone": ["off"],
40+
41+
"prettier/prettier": ["error", {
42+
printWidth: 140,
43+
}],
44+
},
45+
},
46+
{
47+
files: ["**/*.html"],
48+
49+
extends: compat.extends(
50+
"plugin:@angular-eslint/template/recommended",
51+
"plugin:@angular-eslint/template/accessibility",
52+
"plugin:prettier/recommended",
53+
),
54+
55+
rules: {
56+
"prettier/prettier": ["error", {
57+
parser: "angular",
58+
printWidth: 140,
59+
}],
60+
},
61+
},
62+
]);

package-lock.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
"@commitlint/cli": "^19.7.1",
105105
"@commitlint/config-conventional": "^19.7.1",
106106
"@compodoc/compodoc": "^1.1.26",
107+
"@eslint/eslintrc": "^3.3.3",
108+
"@eslint/js": "^9.39.1",
107109
"@types/bootstrap": "^5.2.10",
108110
"@types/jasmine": "~5.1.7",
109111
"@types/jasminewd2": "~2.0.13",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import js from "@eslint/js";
5+
import { FlatCompat } from "@eslint/eslintrc";
6+
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
const compat = new FlatCompat({
10+
baseDirectory: __dirname,
11+
recommendedConfig: js.configs.recommended,
12+
allConfig: js.configs.all
13+
});
14+
15+
export default defineConfig([globalIgnores(["!**/*"]), {
16+
extends: compat.extends("../../.eslintrc.json"),
17+
}, {
18+
files: ["**/*.ts"],
19+
20+
rules: {
21+
"@angular-eslint/directive-selector": ["error", {
22+
type: "attribute",
23+
prefix: "it",
24+
style: "camelCase",
25+
}],
26+
27+
"@angular-eslint/component-selector": ["error", {
28+
type: "element",
29+
prefix: "it",
30+
style: "kebab-case",
31+
}],
32+
},
33+
}, {
34+
files: ["**/*.html"],
35+
rules: {},
36+
}]);

0 commit comments

Comments
 (0)