/
.eslintrc.js
62 lines (59 loc) 路 1.52 KB
/
.eslintrc.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
// @ts-check
const ts = (rules) =>
Object.fromEntries(
Object.entries(rules).map(([key, value]) => [
'@typescript-eslint/' + key,
value,
])
);
// Note! Sort eslint rules alphabetically!
/** @type {import('eslint').Linter.Config} */
module.exports = {
env: {
es2021: true,
node: true,
browser: true,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./packages/*/tsconfig.json', './utils/tsconfig.json'],
},
extends: ['eslint:recommended', 'prettier'],
rules: {
eqeqeq: 'error',
'comma-dangle': ['error', 'only-multiline'],
'no-cond-assign': 'off',
'no-constant-condition': 'warn',
'no-empty': 'off',
'no-empty-function': 'off',
'no-restricted-imports': ['error', { patterns: ['**/index'] }],
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'prefer-as-const': 'off',
},
overrides: [
{
files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/strict',
],
rules: {
...ts({
'ban-ts-comment': [
'error',
{ 'ts-expect-error': 'allow-with-description' },
],
'no-empty-function': 'off',
'no-empty-interface': 'off',
'no-explicit-any': 'off',
'no-invalid-void-type': ['warn', { allowAsThisParameter: true }],
'no-non-null-assertion': 'off',
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'strict-boolean-expressions': 'error',
}),
},
},
],
};