-
Notifications
You must be signed in to change notification settings - Fork 2
/
eslint.config.js
228 lines (209 loc) · 7.02 KB
/
eslint.config.js
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import vue from 'eslint-plugin-vue';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import prettier from 'eslint-plugin-prettier';
import unicorn from 'eslint-plugin-unicorn';
import _import from 'eslint-plugin-import';
import promise from 'eslint-plugin-promise';
import globals from 'globals';
import parser from 'vue-eslint-parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
export default [
{
ignores: [
'src/external/**/*.ts',
'src/assets/vendor/**/*',
'**/*.json',
'**/.DS_Store',
'**/dist',
'**/public',
'**/node_modules',
'**/node_modules/**/*',
'**/coverage/**/*',
'**/playwright/**/*',
'**/playwright-report/**/*',
'**/test-results/**/*',
'**/coverage',
'**/pnpm-debug.log',
'**/auto-imports.d.ts',
'**/.eslintrc-auto-import.json',
],
},
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:unicorn/recommended',
'plugin:import/recommended',
'plugin:promise/recommended',
'./.eslintrc-auto-import.json',
'plugin:prettier/recommended',
),
),
{
plugins: {
vue: fixupPluginRules(vue),
'@typescript-eslint': fixupPluginRules(typescriptEslint),
prettier: fixupPluginRules(prettier),
unicorn: fixupPluginRules(unicorn),
import: fixupPluginRules(_import),
promise: fixupPluginRules(promise),
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parser: parser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
parser: '@typescript-eslint/parser',
project: ['./tsconfig.json', './tsconfig.node.json'],
extraFileExtensions: ['.vue'],
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: './tsconfig.json',
},
},
},
rules: {
camelcase: 'off',
'no-warning-comments': 'off',
'capitalized-comments': 'off',
'no-redeclare': 'off',
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/triple-slash-reference': 'off',
'@typescript-eslint/member-ordering': 'warn',
'n/file-extension-in-import': 'off',
'import/extensions': 'off',
'import/no-anonymous-default-export': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/filename-case': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-null': 'error',
'@typescript-eslint/naming-convention': 'off',
'import/no-unassigned-import': 'off',
'import/no-cycle': 'error',
'import/named': 'off',
},
},
{
files: ['**/*.vue'],
languageOptions: {
parser: parser,
ecmaVersion: 5,
sourceType: 'script',
parserOptions: {
parser: 'typescript-eslint-parser-for-extra-files',
},
},
rules: {
'vue/multi-word-component-names': 'warn',
'vue/no-reserved-component-names': 'warn',
'vue/require-toggle-inside-transition': 'warn',
},
},
{
files: ['test/e2e/**'],
rules: {
'no-await-in-loop': 'off',
},
},
{
files: ['**/*.json'],
rules: {
'unicorn/numeric-separators-style': 'off',
'unicorn/no-null': 'off',
},
},
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: ENABLE THESE RULES
//
// The following rules have been temporarily set to 'warn' instead of 'error'.
// This is a temporary measure to allow us to introduce linting into our CI pipeline
// without it failing due to a large number of existing linting issues in our codebase.
//
// The goal is to gradually fix these warnings and eventually switch these rules back to 'error'.
// This will help us improve the quality of our codebase incrementally, without disrupting
// the current development workflow.
//
// Note: These rules were not arbitrarily chosen. They represent common issues in our codebase
// that we want to address. However, due to the sheer volume of these issues, it's not feasible
// to fix them all at once. Hence, we're using 'warn' as a stepping stone towards better code quality.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
files: ['**/*'],
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/await-thenable': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/unbound-method': [
'warn',
{
ignoreStatic: true,
},
],
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/no-redeclare': 'warn',
'unicorn/no-null': 'warn',
'unicorn/no-new-array': 'warn',
'unicorn/consistent-destructuring': 'warn',
'unicorn/consistent-function-scoping': 'warn',
'unicorn/prefer-spread': 'warn',
'unicorn/no-array-for-each': 'warn',
'unicorn/prefer-query-selector': 'warn',
'unicorn/prefer-logical-operator-over-ternary': 'warn',
'unicorn/no-anonymous-default-export': 'warn',
'import/namespace': 'warn',
'import/export': 'warn',
'promise/param-names': 'warn',
'promise/catch-or-return': 'warn',
'promise/always-return': 'warn',
'vue/no-v-text-v-html-on-component': 'warn',
'vue/no-unused-components': 'warn',
'import/no-unresolved': [
2,
{
ignore: ['~icons/.*$'],
},
],
},
},
];