-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy patheslint.config.mjs
More file actions
119 lines (109 loc) · 2.99 KB
/
eslint.config.mjs
File metadata and controls
119 lines (109 loc) · 2.99 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
import antfu from '@antfu/eslint-config';
import prettierConflicts from 'eslint-config-prettier';
import i18next from 'eslint-plugin-i18next';
import oxlint from 'eslint-plugin-oxlint';
export default antfu(
{
stylistic: { semi: true },
solid: true,
prettier: true,
prettierConflicts,
i18next,
oxlint,
formatters: false,
jsdoc: false,
node: false,
jsonc: false,
yaml: false,
markdown: false,
toml: false,
vue: false,
test: false,
imports: false,
unicorn: false,
ignores: [
'**/dist/**',
'**/public/**',
'**/dev-dist/**',
'**/assets/**',
'**/**.js',
'ComicReader.umd.d.ts',
],
},
{
rules: {
'style/quote-props': ['warn', 'as-needed'],
'style/brace-style': ['warn', '1tbs', { allowSingleLine: true }],
'style/member-delimiter-style': [
'warn',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
multilineDetection: 'brackets',
},
],
'style/jsx-curly-newline': 'off',
'style/jsx-one-expression-per-line': 'off',
'style/arrow-parens': 'off',
// 排序相关
'perfectionist/sort-imports': [
'warn',
{ newlinesBetween: 1, tsconfig: { rootDir: '.' } },
],
'perfectionist/sort-named-imports': 'warn',
'import/consistent-type-specifier-style': 'warn',
'ts/no-import-type-side-effects': 'warn',
'perfectionist/sort-exports': 'warn',
'antfu/curly': 'off',
'antfu/if-newline': 'off',
'antfu/top-level-function': 'off',
'antfu/consistent-list-newline': 'off',
'antfu/consistent-chaining': 'off',
'antfu/no-top-level-await': 'off',
'ts/no-use-before-define': 'off',
'node/prefer-global/process': ['warn', 'always'],
'solid/jsx-no-script-url': 'off',
'solid/reactivity': 'off',
'solid/components-return-once': 'off',
'prefer-promise-reject-errors': 'off',
'no-debugger': 'warn',
},
},
i18next.configs['flat/recommended'],
{
files: ['!**/*.stories.tsx'],
rules: {
'i18next/no-literal-string': [
'error',
{
mode: 'jsx-only',
'jsx-attributes': {
include: ['^name', 'children', 'textContent', 'text'],
},
callees: { exclude: ['bindOption', 't'] },
},
],
},
},
{
files: ['**/*.test.*'],
rules: {
'no-debugger': 'off',
},
},
prettierConflicts,
...oxlint.buildFromOxlintConfigFile('./.oxlintrc.json'),
)
.disableRulesFix(['prefer-const'], {
builtinRules: () =>
import('eslint/use-at-your-own-risk').then((r) => r.builtinRules),
})
// 一些规则即使在上面 false 了,实际也还是会启用,需要在这里禁用
// oxc 有的全部禁用交给 oxc
.removePlugins('node', 'jsdoc', 'vue', 'test', 'import', 'ts', 'unicorn');