@bridge-ds/stylelint-plugin 0.2.11 → 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.
- package/dist/index.js +12 -3
- 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 },
|
|
@@ -1098,6 +1098,7 @@ function defineConfig(input) {
|
|
|
1098
1098
|
products: input.products?.length ? input.products.map((p) => ({ ...p })) : DEFAULT_PRODUCTS.map((p) => ({ ...p })),
|
|
1099
1099
|
changes: input.changes === "direct" ? "direct" : DEFAULT_CHANGES_MODE,
|
|
1100
1100
|
...input.storybook?.url ? { storybook: { url: input.storybook.url.trim().replace(/\/+$/, "") } } : {},
|
|
1101
|
+
...input.library?.public === true ? { library: { public: true } } : {},
|
|
1101
1102
|
...input.audit ? { audit: { ...input.audit } } : {},
|
|
1102
1103
|
...input.visualImpact ? { visualImpact: { mode: input.visualImpact.mode === "on-demand" ? "on-demand" : "auto" } } : {},
|
|
1103
1104
|
...input.integrations ? { integrations: { ...input.integrations } } : {},
|
|
@@ -1142,7 +1143,7 @@ function loadConfig(source) {
|
|
|
1142
1143
|
if (!isObj(tokens)) problems.push('"tokens" must be an object');
|
|
1143
1144
|
else
|
|
1144
1145
|
for (const [k, v] of Object.entries(tokens)) {
|
|
1145
|
-
if (FLAT_TOKEN_KEYS.includes(k) || k === "root") {
|
|
1146
|
+
if (FLAT_TOKEN_KEYS.includes(k) || k === "root" || k === "usage") {
|
|
1146
1147
|
if (!isStr(v)) problems.push(`"tokens.${k}" must be a non-empty string`);
|
|
1147
1148
|
} else if (k === "include" || k === "exclude") {
|
|
1148
1149
|
if (!isStrList(v)) problems.push(`"tokens.${k}" must be a list of globs`);
|
|
@@ -1228,6 +1229,14 @@ function loadConfig(source) {
|
|
|
1228
1229
|
else if (!/^https:\/\/[^\s/]+/.test(sb.url.trim())) problems.push('"storybook.url" must start with https://, for example https://storybook.example.com');
|
|
1229
1230
|
else for (const k of Object.keys(sb)) if (k !== "url") problems.push(`"storybook.${k}" is not a known key`);
|
|
1230
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
|
+
}
|
|
1231
1240
|
problems.push(...productProblems(d.products));
|
|
1232
1241
|
const audit = d.audit;
|
|
1233
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.
|
|
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.
|
|
59
|
+
"@bridge-ds/core": "^0.15.0"
|
|
60
60
|
}
|
|
61
61
|
}
|