Skip to content

Commit 76d1d0a

Browse files
authored
chore: migrate to ESLint flat config (#320)
1 parent 7a16ece commit 76d1d0a

File tree

4 files changed

+166
-54
lines changed

4 files changed

+166
-54
lines changed

.eslintrc.json

-39
This file was deleted.

eslint.config.mjs

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import angularEslintPlugin from "@angular-eslint/eslint-plugin";
2+
import angularEslintPluginTemplate from "@angular-eslint/eslint-plugin-template";
3+
import angularEslintTemplateParser from "@angular-eslint/template-parser";
4+
import js from "@eslint/js";
5+
import prettier from "eslint-config-prettier";
6+
import deprecation from "eslint-plugin-deprecation";
7+
import globals from "globals";
8+
import tseslint from "typescript-eslint";
9+
10+
export default [
11+
js.configs.recommended,
12+
{ ignores: ["dist/", ".angular/", "**/*.js"] },
13+
{
14+
files: ["**/*.ts"],
15+
languageOptions: {
16+
parser: tseslint.parser,
17+
parserOptions: {
18+
project: [
19+
"./projects/angular-ecmascript-intl/tsconfig.lib.json",
20+
"./projects/angular-ecmascript-intl/tsconfig.spec.json",
21+
"./projects/angular-intl-demo/tsconfig.app.json",
22+
],
23+
},
24+
globals: {
25+
...globals.browser,
26+
},
27+
},
28+
plugins: {
29+
"@typescript-eslint": tseslint.plugin,
30+
deprecation,
31+
"@angular-eslint": angularEslintPlugin,
32+
},
33+
processor: angularEslintPluginTemplate.processors["extract-inline-html"],
34+
rules: {
35+
...tseslint.configs.strictTypeChecked.rules,
36+
...tseslint.configs.stylisticTypeChecked.rules,
37+
...angularEslintPlugin.configs.recommended.rules,
38+
"@typescript-eslint/no-extraneous-class": "off",
39+
"no-unused-vars": "off",
40+
"@typescript-eslint/no-unused-vars": "error",
41+
"@typescript-eslint/prefer-literal-enum-member": "off",
42+
"deprecation/deprecation": "error",
43+
"@angular-eslint/prefer-standalone-component": "error",
44+
},
45+
},
46+
{
47+
files: ["**/*.spec.ts"],
48+
languageOptions: {
49+
globals: {
50+
...globals.jasmine,
51+
},
52+
},
53+
},
54+
{
55+
files: ["**/*.html"],
56+
plugins: {
57+
"@angular-eslint/template": angularEslintPluginTemplate,
58+
},
59+
languageOptions: {
60+
parser: angularEslintTemplateParser,
61+
},
62+
rules: {
63+
...angularEslintPluginTemplate.configs.recommended.rules,
64+
"@angular-eslint/template/prefer-control-flow": "error",
65+
},
66+
},
67+
prettier,
68+
];

package-lock.json

+93-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build-app": "ng build angular-intl-demo",
1010
"watch": "ng build --watch --configuration development",
1111
"test": "ng test --code-coverage=true",
12-
"lint": "eslint --ignore-path=.gitignore .",
12+
"lint": "eslint .",
1313
"release": "release-it",
1414
"prettier": "prettier . --write"
1515
},
@@ -42,14 +42,14 @@
4242
"@angular-eslint/template-parser": "^17.0.0",
4343
"@angular/cli": "~17.3.0",
4444
"@angular/compiler-cli": "~17.3.0",
45+
"@eslint/js": "^9.2.0",
4546
"@types/jasmine": "~5.1.0",
46-
"@typescript-eslint/eslint-plugin": "^7.0.0",
47-
"@typescript-eslint/parser": "^7.0.0",
4847
"cpy-cli": "^5.0.0",
4948
"dayjs": "^1.11.7",
5049
"eslint": "^8.53.0",
5150
"eslint-config-prettier": "^9.0.0",
5251
"eslint-plugin-deprecation": "^2.0.0",
52+
"globals": "^15.1.0",
5353
"jasmine-core": "~5.1.0",
5454
"karma": "~6.4.0",
5555
"karma-chrome-launcher": "~3.2.0",
@@ -61,6 +61,7 @@
6161
"ng-packagr": "~17.3.0",
6262
"prettier": "~3.2.0",
6363
"prettier-plugin-organize-imports": "^3.2.3",
64-
"typescript": "~5.4.0"
64+
"typescript": "~5.4.0",
65+
"typescript-eslint": "^7.0.0"
6566
}
6667
}

0 commit comments

Comments
 (0)