-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.mjs
More file actions
200 lines (199 loc) · 6.26 KB
/
eslint.config.mjs
File metadata and controls
200 lines (199 loc) · 6.26 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
195
196
197
198
199
200
// @ts-check
import cspellESLintPluginRecommended from '@cspell/eslint-plugin/recommended'
import eslint from '@eslint/js'
import stylistic from '@stylistic/eslint-plugin'
import angular from 'angular-eslint'
import github from 'eslint-plugin-github'
import importPlugin from 'eslint-plugin-import'
// import perfectionist from 'eslint-plugin-perfectionist'
import unusedImports from 'eslint-plugin-unused-imports'
import tseslint from 'typescript-eslint'
export default tseslint.config(
cspellESLintPluginRecommended,
{
files: ['**/*.ts', '**/*.mts'],
extends: [
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
...angular.configs.tsRecommended,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
stylistic.configs.customize({
arrowParens: true,
braceStyle: '1tbs',
commaDangle: 'always-multiline',
indent: 2,
jsx: false,
quoteProps: 'as-needed',
semi: false,
}),
],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
github,
'unused-imports': unusedImports,
},
settings: {
'import/resolver': {
typescript: true,
node: true,
},
},
processor: angular.processInlineTemplates,
rules: {
'@angular-eslint/component-selector': ['error', {
type: 'element',
prefix: ['seed', 'auth', 'layout'],
style: 'kebab-case',
}],
'@stylistic/lines-between-class-members': 'off',
'@stylistic/member-delimiter-style': ['error', {
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
multilineDetection: 'brackets',
}],
'@stylistic/quotes': ['error', 'single', {
avoidEscape: true,
}],
'@stylistic/type-annotation-spacing': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/member-ordering': ['error', {
default: [
'signature',
'field',
'constructor',
'accessor',
'static-method',
'decorated-method',
'public-method',
'private-method',
'method'
]
}],
'@typescript-eslint/naming-convention': ['error', {
selector: 'variableLike',
modifiers: ['unused'],
format: ['camelCase'],
leadingUnderscore: 'require'
}, {
selector: 'memberLike',
modifiers: ['private'],
format: ['camelCase'],
leadingUnderscore: 'require'
}],
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unused-vars': 'off',
// Enable later
'@typescript-eslint/no-useless-default-assignment': 'off',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/restrict-template-expressions': ['error', {
allowNumber: true,
}],
'github/array-foreach': 'error',
'import/no-deprecated': 'error',
'import/no-empty-named-blocks': 'error',
'import/no-extraneous-dependencies': 'error',
'import/no-mutable-exports': 'error',
'import/no-unused-modules': 'error',
'import/no-useless-path-segments': ['error', {
noUselessIndex: true,
}],
'import/order': ['error', {
alphabetize: {
order: 'asc',
orderImportKind: 'asc',
caseInsensitive: true,
},
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
],
'newlines-between': 'never',
}],
'no-sequences': ['error', {
allowInParentheses: false,
}],
'object-shorthand': 'error',
'prefer-template': 'error',
'semi-style': ['error', 'first'],
'sort-imports': ['error', {
ignoreCase: true,
ignoreDeclarationSort: true,
}],
'unused-imports/no-unused-imports': 'error',
// TODO enable (or remove) after enable strict
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
// TODO
'@typescript-eslint/unbound-method': 'off',
'camelcase': 'off',
'import/no-cycle': 'off',
},
},
{
files: ['**/*.d.ts'],
rules: {
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
// Angular 20.2+ marks the entire legacy trigger-based animation DSL as deprecated.
// Keep the deprecation rule active project-wide, but don't block lint on the files
// that intentionally encapsulate the existing animation layer until a full
// animate.enter/animate.leave migration is scheduled.
files: [
'src/@seed/animations/**/*.ts',
'src/@seed/components/drawer/drawer.component.ts',
'src/@seed/components/navigation/vertical/vertical.component.ts',
'src/app/app.config.ts',
],
rules: {
'@typescript-eslint/no-deprecated': 'off',
},
},
{
// chroma-js exposes `contrast` at runtime, but its published typings still model the
// API around the default export. Keep the readable call site and suppress only this
// false-positive import rule for the helper.
files: ['src/@seed/tailwind/utils/generate-contrasts.ts'],
rules: {
'import/no-named-as-default-member': 'off',
},
},
{
files: ['**/*.html'],
extends: [
...angular.configs.templateRecommended,
...angular.configs.templateAccessibility,
],
rules: {
'@angular-eslint/template/prefer-control-flow': 'error',
// TODO
'@angular-eslint/template/click-events-have-key-events': 'off',
'@angular-eslint/template/interactive-supports-focus': 'off',
},
},
)