@multiplatform.one/config 9.12.1 → 9.14.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/design-lint.mjs +48 -1
- package/package.json +2 -2
package/design-lint.mjs
CHANGED
|
@@ -650,6 +650,31 @@ export function isFreeformBoard(filename, projectRoot = process.cwd()) {
|
|
|
650
650
|
);
|
|
651
651
|
}
|
|
652
652
|
|
|
653
|
+
// LC-180: a deprecated alias passes only while the removal version it names
|
|
654
|
+
// is still ahead of its package's own version, so an alias that outlived its
|
|
655
|
+
// removal fails again.
|
|
656
|
+
function packageVersion(filename, projectRoot) {
|
|
657
|
+
const top = path.resolve(projectRoot);
|
|
658
|
+
let dir = path.dirname(path.resolve(top, filename));
|
|
659
|
+
while (dir.startsWith(top)) {
|
|
660
|
+
const manifest = path.join(dir, "package.json");
|
|
661
|
+
if (existsSync(manifest)) return JSON.parse(readFileSync(manifest, "utf8")).version;
|
|
662
|
+
if (dir === top) break;
|
|
663
|
+
dir = path.dirname(dir);
|
|
664
|
+
}
|
|
665
|
+
return undefined;
|
|
666
|
+
}
|
|
667
|
+
const semverParts = (version) => version.split(".").map(Number);
|
|
668
|
+
export function aliasPending(comment, filename, projectRoot = process.cwd()) {
|
|
669
|
+
const removal = comment.match(/\bremoved in (\d+\.\d+\.\d+)/i)?.[1];
|
|
670
|
+
if (!removal) return false;
|
|
671
|
+
const current = packageVersion(filename, projectRoot)?.match(/^\d+\.\d+\.\d+/)?.[0];
|
|
672
|
+
if (!current) return true;
|
|
673
|
+
const [ahead, now] = [semverParts(removal), semverParts(current)];
|
|
674
|
+
const at = ahead.findIndex((part, index) => part !== now[index]);
|
|
675
|
+
return at !== -1 && ahead[at] > now[at];
|
|
676
|
+
}
|
|
677
|
+
|
|
653
678
|
export function inspectDesign(source, filename, projectRoot = process.cwd(), options = {}) {
|
|
654
679
|
if (isFreeformBoard(filename, projectRoot)) return [];
|
|
655
680
|
if (/\.json$/.test(filename)) return inspectCatalog(source, filename, options);
|
|
@@ -1220,6 +1245,15 @@ export function inspectDesign(source, filename, projectRoot = process.cwd(), opt
|
|
|
1220
1245
|
(type.kind === ts.SyntaxKind.BooleanKeyword ||
|
|
1221
1246
|
(ts.isLiteralTypeNode(type) &&
|
|
1222
1247
|
[ts.SyntaxKind.TrueKeyword, ts.SyntaxKind.FalseKeyword].includes(type.literal.kind)));
|
|
1248
|
+
const tokenType = (type) => {
|
|
1249
|
+
if (!type) return true;
|
|
1250
|
+
if (ts.isUnionTypeNode(type)) return type.types.every(tokenType);
|
|
1251
|
+
if (ts.isParenthesizedTypeNode(type)) return tokenType(type.type);
|
|
1252
|
+
if (ts.isLiteralTypeNode(type)) return true;
|
|
1253
|
+
if (type.kind === ts.SyntaxKind.StringKeyword || type.kind === ts.SyntaxKind.NumberKeyword)
|
|
1254
|
+
return true;
|
|
1255
|
+
return ts.isTypeReferenceNode(type) && /Tokens?$/.test(type.typeName.getText());
|
|
1256
|
+
};
|
|
1223
1257
|
// LC-180 API-VOCABULARY over the props a module exports.
|
|
1224
1258
|
function checkProps(declaration) {
|
|
1225
1259
|
const members = ts.isInterfaceDeclaration(declaration)
|
|
@@ -1234,10 +1268,23 @@ export function inspectDesign(source, filename, projectRoot = process.cwd(), opt
|
|
|
1234
1268
|
const owner = declaration.name.text;
|
|
1235
1269
|
for (const member of members) {
|
|
1236
1270
|
if (!ts.isPropertySignature(member) || !member.name) continue;
|
|
1271
|
+
if (
|
|
1272
|
+
ts
|
|
1273
|
+
.getJSDocTags(member)
|
|
1274
|
+
.some(
|
|
1275
|
+
(tag) =>
|
|
1276
|
+
tag.tagName.text === "deprecated" &&
|
|
1277
|
+
aliasPending(ts.getTextOfJSDocComment(tag.comment) ?? "", filename, projectRoot),
|
|
1278
|
+
)
|
|
1279
|
+
)
|
|
1280
|
+
continue;
|
|
1237
1281
|
const prop = name(member.name);
|
|
1238
1282
|
const literals = literalTypes(member.type);
|
|
1239
1283
|
let problem;
|
|
1240
|
-
if (
|
|
1284
|
+
if (
|
|
1285
|
+
(/^(?:density|scale)$/.test(prop) && tokenType(member.type)) ||
|
|
1286
|
+
(prop === "level" && literals.length)
|
|
1287
|
+
)
|
|
1241
1288
|
problem = `${prop} is a synonym for size; take a size token`;
|
|
1242
1289
|
else if (prop === "enabled") problem = "enabled is a negative of disabled; use disabled";
|
|
1243
1290
|
else if (/^(?:isOpen|opened|isVisible|onVisibleChange|onIsOpenChange)$/.test(prop))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/config",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.14.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.
|
|
125
|
+
"@multiplatform.one/utils": "^9.14.0",
|
|
126
126
|
"@tamagui/vite-plugin": "2.7.6",
|
|
127
127
|
"@vitejs/plugin-react": "^6.1.2",
|
|
128
128
|
"dotenv": "^17.4.2",
|