@yahoo/uds-create-config 5.108.0 → 5.108.2
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/dist/entities/system/Component.js +2 -0
- package/dist/entities/system/native-reserved-prop-invariants.d.ts +3 -0
- package/dist/entities/system/native-reserved-prop-invariants.js +19 -0
- package/dist/lint/context.js +11 -8
- package/dist/lint/rules.d.ts +10 -0
- package/dist/lint/rules.js +18 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -32,6 +32,7 @@ import { assertComponentSourceInput } from "./component-source-fields.js";
|
|
|
32
32
|
import { checkStyleSet, styleSetEdits } from "./component-style-set.js";
|
|
33
33
|
import { forwardRouteInvariants, refusedRoutes } from "./forward-route-invariants.js";
|
|
34
34
|
import { iconDomainInvariants } from "./icon-domain-invariants.js";
|
|
35
|
+
import { nativeReservedPropInvariants } from "./native-reserved-prop-invariants.js";
|
|
35
36
|
import { storedDefaults } from "./prop-rules.js";
|
|
36
37
|
import { rootLayerInvariants } from "./root-layer-invariants.js";
|
|
37
38
|
import { Token } from "./Token.js";
|
|
@@ -3078,6 +3079,7 @@ element: refSchema })
|
|
|
3078
3079
|
invariants: (config) => [
|
|
3079
3080
|
...iconDomainInvariants(config),
|
|
3080
3081
|
...rootLayerInvariants(config),
|
|
3082
|
+
...nativeReservedPropInvariants(config),
|
|
3081
3083
|
...forwardRouteInvariants(config)
|
|
3082
3084
|
]
|
|
3083
3085
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "../../configs/platform.js";
|
|
2
|
+
import { createSliceMemo } from "../../framework/memo.js";
|
|
3
|
+
import { resolveComponentProps } from "../../framework/projections.js";
|
|
4
|
+
import { intoName } from "../../framework/prop-surface.js";
|
|
5
|
+
//#region src/entities/system/native-reserved-prop-invariants.ts
|
|
6
|
+
/** The native runtime consumes call-site `style` as the root layer's explicit style. */
|
|
7
|
+
const nativeReservedPropInvariants = createSliceMemo({
|
|
8
|
+
kinds: ["component"],
|
|
9
|
+
compute: (config) => {
|
|
10
|
+
if (config.name !== "react-native-system") return [];
|
|
11
|
+
return config.list("component").flatMap(({ path }) => {
|
|
12
|
+
const style = resolveComponentProps(config, path).style;
|
|
13
|
+
if (!style || style.type === "forward" && intoName(style.into) === "style") return [];
|
|
14
|
+
return [`Component "${path}": \`style\` is reserved: the native runtime forwards it as the root layer's React Native style. Rename this prop to \`variant\` or another name.`];
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { nativeReservedPropInvariants };
|
package/dist/lint/context.js
CHANGED
|
@@ -63,14 +63,17 @@ function styleSites(styles) {
|
|
|
63
63
|
if (!node || typeof node !== "object" || Array.isArray(node)) return;
|
|
64
64
|
for (const [key, value] of Object.entries(node)) if (key.startsWith("_") || BREAKPOINTS.has(key)) walk(value, [...modifiers, key], prop);
|
|
65
65
|
else if (prop === void 0) walk(value, modifiers, key);
|
|
66
|
-
else
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
else {
|
|
67
|
+
out.push({
|
|
68
|
+
when,
|
|
69
|
+
whenValue,
|
|
70
|
+
layer,
|
|
71
|
+
prop,
|
|
72
|
+
modifiers,
|
|
73
|
+
value: node
|
|
74
|
+
});
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
74
77
|
};
|
|
75
78
|
walk(bag, []);
|
|
76
79
|
}
|
package/dist/lint/rules.d.ts
CHANGED
|
@@ -31,6 +31,16 @@ declare const AUTHORING_LINT_GROUPS: {
|
|
|
31
31
|
};
|
|
32
32
|
type AuthoringLintGroup = keyof typeof AUTHORING_LINT_GROUPS;
|
|
33
33
|
declare const AUTHORING_LINT_RULES: {
|
|
34
|
+
readonly 'invalid-style-value': {
|
|
35
|
+
readonly reads: "config";
|
|
36
|
+
readonly group: "maintainability";
|
|
37
|
+
readonly label: "Value outside its declared choices";
|
|
38
|
+
readonly detects: "A component style rule uses a value its property does not offer, so the component can render differently than intended.";
|
|
39
|
+
readonly fix: "use a declared value or add the intended value to the property first";
|
|
40
|
+
readonly check: {
|
|
41
|
+
readonly value: (ctx: ConfigLintContext, value: LintValue, report: ConfigLintReport) => void;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
34
44
|
readonly 'unmapped-native-style-key': {
|
|
35
45
|
readonly reads: "config";
|
|
36
46
|
readonly group: "maintainability";
|
package/dist/lint/rules.js
CHANGED
|
@@ -46,6 +46,24 @@ const AUTHORING_LINT_GROUPS = {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
const AUTHORING_LINT_RULES = {
|
|
49
|
+
"invalid-style-value": {
|
|
50
|
+
reads: "config",
|
|
51
|
+
group: "maintainability",
|
|
52
|
+
label: "Value outside its declared choices",
|
|
53
|
+
detects: "A component style rule uses a value its property does not offer, so the component can render differently than intended.",
|
|
54
|
+
fix: "use a declared value or add the intended value to the property first",
|
|
55
|
+
check: { value(ctx, value, report) {
|
|
56
|
+
const { layer, prop } = value.site;
|
|
57
|
+
if (!ctx.config.resolve("style-property", prop)) return;
|
|
58
|
+
for (const message of ctx.config.validateData("component", value.component.path, "sub-create/styles", {
|
|
59
|
+
when: null,
|
|
60
|
+
layers: { [layer]: { [prop]: value.site.value } }
|
|
61
|
+
})) report({
|
|
62
|
+
at: value,
|
|
63
|
+
message
|
|
64
|
+
});
|
|
65
|
+
} }
|
|
66
|
+
},
|
|
49
67
|
"unmapped-native-style-key": {
|
|
50
68
|
reads: "config",
|
|
51
69
|
group: "maintainability",
|