-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy patheslint.config.js
88 lines (83 loc) · 1.99 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
import eslint from '@eslint/js'
import importx from 'eslint-plugin-import-x'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import vitest from 'eslint-plugin-vitest'
import globals from 'globals'
import tseslint from 'typescript-eslint'
const defaultFiles = [
'src/**',
'tests/**',
'bindings.d.ts',
'scripts/**',
'migrations/**'
]
const config = {
languageOptions: {
sourceType: 'module',
ecmaVersion: 2021,
globals: {
...globals.node,
...globals.browser,
...globals.serviceworker,
fetch: 'readonly',
Response: 'readonly',
Request: 'readonly',
addEventListener: 'readonly',
ENV: 'readonly'
},
},
plugins: { 'import-x': importx },
rules: {
quotes: ['error', 'single'],
'no-console': 'error',
'sort-imports': 'off',
'import-x/order': [
'error',
{
alphabetize: { order: 'asc' },
}
],
'node/no-missing-import': 'off',
'node/no-missing-require': 'off',
'node/no-deprecated-api': 'off',
'node/no-unpublished-import': 'off',
'node/no-unpublished-require': 'off',
'node/no-unsupported-features/es-syntax': 'off',
semi: ['error', 'never'],
'no-debugger': ['error'],
'no-empty': ['warn', { allowEmptyCatch: true }],
'no-process-exit': 'off',
'no-useless-escape': 'off',
'max-len': ['error', { code: 100 }],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
files: defaultFiles
}
export const testConfig = {
...vitest.configs.recommended,
plugins: { vitest: vitest },
files: ['tests/**']
}
export default tseslint.config(
{
ignores: ['dist/', 'coverage/', 'node_modules/'],
},
{
files: defaultFiles,
...eslint.configs.recommended
},
...tseslint.configs.recommended,
config,
testConfig,
{
files: defaultFiles,
...eslintPluginPrettierRecommended
}
)