@bridge-ds/stylelint-plugin 0.2.10 → 0.2.13

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 +15 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -975,7 +975,7 @@ var DEFAULT_GOVERNANCE = {
975
975
  owners: { design: [], tech: [] }
976
976
  };
977
977
  var FLAT_TOKEN_KEYS = ["primitives", "brands", "semantic", "base", "density", "components", "contrastChecks"];
978
- var CANONICAL_TOKEN_KEYS = ["root", "include", "exclude", "tiers", "layers"];
978
+ var CANONICAL_TOKEN_KEYS = ["root", "include", "exclude", "tiers", "layers", "usage"];
979
979
  var FLAT_MODE_KEYS = ["brands", "themes", "densities", "defaults"];
980
980
  var AXIS_OF = { brands: "brand", themes: "theme", densities: "density" };
981
981
  var ConfigError = class extends Error {
@@ -1063,7 +1063,7 @@ function defineConfig(input) {
1063
1063
  const contrastFile = contrastPath ?? [root === "." ? "" : root, paths.contrastChecks].filter(Boolean).join("/");
1064
1064
  return {
1065
1065
  repo: parseRepoInput(input.repo, input.branch),
1066
- tokens: { ...paths, include: input.tokens?.include ?? ["**/*.tokens.json"], exclude: input.tokens?.exclude ?? [], tiers, layers },
1066
+ tokens: { ...paths, include: input.tokens?.include ?? ["**/*.tokens.json"], exclude: input.tokens?.exclude ?? [], tiers, layers, ...t.usage ? { usage: trimSlashes(t.usage) } : {} },
1067
1067
  axes,
1068
1068
  modes,
1069
1069
  contrast: { path: contrastFile, modes: input.contrast?.modes },
@@ -1092,11 +1092,13 @@ function defineConfig(input) {
1092
1092
  minReasonLength: g.override.minReasonLength ?? DEFAULT_OVERRIDE.minReasonLength
1093
1093
  }
1094
1094
  } : {},
1095
- ...g.rights ? { rights: normalizeRights(g.rights) } : {}
1095
+ ...g.rights ? { rights: normalizeRights(g.rights) } : {},
1096
+ ...g.soloOwnerCanApproveBoth === true ? { soloOwnerCanApproveBoth: true } : {}
1096
1097
  },
1097
1098
  products: input.products?.length ? input.products.map((p) => ({ ...p })) : DEFAULT_PRODUCTS.map((p) => ({ ...p })),
1098
1099
  changes: input.changes === "direct" ? "direct" : DEFAULT_CHANGES_MODE,
1099
1100
  ...input.storybook?.url ? { storybook: { url: input.storybook.url.trim().replace(/\/+$/, "") } } : {},
1101
+ ...input.library?.public === true ? { library: { public: true } } : {},
1100
1102
  ...input.audit ? { audit: { ...input.audit } } : {},
1101
1103
  ...input.visualImpact ? { visualImpact: { mode: input.visualImpact.mode === "on-demand" ? "on-demand" : "auto" } } : {},
1102
1104
  ...input.integrations ? { integrations: { ...input.integrations } } : {},
@@ -1141,7 +1143,7 @@ function loadConfig(source) {
1141
1143
  if (!isObj(tokens)) problems.push('"tokens" must be an object');
1142
1144
  else
1143
1145
  for (const [k, v] of Object.entries(tokens)) {
1144
- if (FLAT_TOKEN_KEYS.includes(k) || k === "root") {
1146
+ if (FLAT_TOKEN_KEYS.includes(k) || k === "root" || k === "usage") {
1145
1147
  if (!isStr(v)) problems.push(`"tokens.${k}" must be a non-empty string`);
1146
1148
  } else if (k === "include" || k === "exclude") {
1147
1149
  if (!isStrList(v)) problems.push(`"tokens.${k}" must be a list of globs`);
@@ -1216,6 +1218,7 @@ function loadConfig(source) {
1216
1218
  }
1217
1219
  }
1218
1220
  problems.push(...rightsProblems(gov.rights));
1221
+ if (gov.soloOwnerCanApproveBoth !== void 0 && typeof gov.soloOwnerCanApproveBoth !== "boolean") problems.push('"governance.soloOwnerCanApproveBoth" must be true or false');
1219
1222
  }
1220
1223
  }
1221
1224
  problems.push(...visualImpactProblems(d.visualImpact));
@@ -1226,6 +1229,14 @@ function loadConfig(source) {
1226
1229
  else if (!/^https:\/\/[^\s/]+/.test(sb.url.trim())) problems.push('"storybook.url" must start with https://, for example https://storybook.example.com');
1227
1230
  else for (const k of Object.keys(sb)) if (k !== "url") problems.push(`"storybook.${k}" is not a known key`);
1228
1231
  }
1232
+ const lib = d.library;
1233
+ if (lib !== void 0) {
1234
+ if (!isObj(lib)) problems.push('"library" must be an object, for example { "public": true }');
1235
+ else {
1236
+ if (lib.public !== void 0 && typeof lib.public !== "boolean") problems.push('"library.public" must be true or false');
1237
+ for (const k of Object.keys(lib)) if (k !== "public") problems.push(`"library.${k}" is not a known key`);
1238
+ }
1239
+ }
1229
1240
  problems.push(...productProblems(d.products));
1230
1241
  const audit = d.audit;
1231
1242
  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.10",
3
+ "version": "0.2.13",
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.12.0"
59
+ "@bridge-ds/core": "^0.15.0"
60
60
  }
61
61
  }