-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.cjs
124 lines (122 loc) · 3.44 KB
/
index.cjs
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
/** @type {import('@types/eslint')} */
module.exports = {
env: {
browser: true,
es2023: true,
jest: true,
node: true,
},
extends: [],
// This overrides apply 'no-undef','no-redeclare', rule only js files because in TypeScript Language Server catch and show error against undefined variable name.
overrides: [
{
files: [
'./**.js',
'./**.cjs',
'./**.mjs',
'**/*.js',
'**/*.cjs',
'**/*.mjs',
'**/*.jsx',
],
rules: {
'no-undef': ['error', { typeof: false }],
'no-redeclare': 'error',
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['tsconfig.json'],
},
plugins: ['@typescript-eslint', 'import', 'prettier'],
reportUnusedDisableDirectives: true,
rules: {
'@typescript-eslint/await-thenable': 'warn',
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-misused-promises': [
'error',
{
checksConditionals: false,
checksVoidReturn: false,
},
],
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
// Allow foo(unuseArg, useValue) & bar(_, useValue) & { foo, ...coords } = data; https://typescript-eslint.io/rules/no-unused-vars/
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'after-used',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/prefer-as-const': 'warn',
'@typescript-eslint/promise-function-async': 'warn',
eqeqeq: ['error', 'always'],
'no-unneeded-ternary': 'warn',
'import/default': 'error',
'import/export': 'error',
'import/named': 'error',
'import/no-cycle': 'error',
'import/no-duplicates': 'error',
'import/no-unresolved': 'error',
'import/no-useless-path-segments': 'warn',
'import/order': [
'warn',
{
alphabetize: {
caseInsensitive: true,
order: 'asc',
},
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
],
'newlines-between': 'always',
},
],
'no-constant-binary-expression': 'error',
'no-constant-condition': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-empty-pattern': 'error',
'no-extra-boolean-cast': 'error',
'no-return-await': 'error',
'no-unsafe-negation': 'warn',
'no-unused-private-class-members': 'error',
'prefer-const': 'warn',
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
'prettier/prettier': [
'warn',
{},
{
properties: {
usePrettierrc: true,
},
},
],
// Prevent unexpected parseInt() output that does not return the number calculated in decimal when given a value such as parseInt(071).
radix: 'error',
'require-atomic-updates': ['error', { allowProperties: true }],
'valid-typeof': 'warn',
},
settings: {
'import/resolver': {
node: {
extensions: ['.mjs', '.js', 'cjs', '.jsx', '.ts', '.tsx'],
},
typescript: {
alwaysTryTypes: true,
// always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
},
},
},
}