forked from soybeanjs/soybean-admin-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
95 lines (88 loc) · 2.79 KB
/
eslint.config.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
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
import { defineConfig } from '@soybeanjs/eslint-config';
import sort from 'eslint-plugin-sort';
export default defineConfig(
{
ignores: ['ErrorBoundary.tsx'],
prettierRules: {
singleAttributePerLine: true,
trailingCommas: 'none'
},
react: true,
unocss: true
},
sort.configs['flat/recommended'],
{
rules: {
'import/newline-after-import': 'error',
'import/no-absolute-path': 'warn',
'import/no-empty-named-blocks': ['error'],
'import/no-useless-path-segments': [
'error',
{
noUselessIndex: true
}
],
'import/order': [
'error',
{
alphabetize: {
order: 'asc'
},
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object'],
'newlines-between': 'always',
pathGroups: [{ group: 'internal', pattern: '{{@,~}/,#}**' }],
pathGroupsExcludedImportTypes: ['builtin']
}
],
'no-underscore-dangle': 'off',
'react/hook-use-state': [
'error', // or "warn" to only warn instead of error
{
allowDestructuredState: true
}
],
'react/jsx-closing-bracket-location': ['warn', 'tag-aligned'],
'react/jsx-closing-tag-location': 'warn',
'react/jsx-curly-brace-presence': [
'warn',
{
children: 'never',
propElementValues: 'always',
props: 'never'
}
],
'react/jsx-curly-newline': ['warn', { multiline: 'consistent', singleline: 'consistent' }],
'react/jsx-equals-spacing': ['warn', 'never'],
'react/jsx-fragments': ['warn', 'syntax'],
'react/jsx-newline': 'warn',
'react/jsx-no-undef': ['off'],
'react/jsx-no-useless-fragment': 'warn',
'react/jsx-one-expression-per-line': [
'warn',
{
allow: 'single-child'
}
],
'react/jsx-props-no-multi-spaces': 'warn',
'react/jsx-sort-props': [
'warn',
{ callbacksLast: true, ignoreCase: true, multiline: 'last', shorthandFirst: true }
],
'react/prefer-read-only-props': ['error'],
'react/self-closing-comp': [
'error',
{
component: true,
html: true
}
],
'react-refresh/only-export-components': ['warn', { allowExportNames: ['loader', 'action'] }],
'sort/import-members': ['error', { caseSensitive: true, natural: true }],
'sort/imports': ['off'],
'sort/string-enums': ['error', { caseSensitive: false, natural: true }],
'sort/string-unions': ['error', { caseSensitive: false, natural: true }],
'sort/type-properties': ['warn', { caseSensitive: false, natural: true }],
'sort/type-properties': ['error', { caseSensitive: false, natural: true }]
}
}
);