-
Notifications
You must be signed in to change notification settings - Fork 2
/
eslint.config.mjs
133 lines (131 loc) · 4.82 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// @ts-check
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import tsParser from "@typescript-eslint/parser";
import angularEslint from "angular-eslint";
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort";
import eslintPluginPrettier from "eslint-plugin-prettier/recommended";
import eslintPluginTailwindCSS from "eslint-plugin-tailwindcss";
import eslintPluginOnlyWarn from "eslint-plugin-only-warn"; //just importing this will activate it, no need to do anything else!
export default tseslint.config(
eslintPluginPrettier,
{
// Everything in this config object targets our TypeScript files (Components, Directives, Pipes etc)
files: ["**/*.ts"],
plugins: {
"simple-import-sort": eslintPluginSimpleImportSort,
},
extends: [
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
...angularEslint.configs.tsAll,
],
processor: angularEslint.processInlineTemplates,
languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: ["tsconfig.(app|spec).json"],
},
},
rules: {
"@angular-eslint/directive-selector": [
"warn",
{ type: "attribute", prefix: "app", style: "camelCase" },
],
"@angular-eslint/component-selector": [
"warn",
{ type: "element", prefix: "app", style: "kebab-case" },
],
"@angular-eslint/prefer-standalone": "off",
"@angular-eslint/prefer-standalone-component": "off",
"@angular-eslint/prefer-on-push-component-change-detection": "off",
"@angular-eslint/prefer-signals": "off",
"no-loop-func": "off",
"@typescript-eslint/no-loop-func": "warn",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "warn",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "warn",
"no-return-await": "off",
"@typescript-eslint/return-await": "warn",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/array-type": ["warn", { default: "generic" }],
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/method-signature-style": "warn",
"@typescript-eslint/naming-convention": [
"warn",
{ selector: "enum", format: ["StrictPascalCase"], suffix: ["Enum"] },
{ selector: "enumMember", format: ["StrictPascalCase"] },
{ selector: ["interface", "typeAlias"], format: ["StrictPascalCase"], prefix: ["I"] },
],
"@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/no-unnecessary-qualifier": "warn",
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/prefer-regexp-exec": "warn",
"@typescript-eslint/strict-boolean-expressions": "warn",
"@typescript-eslint/member-ordering": [
"warn",
{
classes: [
"private-readonly-field",
"private-field",
"decorated-field",
"field",
"constructor",
"public-method",
"private-method",
],
},
],
"array-callback-return": "warn",
complexity: ["warn", { max: 8 }],
eqeqeq: ["warn", "always", { null: "ignore" }],
"object-shorthand": ["warn", "always"],
"simple-import-sort/imports": "warn",
"no-restricted-imports": [
"warn",
{
patterns: [
{
group: ["rxjs/internal/*"],
message:
"Don't import from 'rxjs/internal/*', this can cause optimization bailouts. See this for more details: https://bobbyhadz.com/blog/angular-commonjs-or-amd-dependencies-can-cause-optimization-bailouts ",
},
{
group: ["src/*"],
message:
"Please use a relative import path beginning with './' or '../' so they can be more easily sorted and grouped",
},
],
},
],
"prettier/prettier": ["warn", { endOfLine: "auto" }],
},
},
{
files: ["**/*.html"],
extends: [
...angularEslint.configs.templateAll,
...eslintPluginTailwindCSS.configs["flat/recommended"],
],
rules: {
"@angular-eslint/template/i18n": "off",
"@angular-eslint/template/prefer-ngsrc": "off",
"@angular-eslint/template/no-inline-styles": "off",
"prettier/prettier": ["warn", { endOfLine: "auto" }],
},
},
{
files: ["**/*.spec.ts", "test/**/*.ts"],
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/unbound-method": "off",
"prettier/prettier": ["warn", { endOfLine: "auto" }],
},
},
);