forked from rhysd/action-setup-vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
113 lines (111 loc) · 4.31 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
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
// @ts-check
import eslint from '@eslint/js';
import ts from 'typescript-eslint';
import mocha from 'eslint-plugin-mocha';
import n from 'eslint-plugin-n';
export default ts.config(
eslint.configs.recommended,
...ts.configs.recommendedTypeChecked,
n.configs['flat/recommended'],
{
languageOptions: {
parserOptions: {
project: 'tsconfig.json',
},
},
},
{
rules: {
'prefer-spread': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'n/no-missing-import': 'off',
eqeqeq: 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': true,
'ts-nocheck': true,
},
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-confusing-void-expression': 'error',
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
'no-return-await': 'off',
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
'@typescript-eslint/no-invalid-void-type': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/consistent-indexed-object-style': 'error',
'@typescript-eslint/no-base-to-string': 'error',
'n/handle-callback-err': 'error',
'n/prefer-promises/fs': 'error',
'n/no-sync': 'error',
},
},
{
files: ['scripts/*.ts'],
rules: {
'n/no-sync': 'off',
},
},
{
files: ['test/*.ts'],
...mocha.configs.flat.recommended,
},
{
files: ['test/*.ts'],
rules: {
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'mocha/no-setup-in-describe': 'off',
'mocha/no-hooks-for-single-case': 'off',
'mocha/max-top-level-suites': 'off',
'mocha/no-exclusive-tests': 'error',
'mocha/no-pending-tests': 'error',
'mocha/no-skipped-tests': 'error',
'mocha/no-top-level-hooks': 'error',
},
},
{
files: ['eslint.config.mjs', 'types/eslint.d.ts'],
languageOptions: {
parserOptions: {
project: 'tsconfig.eslint.json',
},
},
rules: {
'@typescript-eslint/naming-convention': 'off',
'n/no-extraneous-import': 'off',
},
},
);