@bridge-ds/stylelint-plugin 0.2.6 → 0.2.8

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/dist/index.js +11 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -954,6 +954,8 @@ function productProblems(raw) {
954
954
 
955
955
  // ../core/src/config.ts
956
956
  var CONFIG_FILE = "bridge.config.json";
957
+ var CHANGES_MODES = ["suggest", "direct"];
958
+ var DEFAULT_CHANGES_MODE = "suggest";
957
959
  var DEFAULT_OVERRIDE = { allowed: [], requireReason: true, minReasonLength: 20 };
958
960
  var DEFAULT_TOKEN_PATHS = {
959
961
  root: "tokens",
@@ -1093,6 +1095,8 @@ function defineConfig(input) {
1093
1095
  ...g.rights ? { rights: normalizeRights(g.rights) } : {}
1094
1096
  },
1095
1097
  products: input.products?.length ? input.products.map((p) => ({ ...p })) : DEFAULT_PRODUCTS.map((p) => ({ ...p })),
1098
+ changes: input.changes === "direct" ? "direct" : DEFAULT_CHANGES_MODE,
1099
+ ...input.storybook?.url ? { storybook: { url: input.storybook.url.trim().replace(/\/+$/, "") } } : {},
1096
1100
  ...input.audit ? { audit: { ...input.audit } } : {},
1097
1101
  ...input.visualImpact ? { visualImpact: { mode: input.visualImpact.mode === "on-demand" ? "on-demand" : "auto" } } : {},
1098
1102
  ...input.integrations ? { integrations: { ...input.integrations } } : {},
@@ -1215,6 +1219,13 @@ function loadConfig(source) {
1215
1219
  }
1216
1220
  }
1217
1221
  problems.push(...visualImpactProblems(d.visualImpact));
1222
+ if (d.changes !== void 0 && !CHANGES_MODES.includes(d.changes)) problems.push(`"changes" must be "suggest" or "direct" (got ${JSON.stringify(d.changes)})`);
1223
+ const sb = d.storybook;
1224
+ if (sb !== void 0) {
1225
+ if (!isObj(sb) || !isStr(sb.url)) problems.push('"storybook" must be { "url" } with the deployed Storybook address');
1226
+ else if (!/^https:\/\/[^\s/]+/.test(sb.url.trim())) problems.push('"storybook.url" must start with https://, for example https://storybook.example.com');
1227
+ else for (const k of Object.keys(sb)) if (k !== "url") problems.push(`"storybook.${k}" is not a known key`);
1228
+ }
1218
1229
  problems.push(...productProblems(d.products));
1219
1230
  const audit = d.audit;
1220
1231
  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.6",
3
+ "version": "0.2.8",
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.8.0"
59
+ "@bridge-ds/core": "^0.10.0"
60
60
  }
61
61
  }