@bridge-ds/stylelint-plugin 0.2.15 → 0.2.17
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/index.js +17 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -957,6 +957,12 @@ var CONFIG_FILE = "bridge.config.json";
|
|
|
957
957
|
var CHANGES_MODES = ["suggest", "direct"];
|
|
958
958
|
var DEFAULT_CHANGES_MODE = "suggest";
|
|
959
959
|
var DEFAULT_OVERRIDE = { allowed: [], requireReason: true, minReasonLength: 20 };
|
|
960
|
+
var TEAM_NAME_MAX = 60;
|
|
961
|
+
function teamName(value) {
|
|
962
|
+
if (typeof value !== "string") return void 0;
|
|
963
|
+
const v = value.trim().replace(/\s+/g, " ");
|
|
964
|
+
return v && v.length <= TEAM_NAME_MAX ? v : void 0;
|
|
965
|
+
}
|
|
960
966
|
var DEFAULT_TOKEN_PATHS = {
|
|
961
967
|
root: "tokens",
|
|
962
968
|
primitives: "primitives",
|
|
@@ -1062,6 +1068,7 @@ function defineConfig(input) {
|
|
|
1062
1068
|
const g = input.governance ?? {};
|
|
1063
1069
|
const contrastFile = contrastPath ?? [root === "." ? "" : root, paths.contrastChecks].filter(Boolean).join("/");
|
|
1064
1070
|
return {
|
|
1071
|
+
...teamName(input.name) ? { name: teamName(input.name) } : {},
|
|
1065
1072
|
repo: parseRepoInput(input.repo, input.branch),
|
|
1066
1073
|
tokens: { ...paths, include: input.tokens?.include ?? ["**/*.tokens.json"], exclude: input.tokens?.exclude ?? [], tiers, layers, ...t.usage ? { usage: trimSlashes(t.usage) } : {} },
|
|
1067
1074
|
axes,
|
|
@@ -1100,6 +1107,7 @@ function defineConfig(input) {
|
|
|
1100
1107
|
changes: input.changes === "direct" ? "direct" : DEFAULT_CHANGES_MODE,
|
|
1101
1108
|
...input.storybook?.url ? { storybook: { url: input.storybook.url.trim().replace(/\/+$/, "") } } : {},
|
|
1102
1109
|
...input.library?.public === true ? { library: { public: true } } : {},
|
|
1110
|
+
...input.demo?.viewer?.trim() ? { demo: { viewer: input.demo.viewer.trim(), ...input.demo.role?.trim() ? { role: input.demo.role.trim() } : {} } } : {},
|
|
1103
1111
|
...input.audit ? { audit: { ...input.audit } } : {},
|
|
1104
1112
|
...input.visualImpact ? { visualImpact: { mode: input.visualImpact.mode === "on-demand" ? "on-demand" : "auto" } } : {},
|
|
1105
1113
|
...input.integrations ? { integrations: { ...input.integrations } } : {},
|
|
@@ -1224,6 +1232,7 @@ function loadConfig(source) {
|
|
|
1224
1232
|
}
|
|
1225
1233
|
}
|
|
1226
1234
|
problems.push(...visualImpactProblems(d.visualImpact));
|
|
1235
|
+
if (d.name !== void 0 && teamName(d.name) === void 0) problems.push(`"name" must be the team's name, 1 to ${TEAM_NAME_MAX} characters`);
|
|
1227
1236
|
if (d.changes !== void 0 && !CHANGES_MODES.includes(d.changes)) problems.push(`"changes" must be "suggest" or "direct" (got ${JSON.stringify(d.changes)})`);
|
|
1228
1237
|
const sb = d.storybook;
|
|
1229
1238
|
if (sb !== void 0) {
|
|
@@ -1239,6 +1248,14 @@ function loadConfig(source) {
|
|
|
1239
1248
|
for (const k of Object.keys(lib)) if (k !== "public") problems.push(`"library.${k}" is not a known key`);
|
|
1240
1249
|
}
|
|
1241
1250
|
}
|
|
1251
|
+
const demo = d.demo;
|
|
1252
|
+
if (demo !== void 0) {
|
|
1253
|
+
if (!isObj(demo) || !isStr(demo.viewer) || !demo.viewer.trim()) problems.push('"demo" must be { "viewer" }, for example { "viewer": "Dana", "role": "DS lead" }');
|
|
1254
|
+
else {
|
|
1255
|
+
if (demo.role !== void 0 && !isStr(demo.role)) problems.push('"demo.role" must be a string, for example "DS lead"');
|
|
1256
|
+
for (const k of Object.keys(demo)) if (k !== "viewer" && k !== "role") problems.push(`"demo.${k}" is not a known key`);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1242
1259
|
problems.push(...productProblems(d.products));
|
|
1243
1260
|
const audit = d.audit;
|
|
1244
1261
|
if (audit !== void 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridge-ds/stylelint-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Stylelint rule bridge/use-tokens: no raw colors, lengths, radii, shadows, durations or z-index in product CSS where a design token exists. Autofixes exact matches. Reads the tokens through @bridge-ds/core and bridge.config.json.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
"stylelint": "16.26.1"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@bridge-ds/core": "^0.
|
|
59
|
+
"@bridge-ds/core": "^0.19.0"
|
|
60
60
|
}
|
|
61
61
|
}
|