-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patheslint.config.js
More file actions
166 lines (165 loc) · 6.58 KB
/
eslint.config.js
File metadata and controls
166 lines (165 loc) · 6.58 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
const js = require('@eslint/js');
const globals = require('globals');
const tsParser = require('@typescript-eslint/parser');
const tsPlugin = require('@typescript-eslint/eslint-plugin');
const importPlugin = require('eslint-plugin-import');
const prettierPlugin = require('eslint-plugin-prettier');
const prettierConfig = require('eslint-config-prettier');
module.exports = [
{
ignores: [
'node_modules/**',
'dist/**',
'.github/**',
'docs/**',
'coverage/**',
'**/*.d.ts'
],
},
js.configs.recommended,
{
files: ['**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
project: './tsconfig.json',
sourceType: 'module',
ecmaVersion: 2020,
},
globals: {
...globals.node,
...globals.es2020,
...globals.jest,
},
},
plugins: {
'@typescript-eslint': tsPlugin,
import: importPlugin,
prettier: prettierPlugin,
},
rules: {
'max-len': 'off',
'no-unused-vars': 'off',
'no-restricted-globals': ['error', 'Buffer'],
'array-callback-return': 'warn',
'default-case': ['warn', { commentPattern: '^no default$' }],
'dot-location': ['warn', 'property'],
'eqeqeq': ['warn', 'smart'],
'new-parens': 'warn',
'no-caller': 'warn',
'no-eval': 'error',
'no-extend-native': 'warn',
'no-extra-bind': 'warn',
'no-extra-label': 'warn',
'no-implied-eval': 'error',
'no-iterator': 'warn',
'no-label-var': 'warn',
'no-labels': ['warn', { allowLoop: true, allowSwitch: false }],
'no-lone-blocks': 'warn',
'no-loop-func': 'warn',
'no-multi-str': 'warn',
'no-new-func': 'error',
'no-new-object': 'warn',
'no-new-wrappers': 'warn',
'no-obj-calls': 'warn',
'no-octal-escape': 'warn',
'no-restricted-syntax': ['warn', 'WithStatement'],
'no-script-url': 'warn',
'no-self-assign': 'warn',
'no-self-compare': 'warn',
'no-sequences': 'warn',
'no-template-curly-in-string': 'warn',
'no-throw-literal': 'error',
'no-unused-expressions': ['warn', {
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
}],
'no-useless-computed-key': 'warn',
'no-useless-concat': 'warn',
'no-useless-escape': 'warn',
'no-useless-rename': ['warn', {
ignoreDestructuring: false,
ignoreImport: false,
ignoreExport: false,
}],
'no-with': 'warn',
'no-whitespace-before-property': 'warn',
'padding-line-between-statements': ['warn',
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] }
],
'radix': ['warn'],
'require-await': 'off',
'require-yield': 'warn',
'rest-spread-spacing': ['warn', 'never'],
'strict': ['warn', 'never'],
'unicode-bom': ['warn', 'never'],
'use-isnan': 'warn',
'valid-typeof': 'warn',
'import/first': 'warn',
'import/newline-after-import': 'warn',
'import/no-absolute-path': 'warn',
'import/no-amd': 'warn',
'import/no-default-export': 'warn',
'import/no-extraneous-dependencies': ['warn', {
devDependencies: [
'**/*.test.ts',
'**/*.spec.ts',
'test/**/*',
'scripts/**/*'
],
peerDependencies: true,
optionalDependencies: false,
}],
'import/no-mutable-exports': 'warn',
'import/no-named-default': 'warn',
'import/no-self-import': 'warn',
'import/order': ['warn', {
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always'
}],
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/consistent-type-definitions': ['warn', 'type'],
'@typescript-eslint/explicit-function-return-type': ['warn', {
allowExpressions: true,
allowTypedFunctionExpressions: true,
}],
'@typescript-eslint/member-ordering': 'warn',
'@typescript-eslint/no-array-constructor': 'warn',
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/no-empty-object-type': ['warn', { allowInterfaces: 'with-single-extends' }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-for-in-array': 'warn',
'@typescript-eslint/no-misused-new': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}],
'@typescript-eslint/no-use-before-define': 'warn',
'@typescript-eslint/no-useless-constructor': 'warn',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-includes': 'warn',
'@typescript-eslint/prefer-readonly': 'warn',
'@typescript-eslint/prefer-regexp-exec': 'warn',
'@typescript-eslint/prefer-string-starts-ends-with': 'warn',
'@typescript-eslint/promise-function-async': 'warn',
'@typescript-eslint/require-array-sort-compare': 'warn',
'@typescript-eslint/require-await': 'error',
},
},
{
files: ['**/*.test.ts', '**/*.spec.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'import/no-extraneous-dependencies': 'off',
'@typescript-eslint/require-await': 'off',
},
},
prettierConfig,
];