@lark-apaas/fullstack-presets 1.1.6 → 1.1.8
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.
|
@@ -56,6 +56,8 @@ exports.default = {
|
|
|
56
56
|
'no-undef': 'off', // 禁止使用未声明的变量
|
|
57
57
|
'no-console': 'off', // 允许使用 console
|
|
58
58
|
'prefer-const': 'off', // 不强制使用 const
|
|
59
|
+
'no-case-declarations': 'off', // 允许在 case 块中使用词法声明
|
|
60
|
+
'no-empty': 'off', // 允许空的 catch 块
|
|
59
61
|
// Import 规则
|
|
60
62
|
'import/no-unresolved': 'error', // 检查导入路径是否存在
|
|
61
63
|
// 其他规则
|
|
@@ -112,35 +114,36 @@ exports.default = {
|
|
|
112
114
|
selector: 'AssignmentExpression[left.object.name="location"][left.property.name="href"]',
|
|
113
115
|
message: "Please don't use `location.href` to navigate. Use `useNavigate` hook from 'react-router-dom' instead.",
|
|
114
116
|
},
|
|
115
|
-
// SelectItem组件的value属性值不能为空字符串
|
|
116
|
-
{
|
|
117
|
-
message: 'The `value` attribute of the `SelectItem` component cannot be an empty string.',
|
|
118
|
-
selector: 'JSXOpeningElement[name.name="SelectItem"]:has(JSXAttribute[name.name="value"][value.value=""]), JSXOpeningElement[name.name="SelectItem"]:has(JSXAttribute[name.name="value"][value.expression.value=""])',
|
|
119
|
-
},
|
|
120
117
|
// 禁止a标签href使用相对路径
|
|
121
118
|
{
|
|
122
119
|
selector: "JSXOpeningElement[name.name='a']:has(JSXAttribute[name.name='href'][value.value=/^(?!https?:|\\u002F\\u002F|mailto:|tel:|#).+/])",
|
|
123
120
|
message: "Please don't use relative paths in <a> tags. Use NavLink from 'react-router-dom' instead.",
|
|
124
121
|
},
|
|
125
122
|
// 禁止 variant 为 outline|link|ghost 的 Button 使用 text-white
|
|
126
|
-
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
123
|
+
// {
|
|
124
|
+
// selector:
|
|
125
|
+
// 'JSXElement[openingElement.name.name="Button"]' +
|
|
126
|
+
// ':has(JSXAttribute[name.name="variant"][value.value=/^(outline|link|ghost)$/])' +
|
|
127
|
+
// ':has(JSXAttribute[name.name="className"][value.value=/text-white/])',
|
|
128
|
+
// message:
|
|
129
|
+
// 'Button with variant="outline|link|ghost" should not use "text-white" className. This causes visibility issues. Consider using proper semantic color tokens from `client/src/tailwind-theme.css`',
|
|
130
|
+
// },
|
|
131
|
+
// // 禁止在 Button 上组合 text-primary-foreground 与 bg-background 并用的情况
|
|
132
|
+
// {
|
|
133
|
+
// selector:
|
|
134
|
+
// 'JSXElement[openingElement.name.name="Button"]' +
|
|
135
|
+
// ':has(JSXAttribute[name.name="className"][value.value=/text-primary-foreground/])' +
|
|
136
|
+
// ':has(JSXAttribute[name.name="className"][value.value=/bg-background/])',
|
|
137
|
+
// message:
|
|
138
|
+
// 'Button should not use "text-primary-foreground" and "bg-background" className. This causes visibility issues. Consider using proper semantic color tokens from `client/src/tailwind-theme.css`',
|
|
139
|
+
// },
|
|
140
|
+
// // 禁止使用 text-accent
|
|
141
|
+
// {
|
|
142
|
+
// selector:
|
|
143
|
+
// 'JSXAttribute[name.name="className"][value.value=/(^|\\s)text-accent(\\s|$)/]',
|
|
144
|
+
// message:
|
|
145
|
+
// 'Classname "text-accent" would cause visibility issues. Consider using proper semantic color tokens from `client/src/tailwind-theme.css`',
|
|
146
|
+
// },
|
|
144
147
|
// 禁止在 Tailwind 任意值语法中使用包含空格的 hsl/rgb 值
|
|
145
148
|
{
|
|
146
149
|
selector: 'JSXAttribute[name.name="className"][value.value=/\\[hsl\\([^\\]]*\\s[^\\]]*\\)/]',
|
|
@@ -167,6 +167,9 @@ const baseConfig = {
|
|
|
167
167
|
'no-undef': 'off', // 禁止使用未声明的变量
|
|
168
168
|
'no-console': 'off', // 允许使用 console
|
|
169
169
|
'prefer-const': 'off', // 不强制使用 const
|
|
170
|
+
'no-control-regex': 'off',
|
|
171
|
+
'no-useless-escape': 'off',
|
|
172
|
+
'no-case-declarations': 'off',
|
|
170
173
|
// Import 规则
|
|
171
174
|
'import/no-unresolved': 'error', // 检查导入路径是否存在
|
|
172
175
|
// 其他规则
|
|
@@ -29,6 +29,9 @@ declare const _default: {
|
|
|
29
29
|
'no-undef': string;
|
|
30
30
|
'no-console': string;
|
|
31
31
|
'prefer-const': string;
|
|
32
|
+
'no-control-regex': string;
|
|
33
|
+
'no-useless-escape': string;
|
|
34
|
+
'no-case-declarations': string;
|
|
32
35
|
'import/no-unresolved': string;
|
|
33
36
|
'import/no-extraneous-dependencies': string;
|
|
34
37
|
'no-restricted-imports': (string | {
|
|
@@ -39,6 +39,9 @@ exports.default = {
|
|
|
39
39
|
'no-undef': 'off',
|
|
40
40
|
'no-console': 'error',
|
|
41
41
|
'prefer-const': 'off',
|
|
42
|
+
'no-control-regex': 'off',
|
|
43
|
+
'no-useless-escape': 'off',
|
|
44
|
+
'no-case-declarations': 'off',
|
|
42
45
|
// Import 规则
|
|
43
46
|
'import/no-unresolved': 'error',
|
|
44
47
|
'import/no-extraneous-dependencies': 'error',
|