-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy patheslint.config.mjs
86 lines (84 loc) · 2.3 KB
/
eslint.config.mjs
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
import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginJest from 'eslint-plugin-jest'
const noUnusedVars = {
'no-unused-vars': 'off', // Using @typescript-eslint/no-unused-vars
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'none',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
}
/** @type {import('eslint').Linter.Config[]} */
export default tseslint.config([
{ files: ['**/*.{js,mjs,cjs,ts}'] },
{ ignores: ['node_modules', 'dist', 'lib', 'coverage'] },
{
languageOptions: {
globals: { ...globals.browser, ...globals.node },
},
},
pluginJs.configs.recommended,
tseslint.configs.recommended,
{
rules: {
...pluginJs.configs.recommended.rules,
...tseslint.configs.recommended.rules,
...noUnusedVars,
'@typescript-eslint/no-unused-expressions': 'off',
},
},
{
files: ['**/*.d.ts'],
rules: {
...pluginJs.configs.recommended.rules,
...tseslint.configs.recommended.rules,
...noUnusedVars,
},
},
{
// Spec files
files: [
'**/*.spec.js',
'**/*.spec.ts',
'spec/integration/shared-examples.js',
'spec/browser/middleware/retry/shared-examples.js',
'spec/integration/node/support/keep-alive.js',
'spec/integration/browser/file-upload.js',
'spec/integration/browser/csrf.js',
'spec/integration/server.js',
'spec/helpers/babel.js',
],
...pluginJest.configs['flat/recommended'],
rules: {
...pluginJest.configs['flat/recommended'].rules,
'jest/no-conditional-expect': 'off',
'jest/no-done-callback': 'off',
'@typescript-eslint/no-require-imports': 'off',
'jest/no-jasmine-globals': 'off',
'jest/no-export': 'off',
},
plugins: { jest: pluginJest },
languageOptions: {
globals: pluginJest.environments.globals.globals,
},
},
// Two idiot files
{
files: ['src/gateway/types.ts', 'src/gateway/xhr.ts'],
rules: {
...pluginJs.configs.recommended.rules,
...tseslint.configs.recommended.rules,
...noUnusedVars,
'no-undef': 'off',
},
},
])