@geonosis/oxlint-plugin-biological-architecture 2.8.0 → 2.9.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @geonosis/oxlint-plugin-biological-architecture
2
2
 
3
+ ## 2.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e35392e: `tokens-only-colors` sees a colour that arrives as a default.
8
+
9
+ `({ color = '#090909' })` is never written in a JSX attribute, so the rule's only visitor could not
10
+ see it: one kit carried the same hex in 72 components, under this rule, at `"error"`, for its whole
11
+ life. A bare word is still left alone — a default is as often `variant = 'primary'` as a colour.
12
+
3
13
  ## 2.8.0
4
14
 
5
15
  ### Minor Changes
@@ -0,0 +1,11 @@
1
+ export const DefaultedIcon = ({
2
+ color = '#090909',
3
+ size = 24
4
+ }: {
5
+ color?: string
6
+ size?: number
7
+ }) => (
8
+ <svg width={size} height={size} viewBox="0 0 24 24">
9
+ <path d="M4 4h16v16H4z" fill={color} />
10
+ </svg>
11
+ )
package/dist/index.js CHANGED
@@ -6866,6 +6866,10 @@ var COLOR_UTILITIES = /* @__PURE__ */ new Set([
6866
6866
  var isColorUtility = (utility) => COLOR_UTILITIES.has(utility.replace(/^.*:/, ""));
6867
6867
 
6868
6868
  // src/rules/tokens-only-colors.ts
6869
+ var defaultedName = (node) => {
6870
+ const left = node.left;
6871
+ return left?.type === "Identifier" ? left.name ?? "default" : "default";
6872
+ };
6869
6873
  var tokenOffence = (value, prefixes, local) => {
6870
6874
  const variable = variableOf(value);
6871
6875
  if (variable !== void 0) {
@@ -6906,6 +6910,28 @@ var tokensOnlyColors = {
6906
6910
  report("colorLiteral", { property: utility, value: inner });
6907
6911
  }
6908
6912
  }
6913
+ },
6914
+ /**
6915
+ * A colour that arrives as a DEFAULT — `({ color = '#090909' })` — is never written in a JSX
6916
+ * attribute, so the visitor above cannot see it. It reaches the element through a prop and
6917
+ * paints in the brand it was typed for, from the one place nobody looked: seventy-two icons
6918
+ * in one kit carried the same hex this way, under this rule, at "error", for its whole life.
6919
+ * A default is a value the component CHOOSES, which is exactly what a token is for.
6920
+ *
6921
+ * A bare word is left alone. `variant = 'primary'` and `size = 'small'` are defaults too, and
6922
+ * a rule that read every English word as a colour would be turned off within the week.
6923
+ */
6924
+ AssignmentPattern(node) {
6925
+ const right = node.right;
6926
+ if (right?.type !== "Literal" || typeof right.value !== "string") return;
6927
+ const offence = tokenOffence(right.value, prefixes, /* @__PURE__ */ new Set());
6928
+ if (offence === void 0 || offence === "colorLiteral" && isNamedOnly(right.value))
6929
+ return;
6930
+ context.report({
6931
+ data: { property: defaultedName(node), value: right.value },
6932
+ messageId: offence,
6933
+ node
6934
+ });
6909
6935
  }
6910
6936
  };
6911
6937
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geonosis/oxlint-plugin-biological-architecture",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "description": "Biological tier architecture as lint — the union of the dielime and during.day rule sets, shipped as presets.",
6
6
  "keywords": [
@@ -45,7 +45,7 @@
45
45
  "oxlint": ">=1.77"
46
46
  },
47
47
  "devDependencies": {
48
- "@geonosis/lint-parity": "2.8.0"
48
+ "@geonosis/lint-parity": "2.9.0"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=22"