@chatbi-v/config 2.1.10 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/eslint.mjs +116 -6
- package/package.json +8 -3
- package/tailwind.js +1 -1
package/README.md
CHANGED
|
@@ -23,8 +23,8 @@ export default [
|
|
|
23
23
|
// 你的自定义配置
|
|
24
24
|
rules: {
|
|
25
25
|
// ...
|
|
26
|
-
}
|
|
27
|
-
}
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
28
|
];
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -57,17 +57,17 @@ import baseConfig from '@chatbi-v/config/tailwind';
|
|
|
57
57
|
export default {
|
|
58
58
|
...baseConfig,
|
|
59
59
|
content: [
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
'./index.html',
|
|
61
|
+
'./src/**/*.{js,ts,jsx,tsx}',
|
|
62
62
|
// 如果是 Monorepo,可能需要包含其他包
|
|
63
|
-
|
|
63
|
+
'../../packages/ui/src/**/*.{js,ts,jsx,tsx}',
|
|
64
64
|
],
|
|
65
65
|
theme: {
|
|
66
66
|
extend: {
|
|
67
67
|
...baseConfig.theme.extend,
|
|
68
68
|
// 你的自定义主题
|
|
69
|
-
}
|
|
70
|
-
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
71
|
};
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -89,17 +89,20 @@ export default {
|
|
|
89
89
|
## 配置详情
|
|
90
90
|
|
|
91
91
|
### ESLint
|
|
92
|
+
|
|
92
93
|
- 基于 `eslint-config-standard`
|
|
93
94
|
- 集成 `@typescript-eslint`
|
|
94
95
|
- 集成 `eslint-plugin-react` 和 `eslint-plugin-react-hooks`
|
|
95
96
|
- 强制 import 排序 (`simple-import-sort`)
|
|
96
97
|
|
|
97
98
|
### Tailwind
|
|
99
|
+
|
|
98
100
|
- 预定义颜色系统(Primary, Secondary, Accent 等)
|
|
99
101
|
- 预定义阴影效果(Neon, Glass)
|
|
100
102
|
- 自动关闭 Preflight(避免与 Ant Design 冲突)
|
|
101
103
|
|
|
102
104
|
### TypeScript
|
|
105
|
+
|
|
103
106
|
- 严格模式 (`strict: true`)
|
|
104
107
|
- 目标版本 `ESNext`
|
|
105
108
|
- 模块解析 `bundler`
|
package/eslint.mjs
CHANGED
|
@@ -10,21 +10,61 @@ import tsParser from '@typescript-eslint/parser';
|
|
|
10
10
|
import reactPlugin from 'eslint-plugin-react';
|
|
11
11
|
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
12
12
|
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
|
|
13
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
13
14
|
import globals from 'globals';
|
|
15
|
+
import themePlugin from '@chatbi-v/eslint-plugin-theme';
|
|
14
16
|
|
|
15
17
|
export default [
|
|
16
18
|
{
|
|
17
|
-
ignores: ['**/dist/**', '**/build/**', '**/node_modules/**', '**/.trae/**'],
|
|
19
|
+
ignores: ['**/dist/**', '**/build/**', '**/node_modules/**', '**/.trae/**', 'packages/cli/templates/**'],
|
|
18
20
|
},
|
|
19
21
|
js.configs.recommended,
|
|
20
22
|
{
|
|
21
|
-
files: ['**/*.js', '**/*.
|
|
23
|
+
files: ['**/*.js', '**/*.jsx', '**/*.mjs'],
|
|
24
|
+
languageOptions: {
|
|
25
|
+
sourceType: 'module',
|
|
26
|
+
ecmaVersion: 'latest',
|
|
27
|
+
globals: {
|
|
28
|
+
...globals.browser,
|
|
29
|
+
...globals.node,
|
|
30
|
+
describe: 'readonly',
|
|
31
|
+
it: 'readonly',
|
|
32
|
+
test: 'readonly',
|
|
33
|
+
expect: 'readonly',
|
|
34
|
+
beforeEach: 'readonly',
|
|
35
|
+
afterEach: 'readonly',
|
|
36
|
+
beforeAll: 'readonly',
|
|
37
|
+
afterAll: 'readonly',
|
|
38
|
+
jest: 'readonly',
|
|
39
|
+
},
|
|
40
|
+
parserOptions: {
|
|
41
|
+
ecmaFeatures: {
|
|
42
|
+
jsx: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
rules: {
|
|
47
|
+
'no-unused-vars': [
|
|
48
|
+
'warn',
|
|
49
|
+
{
|
|
50
|
+
argsIgnorePattern: '^_',
|
|
51
|
+
varsIgnorePattern: '^_',
|
|
52
|
+
caughtErrorsIgnorePattern: '^_',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
files: ['**/*.cjs'],
|
|
22
59
|
languageOptions: {
|
|
23
60
|
sourceType: 'commonjs',
|
|
24
61
|
globals: {
|
|
25
62
|
...globals.node,
|
|
26
63
|
},
|
|
27
64
|
},
|
|
65
|
+
rules: {
|
|
66
|
+
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
67
|
+
},
|
|
28
68
|
},
|
|
29
69
|
{
|
|
30
70
|
files: ['**/*.ts', '**/*.tsx'],
|
|
@@ -40,13 +80,15 @@ export default [
|
|
|
40
80
|
globals: {
|
|
41
81
|
...globals.browser,
|
|
42
82
|
...globals.node,
|
|
83
|
+
...globals.jest,
|
|
43
84
|
},
|
|
44
85
|
},
|
|
45
86
|
plugins: {
|
|
46
87
|
'@typescript-eslint': tsPlugin,
|
|
47
|
-
|
|
88
|
+
react: reactPlugin,
|
|
48
89
|
'react-hooks': reactHooksPlugin,
|
|
49
90
|
'simple-import-sort': simpleImportSortPlugin,
|
|
91
|
+
'@chatbi-v/theme': themePlugin,
|
|
50
92
|
},
|
|
51
93
|
rules: {
|
|
52
94
|
...tsPlugin.configs.recommended.rules,
|
|
@@ -58,9 +100,22 @@ export default [
|
|
|
58
100
|
'react/prop-types': 'off', // TS covers this
|
|
59
101
|
'react/display-name': 'off', // TS inference is usually enough
|
|
60
102
|
'no-undef': 'off', // TS covers this
|
|
61
|
-
'@typescript-eslint/no-explicit-any': '
|
|
62
|
-
'@typescript-eslint/no-unused-vars': [
|
|
103
|
+
'@typescript-eslint/no-explicit-any': 'off', // Temporarily disabled for legacy code
|
|
104
|
+
'@typescript-eslint/no-unused-vars': [
|
|
105
|
+
'warn',
|
|
106
|
+
{ argsIgnorePattern: '^_' },
|
|
107
|
+
],
|
|
108
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
109
|
+
'error',
|
|
110
|
+
{ 'ts-expect-error': 'allow-with-description' },
|
|
111
|
+
],
|
|
63
112
|
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
|
|
113
|
+
// Fix for no-unsafe-function-type in newer TS ESLint
|
|
114
|
+
'@typescript-eslint/no-unsafe-function-type': 'off',
|
|
115
|
+
|
|
116
|
+
// Theme Rules (error 级别阻止提交)
|
|
117
|
+
// '@chatbi-v/theme/no-hardcoded-colors': 'error',
|
|
118
|
+
// '@chatbi-v/theme/no-hardcoded-tailwind': 'error',
|
|
64
119
|
},
|
|
65
120
|
settings: {
|
|
66
121
|
react: {
|
|
@@ -68,4 +123,59 @@ export default [
|
|
|
68
123
|
},
|
|
69
124
|
},
|
|
70
125
|
},
|
|
71
|
-
|
|
126
|
+
// Disable theme rules for theme definition and utility files
|
|
127
|
+
{
|
|
128
|
+
files: [
|
|
129
|
+
'**/tokens/**',
|
|
130
|
+
'**/foundations/**',
|
|
131
|
+
'**/theme/**',
|
|
132
|
+
'**/themes/**',
|
|
133
|
+
'**/*.token.ts',
|
|
134
|
+
'**/*.theme.ts',
|
|
135
|
+
'**/*.preset.ts',
|
|
136
|
+
'**/colors.ts',
|
|
137
|
+
'**/palette.ts',
|
|
138
|
+
'**/color.ts',
|
|
139
|
+
'**/utils/color.ts',
|
|
140
|
+
'**/utils/token-matcher.ts',
|
|
141
|
+
'**/*.test.ts',
|
|
142
|
+
'**/*.test.tsx',
|
|
143
|
+
'**/tests/**',
|
|
144
|
+
],
|
|
145
|
+
rules: {
|
|
146
|
+
// '@chatbi-v/theme/no-hardcoded-colors': 'off',
|
|
147
|
+
// '@chatbi-v/theme/no-arbitrary-tailwind': 'off',
|
|
148
|
+
// '@chatbi-v/theme/no-hardcoded-tailwind': 'off',
|
|
149
|
+
// '@chatbi-v/theme/no-inline-styles': 'off'
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
// Allow @ts-nocheck in legacy UI components (pre-existing technical debt)
|
|
153
|
+
{
|
|
154
|
+
files: [
|
|
155
|
+
'packages/ui/src/components/chat/**/*.tsx',
|
|
156
|
+
'packages/ui/src/components/shells/**/*.tsx',
|
|
157
|
+
'packages/ui/src/components/markdown/**/*.tsx',
|
|
158
|
+
],
|
|
159
|
+
rules: {
|
|
160
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
// Disable strict react-hooks rules for pre-existing technical debt in plugins
|
|
164
|
+
{
|
|
165
|
+
files: [
|
|
166
|
+
'packages/plugins/capability-showcase/**/*.tsx',
|
|
167
|
+
'packages/plugins/theme-manager/src/**/*.tsx',
|
|
168
|
+
'packages/plugins/theme-manager/src/**/*.ts',
|
|
169
|
+
],
|
|
170
|
+
rules: {
|
|
171
|
+
'react-hooks/set-state-in-effect': 'off',
|
|
172
|
+
'react-hooks/purity': 'off',
|
|
173
|
+
'react-hooks/preserve-manual-memoization': 'off',
|
|
174
|
+
'react/no-unstable-nested-components': 'off',
|
|
175
|
+
'react/jsx-key': 'off',
|
|
176
|
+
'react-hooks/static-components': 'off',
|
|
177
|
+
'react/no-unescaped-entities': 'off',
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
prettierConfig,
|
|
181
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatbi-v/config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,7 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"eslint": "^9.0.0",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"tailwindcss": "^3.4.0",
|
|
36
|
+
"typescript": "^5.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"eslint-config-prettier": "^10.1.8",
|
|
40
|
+
"vitest": "^1.3.1",
|
|
41
|
+
"@chatbi-v/eslint-plugin-theme": "3.1.1"
|
|
37
42
|
}
|
|
38
43
|
}
|
package/tailwind.js
CHANGED