Skip to content

Commit 410850c

Browse files
committed
feat: add eslint
1 parent c1fabf9 commit 410850c

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

eslint.config.js

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import { defineConfig } from '@soybeanjs/eslint-config';
2+
import sort from 'eslint-plugin-sort';
3+
4+
export default defineConfig(
5+
{
6+
prettierRules: {
7+
singleAttributePerLine: true,
8+
trailingCommas: 'none'
9+
},
10+
react: true,
11+
unocss: true
12+
},
13+
sort.configs['flat/recommended'],
14+
{
15+
rules: {
16+
'import/newline-after-import': 'error',
17+
'import/no-absolute-path': 'warn',
18+
'import/no-empty-named-blocks': ['error'],
19+
'import/no-useless-path-segments': [
20+
'error',
21+
{
22+
noUselessIndex: true
23+
}
24+
],
25+
26+
'import/order': [
27+
'error',
28+
{
29+
alphabetize: {
30+
order: 'asc'
31+
},
32+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object'],
33+
'newlines-between': 'always',
34+
pathGroups: [{ group: 'internal', pattern: '{{@,~}/,#}**' }],
35+
pathGroupsExcludedImportTypes: ['builtin']
36+
}
37+
],
38+
39+
'no-underscore-dangle': 'off',
40+
41+
'react/hook-use-state': [
42+
'error', // or "warn" to only warn instead of error
43+
{
44+
allowDestructuredState: true
45+
}
46+
],
47+
48+
'react/jsx-closing-bracket-location': ['warn', 'tag-aligned'],
49+
'react/jsx-closing-tag-location': 'warn',
50+
'react/jsx-curly-brace-presence': [
51+
'warn',
52+
{
53+
children: 'never',
54+
propElementValues: 'always',
55+
props: 'never'
56+
}
57+
],
58+
'react/jsx-curly-newline': ['warn', { multiline: 'consistent', singleline: 'consistent' }],
59+
'react/jsx-equals-spacing': ['warn', 'never'],
60+
'react/jsx-fragments': ['warn', 'syntax'],
61+
'react/jsx-newline': 'warn',
62+
'react/jsx-no-undef': ['off'],
63+
'react/jsx-no-useless-fragment': 'warn',
64+
'react/jsx-one-expression-per-line': [
65+
'warn',
66+
{
67+
allow: 'single-child'
68+
}
69+
],
70+
'react/jsx-props-no-multi-spaces': 'warn',
71+
'react/jsx-sort-props': [
72+
'warn',
73+
{
74+
callbacksLast: true,
75+
ignoreCase: true,
76+
multiline: 'last',
77+
shorthandFirst: true
78+
}
79+
],
80+
'react/self-closing-comp': [
81+
'error',
82+
{
83+
component: true,
84+
html: true
85+
}
86+
],
87+
88+
'react-refresh/only-export-components': [
89+
'warn',
90+
{ allowExportNames: ['loader', 'action', 'handle', 'shouldRevalidate'] }
91+
],
92+
93+
'sort/import-members': ['error', { caseSensitive: true, natural: true }],
94+
'sort/imports': ['off'],
95+
'sort/string-enums': ['error', { caseSensitive: false, natural: true }],
96+
'sort/string-unions': ['error', { caseSensitive: false, natural: true }],
97+
'sort/type-properties': ['warn', { caseSensitive: false, natural: true }],
98+
'sort/type-properties': ['error', { caseSensitive: false, natural: true }]
99+
}
100+
}
101+
);

uno.config.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)