@lark-apaas/fullstack-presets 1.1.9 → 1.1.10
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.
|
@@ -119,32 +119,6 @@ exports.default = {
|
|
|
119
119
|
selector: "JSXOpeningElement[name.name='a']:has(JSXAttribute[name.name='href'][value.value=/^(?!https?:|\\u002F\\u002F|mailto:|tel:|#).+/])",
|
|
120
120
|
message: "Please don't use relative paths in <a> tags. Use NavLink from 'react-router-dom' instead.",
|
|
121
121
|
},
|
|
122
|
-
// 禁止 variant 为 outline|link|ghost 的 Button 使用 text-white
|
|
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
|
-
// },
|
|
147
|
-
// 禁止在 Tailwind 任意值语法中使用包含空格的 hsl/rgb 值
|
|
148
122
|
{
|
|
149
123
|
selector: 'JSXAttribute[name.name="className"][value.value=/\\[hsl\\([^\\]]*\\s[^\\]]*\\)/]',
|
|
150
124
|
message: 'Tailwind 4 arbitrary values cannot contain spaces. Replace spaces with underscores in hsl() values. Example: from-[hsl(215_60%_18%)] instead of from-[hsl(215 60% 18%)]',
|
|
@@ -28,11 +28,6 @@ const projectFlags = getProjectFlags();
|
|
|
28
28
|
const supportScrollReveal = projectFlags.supportScrollReveal === true;
|
|
29
29
|
// 基础语法规则:所有模式都启用(包括 loose 模式)
|
|
30
30
|
const baseSyntaxRules = [
|
|
31
|
-
// SelectItem组件的value属性值不能为空字符串
|
|
32
|
-
{
|
|
33
|
-
message: 'The `value` attribute of the `SelectItem` component cannot be an empty string.',
|
|
34
|
-
selector: 'JSXOpeningElement[name.name="SelectItem"]:has(JSXAttribute[name.name="value"][value.value=""]), JSXOpeningElement[name.name="SelectItem"]:has(JSXAttribute[name.name="value"][value.expression.value=""])',
|
|
35
|
-
},
|
|
36
31
|
// 禁用`window.location.href`赋值使用,可以读取
|
|
37
32
|
{
|
|
38
33
|
selector: 'AssignmentExpression[left.object.object.name="window"][left.object.property.name="location"][left.property.name="href"]',
|
|
@@ -101,25 +96,6 @@ const strictSyntaxRules = [
|
|
|
101
96
|
message: "Please don't use confirm. It may conflict with window.confirm BOM method, use `Dialog` component instead for better user experience and consistency",
|
|
102
97
|
selector: "CallExpression[callee.name='confirm']",
|
|
103
98
|
},
|
|
104
|
-
// 禁止 variant 为 outline|link|ghost 的 Button 使用 text-white
|
|
105
|
-
{
|
|
106
|
-
selector: 'JSXElement[openingElement.name.name="Button"]' +
|
|
107
|
-
':has(JSXAttribute[name.name="variant"][value.value=/^(outline|link|ghost)$/])' +
|
|
108
|
-
':has(JSXAttribute[name.name="className"][value.value=/text-white/])',
|
|
109
|
-
message: '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`',
|
|
110
|
-
},
|
|
111
|
-
// 禁止在 Button 上组合 text-primary-foreground 与 bg-background 并用的情况
|
|
112
|
-
{
|
|
113
|
-
selector: 'JSXElement[openingElement.name.name="Button"]' +
|
|
114
|
-
':has(JSXAttribute[name.name="className"][value.value=/text-primary-foreground/])' +
|
|
115
|
-
':has(JSXAttribute[name.name="className"][value.value=/bg-background/])',
|
|
116
|
-
message: '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`',
|
|
117
|
-
},
|
|
118
|
-
// 禁止使用 text-accent
|
|
119
|
-
{
|
|
120
|
-
selector: 'JSXAttribute[name.name="className"][value.value=/(^|\\s)text-accent(\\s|$)/]',
|
|
121
|
-
message: 'Classname "text-accent" would cause visibility issues. Consider using proper semantic color tokens from `client/src/tailwind-theme.css`',
|
|
122
|
-
},
|
|
123
99
|
];
|
|
124
100
|
const looseSpecificPlugins = {
|
|
125
101
|
'@lark-apaas': { rules: custom_eslint_rules_1.customRules },
|