-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
133 lines (128 loc) · 4.75 KB
/
eslint.config.js
File metadata and controls
133 lines (128 loc) · 4.75 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
// @ts-check
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");
/** @type tseslint.ConfigWithExtends */
const baseTsLintConfig = {
rules: {
"@angular-eslint/component-class-suffix": "off",
"@angular-eslint/component-selector": [
"error",
{
type: "element",
prefix: "zv",
style: "kebab-case",
},
],
"@angular-eslint/directive-class-suffix": "off",
"@angular-eslint/directive-selector": [
"error",
{
type: ["attribute", "element"],
prefix: "zv",
style: "camelCase",
},
],
'@angular-eslint/no-conflicting-lifecycle': 'warn',
'@angular-eslint/no-input-prefix': ['error', { prefixes: ['on', 'can', 'is', 'should'] }],
'@angular-eslint/no-pipe-impure': 'error',
"@angular-eslint/prefer-on-push-component-change-detection": "error",
'@angular-eslint/prefer-output-readonly': 'error',
'@angular-eslint/prefer-standalone': 'error',
'@angular-eslint/use-injectable-provided-in': 'error',
'@angular-eslint/use-lifecycle-interface': 'error',
'@angular-eslint/use-pipe-transform-interface': 'error',
'@angular-eslint/prefer-signals': ['warn'],
"@typescript-eslint/naming-convention": [
"error",
{ "selector": "default", "format": ["camelCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "variable", "format": ["camelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "typeLike", "format": ["PascalCase"] },
{ "selector": "objectLiteralProperty", "format": null }
],
'@typescript-eslint/no-deprecated': 'error',
'@typescript-eslint/no-empty-function': ['warn', {
allow: ['arrowFunctions'],
}],
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-misused-promises': ['error', {
checksVoidReturn: { arguments: false },
checksConditionals: true,
}],
'@typescript-eslint/no-unsafe-argument': 'error',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-call': 'error',
'@typescript-eslint/no-unsafe-member-access': 'error',
'@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/unbound-method': 'warn',
"no-underscore-dangle": "off",
"object-shorthand": ["error", "never"],
},
};
module.exports = tseslint.config(
{
files: ["**/*.ts"],
ignores: ["**/*.spec.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylistic,
...angular.configs.tsRecommended,
],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname
},
},
processor: angular.processInlineTemplates,
rules: {
...baseTsLintConfig.rules,
},
},
{
files: ["**/*.spec.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylistic,
...angular.configs.tsRecommended,
],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname
},
},
processor: angular.processInlineTemplates,
rules: {
...baseTsLintConfig.rules,
'@typescript-eslint/no-empty-function': 'off', // sometimes necessary, otherwise not that harmful
'@typescript-eslint/no-explicit-any': 'off', // to much noise :(
'@typescript-eslint/no-floating-promises': 'off', // to much noise :(
'@typescript-eslint/no-misused-promises': ['warn', {
checksVoidReturn: { arguments: false },
checksConditionals: true,
}],
'@typescript-eslint/no-unsafe-argument': 'off', // useful, but some false positives
'@typescript-eslint/no-unsafe-assignment': 'off', // to many errors in existing code, some because @zvoove/components or @angular/components typing is bad
'@typescript-eslint/no-unsafe-call': 'off', // useful, but some false positives
'@typescript-eslint/no-unsafe-member-access': 'off', // to many errors in existing code, some because @zvoove/components typing is bad
'@typescript-eslint/no-unsafe-return': 'off', // useful, but some false positives
'@typescript-eslint/unbound-method': 'off', // would warn on form validators
'@typescript-eslint/require-await': 'off',
},
},
{
files: ["**/*.html"],
extends: [
...angular.configs.templateRecommended,
...angular.configs.templateAccessibility,
],
rules: {
"@angular-eslint/template/prefer-control-flow": "error",
'@angular-eslint/template/alt-text': 'error',
'@angular-eslint/template/prefer-self-closing-tags': 'warn',
},
}
);