This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
129 lines (128 loc) · 3.69 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import antfu from '@antfu/eslint-config'
import command from 'eslint-plugin-command/config'
export default antfu(
{
formatters: true,
react: true,
typescript: true,
},
{
files: ['**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}'],
rules: {
'prefer-object-has-own': 'error',
'logical-assignment-operators': [
'error',
'always',
{ enforceForIfStatements: true },
],
'no-else-return': ['error', { allowElseIf: false }],
'no-lonely-if': 'error',
'prefer-destructuring': [
'error',
{ VariableDeclarator: { object: true } },
],
'import/no-self-import': 'error',
'import/no-duplicates': 'error',
'import/first': 'error',
'import/order': [
'warn',
{
'groups': [
'object',
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
'alphabetize': {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
},
],
'import/newline-after-import': 'error',
'no-negated-condition': 'off',
'unicorn/no-negated-condition': 'error',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
args: 'after-used',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
vars: 'all',
varsIgnorePattern: '^_',
},
],
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
'object-shorthand': ['error', 'always'],
'unicorn/prefer-regexp-test': 'error',
'unicorn/no-array-for-each': 'error',
'unicorn/prefer-string-replace-all': 'error',
'ts/prefer-for-of': 'error',
'ts/no-explicit-any': 'off',
'ts/no-non-null-assertion': 'off',
'ts/no-unsafe-assignment': 'off',
'ts/no-unused-vars': 'error',
'ts/no-var-requires': 'off',
'ts/ban-ts-comment': 'off',
'ts/no-unsafe-call': 'off',
'ts/no-unsafe-member-access': 'off',
'ts/consistent-type-imports': 'error',
'ts/no-inferrable-types': [
'error',
{
ignoreParameters: true,
ignoreProperties: true,
},
],
'jsonc/sort-keys': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-refresh/only-export-components': 'off',
'style/comma-dangle': 'error',
'style/quotes': 'error',
'style/max-statements-per-line': 'error',
'style/jsx-curly-newline': 'error',
'style/jsx-function-call-newline': 'error',
'style/indent-binary-ops': 'error',
'style/type-generic-spacing': 'error',
'style/type-named-tuple-spacing': 'error',
'node/prefer-global/process': 'off',
'node/prefer-global/buffer': 'off',
'command/command': 'error',
'perfectionist/sort-imports': 'off',
'react-dom/no-dangerously-set-innerhtml': 'off',
'react/no-duplicate-key': 'error',
'react/no-array-index-key': 'error',
'no-dupe-keys': 'error',
},
},
{
files: ['**/*.{jsx,tsx}'],
rules: {
'react-hooks/exhaustive-deps': 'error',
'no-restricted-syntax': [
'error',
{
selector:
'CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]',
message:
'`useMemo` with an empty dependency array can\'t provide a stable reference, use `useRef` instead.',
},
],
},
settings: {
react: { version: 'detect' },
},
},
{
files: ['**/*.d.ts'],
rules: {
'no-var': 'off',
},
},
command(),
)