-
Notifications
You must be signed in to change notification settings - Fork 427
Expand file tree
/
Copy patheslint.config.js
More file actions
194 lines (193 loc) · 7.53 KB
/
eslint.config.js
File metadata and controls
194 lines (193 loc) · 7.53 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
import antfu from '@antfu/eslint-config'
export default antfu(
{
ignores: ['dist', 'info', 'ui/.angular', '.github/npm-version-script-esm.js'],
typescript: true,
angular: true,
formatters: {
css: true,
html: true,
markdown: true,
svg: true,
},
rules: {
'markdown/require-alt-text': 'off',
},
},
{
// JS/TS-specific rules (these crash on non-JS SourceCode objects like markdown)
files: ['**/*.?([cm])[jt]s?(x)'],
rules: {
'curly': ['error', 'all'],
'jsdoc/check-alignment': 'error',
'jsdoc/check-line-alignment': 'error',
'jsdoc/no-bad-blocks': 'error',
'jsdoc/no-blank-block-descriptions': 'error',
'jsdoc/require-asterisk-prefix': 'error',
'jsdoc/require-description-complete-sentence': 'off',
'jsdoc/require-hyphen-before-param-description': 'error',
'no-undef': 'error',
'perfectionist/sort-exports': 'error',
'perfectionist/sort-imports': [
'error',
{
groups: [
['type-builtin', 'type-external', 'type-internal'],
['type-parent', 'type-sibling', 'type-index'],
'builtin',
'external',
'internal',
['parent', 'sibling', 'index'],
'side-effect',
'unknown',
],
internalPattern: ['^@/.*'],
order: 'asc',
type: 'natural',
newlinesBetween: 1,
},
],
'perfectionist/sort-named-exports': 'error',
'perfectionist/sort-named-imports': 'error',
'style/brace-style': ['error', '1tbs'],
'style/quote-props': ['error', 'consistent-as-needed'],
'ts/consistent-type-imports': 'off',
'unicorn/no-useless-spread': 'error',
'unused-imports/no-unused-vars': ['error', { caughtErrors: 'none', args: 'none' }],
},
},
)
.override('antfu/formatter/html', config => ({
...config,
files: config.files,
ignores: ['ui/**/*.html'],
}))
.override('antfu/angular/rules/ts', config => ({
...config,
files: ['ui/**/*.ts'],
rules: {
...config.rules,
'angular/component-class-suffix': 'error',
'angular/component-max-inline-declarations': 'error',
'angular/component-selector': 'error',
'angular/consistent-component-styles': 'error',
'angular/contextual-decorator': 'error',
'angular/contextual-lifecycle': 'error',
'angular/directive-class-suffix': 'error',
'angular/directive-selector': 'error',
'angular/no-async-lifecycle-method': 'error',
'angular/no-attribute-decorator': 'error',
'angular/no-duplicates-in-metadata-arrays': 'error',
'angular/no-empty-lifecycle-method': 'error',
'angular/no-forward-ref': 'error',
'angular/no-implicit-take-until-destroyed': 'error',
'angular/no-input-prefix': 'error',
'angular/no-input-rename': 'error',
'angular/no-inputs-metadata-property': 'error',
'angular/no-lifecycle-call': 'error',
'angular/no-output-native': 'error',
'angular/no-output-on-prefix': 'error',
'angular/no-output-rename': 'error',
'angular/no-outputs-metadata-property': 'error',
'angular/no-pipe-impure': 'error',
'angular/no-queries-metadata-property': 'error',
'angular/pipe-prefix': 'error',
'angular/prefer-host-metadata-property': 'error',
'angular/prefer-inject': 'error',
'angular/prefer-on-push-component-change-detection': 'error',
'angular/prefer-output-emitter-ref': 'error',
'angular/prefer-output-readonly': 'error',
'angular/prefer-signal-model': 'error',
'angular/prefer-signals': 'error',
'angular/prefer-standalone': 'error',
'angular/relative-url-prefix': 'error',
'angular/require-lifecycle-on-prototype': 'error',
'angular/require-localize-metadata': 'error',
'angular/runtime-localize': 'error',
'angular/sort-keys-in-type-decorator': 'error',
'angular/sort-lifecycle-methods': 'error',
'angular/use-component-selector': 'error',
'angular/use-component-view-encapsulation': 'error',
'angular/use-injectable-provided-in': 'error',
'angular/use-lifecycle-interface': 'error',
'angular/use-pipe-transform-interface': 'error',
},
}))
.override('antfu/angular/rules/template', config => ({
...config,
files: ['ui/**/*.html'],
rules: {
...config.rules,
'angular-template/alt-text': 'error',
'angular-template/attributes-order': 'error',
'angular-template/banana-in-box': 'error',
'angular-template/button-has-type': 'error',
'angular-template/click-events-have-key-events': 'error',
'angular-template/conditional-complexity': 'error',
'angular-template/cyclomatic-complexity': 'off',
'angular-template/elements-content': 'error',
'angular-template/eqeqeq': 'error',
'angular-template/i18n': 'off',
'angular-template/interactive-supports-focus': 'error',
'angular-template/label-has-associated-control': 'error',
'angular-template/mouse-events-have-key-events': 'error',
'angular-template/no-any': 'error',
'angular-template/no-autofocus': 'error',
'angular-template/no-call-expression': 'off',
'angular-template/no-distracting-elements': 'error',
'angular-template/no-duplicate-attributes': 'error',
'angular-template/no-empty-control-flow': 'error',
'angular-template/no-inline-styles': ['error', { allowBindToStyle: true }],
'angular-template/no-interpolation-in-attributes': 'error',
'angular-template/no-negated-async': 'error',
'angular-template/no-nested-tags': 'error',
'angular-template/no-positive-tabindex': 'error',
'angular-template/prefer-at-else': 'error',
'angular-template/prefer-at-empty': 'error',
'angular-template/prefer-built-in-pipes': 'error',
'angular-template/prefer-class-binding': 'error',
'angular-template/prefer-contextual-for-variables': 'error',
'angular-template/prefer-control-flow': 'error',
'angular-template/prefer-ngsrc': 'off',
'angular-template/prefer-self-closing-tags': 'error',
'angular-template/prefer-static-string-properties': 'error',
'angular-template/prefer-template-literal': 'error',
'angular-template/role-has-required-aria': 'error',
'angular-template/table-scope': 'error',
'angular-template/use-track-by-function': 'error',
'angular-template/valid-aria': 'error',
'format/prettier': ['error', {
parser: 'angular',
endOfLine: 'auto',
printWidth: 120,
semi: false,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
}],
'style/no-multiple-empty-lines': 'off',
},
}))
.append({
files: ['test/**/*.e2e-spec.ts'],
rules: {
'test/expect-expect': 'error',
'test/no-commented-out-tests': 'error',
'test/no-conditional-expect': 'error',
'test/no-disabled-tests': 'warn',
'test/no-focused-tests': 'error',
'test/no-identical-title': 'error',
'test/no-import-node-test': 'error',
'test/no-interpolation-in-snapshots': 'error',
'test/no-mocks-import': 'error',
'test/no-standalone-expect': 'error',
'test/no-unneeded-async-expect-function': 'error',
'test/prefer-called-exactly-once-with': 'error',
'test/require-local-test-context-for-concurrent-snapshots': 'error',
'test/valid-describe-callback': 'error',
'test/valid-expect': 'error',
'test/valid-expect-in-promise': 'error',
'test/valid-title': 'error',
},
})