@chatbi-v/config 2.1.9 → 3.0.0
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/eslint.mjs +103 -2
- package/package.json +6 -3
package/eslint.mjs
CHANGED
|
@@ -10,7 +10,9 @@ 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
|
{
|
|
@@ -18,13 +20,48 @@ export default [
|
|
|
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': ['warn', {
|
|
48
|
+
argsIgnorePattern: '^_',
|
|
49
|
+
varsIgnorePattern: '^_',
|
|
50
|
+
caughtErrorsIgnorePattern: '^_'
|
|
51
|
+
}],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
files: ['**/*.cjs'],
|
|
22
56
|
languageOptions: {
|
|
23
57
|
sourceType: 'commonjs',
|
|
24
58
|
globals: {
|
|
25
59
|
...globals.node,
|
|
26
60
|
},
|
|
27
61
|
},
|
|
62
|
+
rules: {
|
|
63
|
+
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
64
|
+
},
|
|
28
65
|
},
|
|
29
66
|
{
|
|
30
67
|
files: ['**/*.ts', '**/*.tsx'],
|
|
@@ -40,6 +77,7 @@ export default [
|
|
|
40
77
|
globals: {
|
|
41
78
|
...globals.browser,
|
|
42
79
|
...globals.node,
|
|
80
|
+
...globals.jest,
|
|
43
81
|
},
|
|
44
82
|
},
|
|
45
83
|
plugins: {
|
|
@@ -47,6 +85,7 @@ export default [
|
|
|
47
85
|
'react': reactPlugin,
|
|
48
86
|
'react-hooks': reactHooksPlugin,
|
|
49
87
|
'simple-import-sort': simpleImportSortPlugin,
|
|
88
|
+
'@chatbi-v/theme': themePlugin,
|
|
50
89
|
},
|
|
51
90
|
rules: {
|
|
52
91
|
...tsPlugin.configs.recommended.rules,
|
|
@@ -58,9 +97,16 @@ export default [
|
|
|
58
97
|
'react/prop-types': 'off', // TS covers this
|
|
59
98
|
'react/display-name': 'off', // TS inference is usually enough
|
|
60
99
|
'no-undef': 'off', // TS covers this
|
|
61
|
-
'@typescript-eslint/no-explicit-any': '
|
|
100
|
+
'@typescript-eslint/no-explicit-any': 'off', // Temporarily disabled for legacy code
|
|
62
101
|
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
102
|
+
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }],
|
|
63
103
|
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
|
|
104
|
+
// Fix for no-unsafe-function-type in newer TS ESLint
|
|
105
|
+
'@typescript-eslint/no-unsafe-function-type': 'off',
|
|
106
|
+
|
|
107
|
+
// Theme Rules (error 级别阻止提交)
|
|
108
|
+
// '@chatbi-v/theme/no-hardcoded-colors': 'error',
|
|
109
|
+
// '@chatbi-v/theme/no-hardcoded-tailwind': 'error',
|
|
64
110
|
},
|
|
65
111
|
settings: {
|
|
66
112
|
react: {
|
|
@@ -68,4 +114,59 @@ export default [
|
|
|
68
114
|
},
|
|
69
115
|
},
|
|
70
116
|
},
|
|
117
|
+
// Disable theme rules for theme definition and utility files
|
|
118
|
+
{
|
|
119
|
+
files: [
|
|
120
|
+
'**/tokens/**',
|
|
121
|
+
'**/foundations/**',
|
|
122
|
+
'**/theme/**',
|
|
123
|
+
'**/themes/**',
|
|
124
|
+
'**/*.token.ts',
|
|
125
|
+
'**/*.theme.ts',
|
|
126
|
+
'**/*.preset.ts',
|
|
127
|
+
'**/colors.ts',
|
|
128
|
+
'**/palette.ts',
|
|
129
|
+
'**/color.ts',
|
|
130
|
+
'**/utils/color.ts',
|
|
131
|
+
'**/utils/token-matcher.ts',
|
|
132
|
+
'**/*.test.ts',
|
|
133
|
+
'**/*.test.tsx',
|
|
134
|
+
'**/tests/**'
|
|
135
|
+
],
|
|
136
|
+
rules: {
|
|
137
|
+
// '@chatbi-v/theme/no-hardcoded-colors': 'off',
|
|
138
|
+
// '@chatbi-v/theme/no-arbitrary-tailwind': 'off',
|
|
139
|
+
// '@chatbi-v/theme/no-hardcoded-tailwind': 'off',
|
|
140
|
+
// '@chatbi-v/theme/no-inline-styles': 'off'
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
// Allow @ts-nocheck in legacy UI components (pre-existing technical debt)
|
|
144
|
+
{
|
|
145
|
+
files: [
|
|
146
|
+
'packages/ui/src/components/chat/**/*.tsx',
|
|
147
|
+
'packages/ui/src/components/shells/**/*.tsx',
|
|
148
|
+
'packages/ui/src/components/markdown/**/*.tsx',
|
|
149
|
+
],
|
|
150
|
+
rules: {
|
|
151
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
// Disable strict react-hooks rules for pre-existing technical debt in plugins
|
|
155
|
+
{
|
|
156
|
+
files: [
|
|
157
|
+
'packages/plugins/capability-showcase/**/*.tsx',
|
|
158
|
+
'packages/plugins/theme-manager/src/**/*.tsx',
|
|
159
|
+
'packages/plugins/theme-manager/src/**/*.ts',
|
|
160
|
+
],
|
|
161
|
+
rules: {
|
|
162
|
+
'react-hooks/set-state-in-effect': 'off',
|
|
163
|
+
'react-hooks/purity': 'off',
|
|
164
|
+
'react-hooks/preserve-manual-memoization': 'off',
|
|
165
|
+
'react/no-unstable-nested-components': 'off',
|
|
166
|
+
'react/jsx-key': 'off',
|
|
167
|
+
'react-hooks/static-components': 'off',
|
|
168
|
+
'react/no-unescaped-entities': 'off',
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
prettierConfig,
|
|
71
172
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatbi-v/config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,7 +32,10 @@
|
|
|
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
|
+
"@chatbi-v/eslint-plugin-theme": "3.0.0"
|
|
37
40
|
}
|
|
38
41
|
}
|