@lark-apaas/fullstack-presets 1.1.9 → 1.1.11

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%)]',
@@ -42,8 +42,8 @@ declare const _default: ({
42
42
  files: string[];
43
43
  rules: {
44
44
  'no-restricted-syntax': (string | {
45
- message: string;
46
45
  selector: string;
46
+ message: string;
47
47
  })[];
48
48
  };
49
49
  } | null)[];
@@ -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"]',
@@ -71,6 +66,23 @@ exports.looseRestrictSyntaxRules = [
71
66
  selector: 'JSXAttribute[name.name="className"][value.value=/\\[rgb\\([^\\]]*\\s[^\\]]*\\)/]',
72
67
  message: 'Tailwind 4 arbitrary values cannot contain spaces. Replace spaces with underscores in rgb() values. Example: bg-[rgb(255_255_255)] instead of bg-[rgb(255 255 255)]',
73
68
  },
69
+ // 阻止模型引用 @shared/static 与 shared/static 的字符串
70
+ {
71
+ selector: 'Literal[value=/^@shared\\u002Fstatic/]:not(ImportDeclaration > Literal):not(ExportAllDeclaration > Literal):not(ExportNamedDeclaration > Literal):not(ImportExpression > Literal)',
72
+ message: "Do not use '@shared/static/*' or 'shared/static/*' as a raw string (e.g. in fetch, image src, etc.). Shared static assets must be accessed via import statements.",
73
+ },
74
+ {
75
+ selector: 'TemplateLiteral[expressions.length=0] > TemplateElement[value.raw=/^@shared\\u002Fstatic/]',
76
+ message: "Do not use '@shared/static/*' or 'shared/static/*' as a raw string (e.g. in fetch, image src, etc.). Shared static assets must be accessed via import statements.",
77
+ },
78
+ {
79
+ selector: 'Literal[value=/^shared\\u002Fstatic/]:not(ImportDeclaration > Literal):not(ExportAllDeclaration > Literal):not(ExportNamedDeclaration > Literal):not(ImportExpression > Literal)',
80
+ message: "Do not use '@shared/static/*' or 'shared/static/*' as a raw string (e.g. in fetch, image src, etc.). Shared static assets must be accessed via import statements.",
81
+ },
82
+ {
83
+ selector: 'TemplateLiteral[expressions.length=0] > TemplateElement[value.raw=/^shared\\u002Fstatic/]',
84
+ message: "Do not use '@shared/static/*' or 'shared/static/*' as a raw string (e.g. in fetch, image src, etc.). Shared static assets must be accessed via import statements.",
85
+ },
74
86
  ];
75
87
  // 严格语法规则:仅正常模式启用,loose 模式下不启用
76
88
  const strictSyntaxRules = [
@@ -101,25 +113,6 @@ const strictSyntaxRules = [
101
113
  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
114
  selector: "CallExpression[callee.name='confirm']",
103
115
  },
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
116
  ];
124
117
  const looseSpecificPlugins = {
125
118
  '@lark-apaas': { rules: custom_eslint_rules_1.customRules },
@@ -41,8 +41,8 @@ export declare const eslintPresets: {
41
41
  files: string[];
42
42
  rules: {
43
43
  'no-restricted-syntax': (string | {
44
- message: string;
45
44
  selector: string;
45
+ message: string;
46
46
  })[];
47
47
  };
48
48
  } | null)[] | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-presets",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "files": [
5
5
  "lib"
6
6
  ],