@multiplatform.one/config 9.10.0 → 9.12.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.
Files changed (2) hide show
  1. package/design-lint.mjs +24 -1
  2. package/package.json +2 -2
package/design-lint.mjs CHANGED
@@ -322,6 +322,7 @@ const cssWebPaint =
322
322
  /(?:^|[;{\s"'`])(?:mix-blend-mode|backdrop-filter|-webkit-backdrop-filter|clip-path|text-shadow|-webkit-mask(?:-image)?|mask-image)\s*:/;
323
323
  const zoomLock = /user-scalable\s*=\s*(?:no|0)\b|maximum-scale\s*=\s*1(?:\.0)?\b/;
324
324
  const linkTag = /^(?:a|Anchor|Link|TextLink|InlineLink|ExternalLink)$|\.(?:Anchor|Link)$/;
325
+ const linkLabel = /^(?:Text|SizableText|Paragraph|Span|span|Label)$|\.Text$/;
325
326
  const linkPaint =
326
327
  /^(?:color|fontWeight|textDecoration|textDecorationLine|textDecorationColor|textDecorationStyle)$/;
327
328
  const imageTag = /^(?:Image|img|ImageBackground|AvatarImage|FastImage|ExpoImage)$|\.Image$/;
@@ -1454,7 +1455,11 @@ export function inspectDesign(source, filename, projectRoot = process.cwd(), opt
1454
1455
  // LC-181 LINK-CHROME and LC-207 ART-NEVER-TINTED at a JSX use site.
1455
1456
  function checkElement(element) {
1456
1457
  const tag = tagText(element.tagName);
1457
- if (linkTag.test(tag)) {
1458
+ const roleLink = attribute(element, "role")?.initializer?.getText(file) === '"link"';
1459
+ if (
1460
+ (linkTag.test(tag) || roleLink) &&
1461
+ !opening(element).getText(file).includes("link-chrome-escape:")
1462
+ ) {
1458
1463
  const key = paintedBy(element, linkPaint);
1459
1464
  if (key)
1460
1465
  report(
@@ -1462,6 +1467,24 @@ export function inspectDesign(source, filename, projectRoot = process.cwd(), opt
1462
1467
  "link-chrome",
1463
1468
  `${tag} sets ${key}; a link's ink, weight and underline come from the theme (LC-181).`,
1464
1469
  );
1470
+ if (linkTag.test(tag) && ts.isJsxOpeningElement(element)) {
1471
+ const walk = (node) => {
1472
+ if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {
1473
+ const inner = opening(node);
1474
+ const innerTag = tagText(inner.tagName);
1475
+ if (linkTag.test(innerTag)) return;
1476
+ const innerKey = linkLabel.test(innerTag) && paintedBy(inner, linkPaint);
1477
+ if (innerKey)
1478
+ report(
1479
+ inner,
1480
+ "link-chrome",
1481
+ `${innerTag} inside ${tag} sets ${innerKey}; put the label straight in the link and let the theme draw it (LC-181).`,
1482
+ );
1483
+ }
1484
+ ts.forEachChild(node, walk);
1485
+ };
1486
+ for (const child of element.parent.children) walk(child);
1487
+ }
1465
1488
  }
1466
1489
  if (
1467
1490
  imageTag.test(tag) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/config",
3
- "version": "9.10.0",
3
+ "version": "9.12.0",
4
4
  "description": "Shared build and test configuration presets for multiplatform.one",
5
5
  "keywords": [
6
6
  "config",
@@ -122,7 +122,7 @@
122
122
  "@babel/parser": "^7.29.9",
123
123
  "@babel/plugin-transform-block-scoping": "^7.29.7",
124
124
  "@babel/traverse": "^7.29.10",
125
- "@multiplatform.one/utils": "^9.10.0",
125
+ "@multiplatform.one/utils": "^9.12.0",
126
126
  "@tamagui/vite-plugin": "2.7.6",
127
127
  "@vitejs/plugin-react": "^6.1.2",
128
128
  "dotenv": "^17.4.2",