-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.mjs
More file actions
152 lines (149 loc) · 5.45 KB
/
Copy patheslint.config.mjs
File metadata and controls
152 lines (149 loc) · 5.45 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// @ts-check
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import tsParser from "@typescript-eslint/parser";
import angularEslint from "angular-eslint";
import globals from "globals";
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort";
import eslintPluginPrettier from "eslint-plugin-prettier/recommended";
import eslintPluginVitest from "@vitest/eslint-plugin";
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",
"@angular-eslint/prefer-output-emitter-ref": "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],
rules: {
"@angular-eslint/template/i18n": "off",
"@angular-eslint/template/prefer-ngsrc": "off",
"@angular-eslint/template/no-inline-styles": "off",
"@angular-eslint/template/cyclomatic-complexity": "off",
"prettier/prettier": ["warn", { endOfLine: "auto" }],
},
},
{
files: ["**/*.spec.ts", "test/**/*.ts"],
languageOptions: {
globals: { ...globals.vitest, ...globals.node },
},
...eslintPluginVitest.configs.all,
settings: { vitest: { typecheck: true } },
rules: {
"vitest/consistent-test-filename": "off",
"vitest/no-focused-tests": ["warn", { fixable: false }],
"vitest/valid-title": [
"warn",
{
ignoreTypeOfDescribeName: true,
allowArguments: false,
mustMatch: {
it: ["^should "], //tests must begin with "should "
},
},
],
"vitest/warn-todo": "warn",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/unbound-method": "off",
"prettier/prettier": ["warn", { endOfLine: "auto" }],
},
},
);