@multiplatform.one/config 7.5.0 → 7.6.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/lint.mjs +20 -2
- package/package.json +2 -2
- package/src/oxlint.spec.ts +76 -0
package/lint.mjs
CHANGED
|
@@ -399,10 +399,24 @@ function readThemeKeys() {
|
|
|
399
399
|
return keys;
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
/**
|
|
402
|
+
/**
|
|
403
|
+
* Font-size steps the house fonts register. MPO-19 X8/X9 retired the
|
|
404
|
+
* hand-mirrored `interBaseSizes` table — `defaults/fonts.ts` now READS its
|
|
405
|
+
* size tables from `@tamagui/config/v5`'s `defaultConfig.fonts`, so this
|
|
406
|
+
* registry reads the same source (the era pin is load-bearing). The source
|
|
407
|
+
* parse survives as a fallback for consumer trees that still carry the
|
|
408
|
+
* transcribed table.
|
|
409
|
+
*/
|
|
403
410
|
function readFontSizeSteps() {
|
|
404
411
|
/** @type {Set<string>} */
|
|
405
412
|
const steps = new Set();
|
|
413
|
+
const cfg = tryRequire("@tamagui/config/v5");
|
|
414
|
+
for (const font of Object.values(cfg?.defaultConfig?.fonts ?? {})) {
|
|
415
|
+
// Bare keys (`1`…`16`, `true`) — checkStyleTokens compares the captured
|
|
416
|
+
// token name without its `$`, same shape keysOfBlock returned.
|
|
417
|
+
for (const k of Object.keys(font?.size ?? {})) steps.add(k);
|
|
418
|
+
}
|
|
419
|
+
if (steps.size) return steps;
|
|
406
420
|
const src = readPublicSource("theme/src/theme/defaults/fonts.ts");
|
|
407
421
|
if (!src) return steps;
|
|
408
422
|
for (const k of keysOfBlock(sliceBlock(src, "const interBaseSizes", "\n};"), 2)) steps.add(k);
|
|
@@ -566,7 +580,11 @@ function checkAnimationProps() {
|
|
|
566
580
|
// `ctx.knobProps.transition` are caught too. Deliberately NOT "any value":
|
|
567
581
|
// that also matches TS annotations (`animation: any`), css-in-js, and
|
|
568
582
|
// unrelated config objects that have nothing to do with the tamagui prop.
|
|
569
|
-
|
|
583
|
+
// The lookbehind keeps `data-animation={…}` (probe attributes: Spinner,
|
|
584
|
+
// Pagination) out: `\b` alone matches between `-` and `animation`.
|
|
585
|
+
for (const m of src.matchAll(
|
|
586
|
+
/(?<![\w-])animation=\{|(?<![\w-])animation:\s*[\w$.[\]?]*\btransition\b/g,
|
|
587
|
+
)) {
|
|
570
588
|
const line = src.slice(0, m.index).split("\n").length;
|
|
571
589
|
legacyProp.push(`${rel}:${line} — \`${m[0]}\` (tamagui 1.x prop; use \`transition\`)`);
|
|
572
590
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/config",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"description": "Shared build and test configuration presets for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"vite-plugin-external": "^6.2.2",
|
|
101
101
|
"vite-plugin-i18next-loader": "^3.1.3",
|
|
102
102
|
"vitest": "^4.1.5",
|
|
103
|
-
"@multiplatform.one/utils": "7.
|
|
103
|
+
"@multiplatform.one/utils": "7.6.0"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"tsdown": "^0.21.10",
|
package/src/oxlint.spec.ts
CHANGED
|
@@ -59,3 +59,79 @@ describe("MPO-17 export surface", () => {
|
|
|
59
59
|
expect(plugin.rules?.["no-chrome-props"]).toBeUndefined();
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* AN-8 behavioural teeth (MPO-20 AC-4). The block above only asserts the rule
|
|
65
|
+
* is DEFINED — a rule that never reports would pass it. These cases drive the
|
|
66
|
+
* rule's own visitor and assert it reports on every raw typography hatch and
|
|
67
|
+
* stays silent on the house names, so "the lint fails on raw typography in app
|
|
68
|
+
* code" is a checked claim rather than a registration.
|
|
69
|
+
*/
|
|
70
|
+
describe("mpo-conventions/no-raw-typography (AN-8)", () => {
|
|
71
|
+
const rule = plugin.rules?.["no-raw-typography"];
|
|
72
|
+
|
|
73
|
+
type Report = { data?: { name?: string } };
|
|
74
|
+
type ImportVisitor = { ImportDeclaration: (node: unknown) => void };
|
|
75
|
+
type Creatable = { create: (context: unknown) => ImportVisitor };
|
|
76
|
+
|
|
77
|
+
/** Minimal ESTree ImportDeclaration — the only node shape the rule visits. */
|
|
78
|
+
function importDeclaration(source: string, names: string[]) {
|
|
79
|
+
return {
|
|
80
|
+
type: "ImportDeclaration",
|
|
81
|
+
source: { value: source },
|
|
82
|
+
specifiers: names.map((name) => ({ type: "ImportSpecifier", imported: { name } })),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function reportedNames(source: string, names: string[]): string[] {
|
|
87
|
+
const reports: Report[] = [];
|
|
88
|
+
const context = {
|
|
89
|
+
filename: "apps/one/app/index.tsx",
|
|
90
|
+
report: (report: Report) => reports.push(report),
|
|
91
|
+
};
|
|
92
|
+
const visitors = (rule as unknown as Creatable).create(context);
|
|
93
|
+
visitors.ImportDeclaration(importDeclaration(source, names));
|
|
94
|
+
return reports.map((report) => report.data?.name ?? "");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const hatches = [
|
|
98
|
+
"TamaguiText",
|
|
99
|
+
"TamaguiSizableText",
|
|
100
|
+
"TamaguiParagraph",
|
|
101
|
+
"TamaguiHeading",
|
|
102
|
+
"TamaguiH1",
|
|
103
|
+
"TamaguiH6",
|
|
104
|
+
"TamaguiAnchor",
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
it.each(hatches)("reports %s imported from the components barrel", (name) => {
|
|
108
|
+
expect(reportedNames("@multiplatform.one/components", [name])).toEqual([name]);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("stays silent on the house shadows — the bare names ARE the fix", () => {
|
|
112
|
+
expect(
|
|
113
|
+
reportedNames("@multiplatform.one/components", [
|
|
114
|
+
"Text",
|
|
115
|
+
"SizableText",
|
|
116
|
+
"Paragraph",
|
|
117
|
+
"Heading",
|
|
118
|
+
"H1",
|
|
119
|
+
"H6",
|
|
120
|
+
"Anchor",
|
|
121
|
+
]),
|
|
122
|
+
).toEqual([]);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("stays silent on non-typography hatches and on other packages", () => {
|
|
126
|
+
expect(
|
|
127
|
+
reportedNames("@multiplatform.one/components", ["TamaguiButton", "TamaguiSeparator"]),
|
|
128
|
+
).toEqual([]);
|
|
129
|
+
expect(reportedNames("some-other-package", ["TamaguiText"])).toEqual([]);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it("reports every offending specifier in one import, not just the first", () => {
|
|
133
|
+
expect(
|
|
134
|
+
reportedNames("@multiplatform.one/components", ["Text", "TamaguiText", "TamaguiHeading"]),
|
|
135
|
+
).toEqual(["TamaguiText", "TamaguiHeading"]);
|
|
136
|
+
});
|
|
137
|
+
});
|