stylelint-plugin-rhythmguard 3.16.0 → 3.17.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
@@ -6,6 +6,26 @@ The format follows Keep a Changelog principles and semantic versioning.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [3.17.0] - 2026-11-04
10
+
11
+ ### Added
12
+
13
+ - `scale: "auto"` reads WordPress's spacing scale when `@wordpress/base-styles` or `@wordpress/theme` is installed: the Sass `$grid-unit-05` to `$grid-unit-80` (4 to 64px) from `_variables.scss`, and `--wpds-dimension-gap-*` and `--wpds-dimension-padding-*` (4 to 40px) from `prebuilt/css/design-tokens.css`. The `--wpds-dimension-size-*` and `surface-*` tokens are sizes, not spacing, and are left out. Gutenberg's benchmark row is measured against both packages, as a Gutenberg maintainer pointed out in WordPress/gutenberg#82502: 34 off-scale values on `packages/components/src`, against 35 on the fallback, because 20px is a WordPress padding step.
14
+
15
+ ### Changed
16
+
17
+ - `npm run test:pack-smoke`, which CI and the release run before publishing, now packs `rhythmguard` and `eslint-plugin-rhythmguard` as well as the plugin, and runs on each tarball the same check the post-publish smoke runs from npm (`scripts/ci/smoke-checks.mjs`). Before this it packed only the plugin, so the 3.16.0 CLI failure could reach npm; with the CLI's `stylelint` dependency removed, the pack smoke now fails at `rhythmguard audit`.
18
+
19
+ ## [3.16.1] - 2026-11-01
20
+
21
+ ### Fixed
22
+
23
+ - `npx rhythmguard` and `rhythmguard audit` work again in a project without Stylelint. 3.16.0 made `stylelint` an optional peer, so npm stopped installing it next to the CLI, and the audit, which runs the rules through Stylelint's API to read stylesheets, failed with `Cannot find package 'stylelint'`. The 3.16.0 entry was wrong to say `rhythmguard audit` never loaded Stylelint: it loads it with a dynamic `import()`, which the contract test did not see. The `rhythmguard` package now depends on `stylelint`, so `npx rhythmguard` brings it. The plugin's own `rhythmguard` command, which an ESLint-only project also gets, now says to run `npm install --save-dev stylelint` instead of printing a module path. The contract test now reads dynamic imports.
24
+
25
+ ### Changed
26
+
27
+ - The post-publish smoke test installs all three packages from npm, each in a clean project with only what its README asks for: `rhythmguard` alone, audited on a CSS file and a JSX file, and `eslint-plugin-rhythmguard` with ESLint and no Stylelint. Before this it covered only `stylelint-plugin-rhythmguard`, and 3.16.0 passed it with the CLI broken.
28
+
9
29
  ## [3.16.0] - 2026-11-01
10
30
 
11
31
  ### Changed
package/CONTRIBUTING.md CHANGED
@@ -66,7 +66,7 @@ Optional, depending on what you touched:
66
66
 
67
67
  ```bash
68
68
  npm run test:compat-floor # Stylelint 16.0.0, the oldest supported
69
- npm run test:pack-smoke # pack the tarball and install it in a temp project
69
+ npm run test:pack-smoke # pack all three packages and smoke-test each in a temp project
70
70
  npm run scales:validate # community scale JSON
71
71
  npm run bench:quiet -- --check # findings on the benchmark repos must match snapshots
72
72
  npm run build:agents # after editing the block in docs/FOR_AGENTS.md
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026
3
+ Copyright (c) 2026 Petri Lahdelma
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  Nobody chose 13px. Rhythmguard catches off-scale spacing in CSS and Tailwind class strings, tells you the nearest steps on your scale, and snaps to them or to your tokens when you ask.
8
8
 
9
9
  [![CI](https://img.shields.io/github/actions/workflow/status/petrilahdelma/stylelint-plugin-rhythmguard/ci.yml?branch=main&label=ci)](https://github.com/petrilahdelma/stylelint-plugin-rhythmguard/actions/workflows/ci.yml)
10
- [![npm version](https://img.shields.io/npm/v/stylelint-plugin-rhythmguard?label=npm&color=1f6feb&r=3160)](https://www.npmjs.com/package/stylelint-plugin-rhythmguard)
10
+ [![npm version](https://img.shields.io/npm/v/stylelint-plugin-rhythmguard?label=npm&color=1f6feb&r=3170)](https://www.npmjs.com/package/stylelint-plugin-rhythmguard)
11
11
  [![npm downloads](https://img.shields.io/npm/dm/stylelint-plugin-rhythmguard.svg)](https://www.npmjs.com/package/stylelint-plugin-rhythmguard)
12
12
  [![License: MIT](https://img.shields.io/badge/license-MIT-white.svg)](./LICENSE)
13
13
 
@@ -144,7 +144,7 @@ The two do not overlap. Rhythmguard reports the `13px` padding and the `17px` he
144
144
 
145
145
  ## Compatibility
146
146
 
147
- Stylelint 16 and 17. Node 20.19 or newer; Node 20 itself is end of life, and 4.0 raises the floor to 22.22 ([#172](https://github.com/PetriLahdelma/stylelint-plugin-rhythmguard/issues/172)). The ESLint companion needs ESLint 8 or newer, is tested on ESLint 9 and 10, and is tested in CI on Oxlint 1.88.0. Three runtime dependencies (`known-css-properties`, `postcss`, `postcss-value-parser`); `stylelint` is a peer you need only for the Stylelint rules, so an ESLint-only project and `npx rhythmguard` install without it; `postcss-scss`, `stylelint-config-tailwindcss` and `stylelint-plugin-logical-css` are optional peers. CommonJS and ESM entry points, TypeScript declarations for every export. The CI matrix runs Node 20 and 22 against Stylelint 16.0.0, 16.x and 17.x, and Node 24 and 26 against 17.x; a weekly job runs the suite against Stylelint `next` (18.0.0-next.0 passes). Upgrading from 2.x: [docs/MIGRATING_TO_3.md](docs/MIGRATING_TO_3.md).
147
+ Stylelint 16 and 17. Node 20.19 or newer; Node 20 itself is end of life, and 4.0 raises the floor to 22.22 ([#172](https://github.com/PetriLahdelma/stylelint-plugin-rhythmguard/issues/172)). The ESLint companion needs ESLint 8 or newer, is tested on ESLint 9 and 10, and is tested in CI on Oxlint 1.88.0. Three runtime dependencies (`known-css-properties`, `postcss`, `postcss-value-parser`); `stylelint` is a peer you need only for the Stylelint rules and the stylesheet audit, so an ESLint-only project installs without it, and `npx rhythmguard` brings its own; `postcss-scss`, `stylelint-config-tailwindcss` and `stylelint-plugin-logical-css` are optional peers. CommonJS and ESM entry points, TypeScript declarations for every export. The CI matrix runs Node 20 and 22 against Stylelint 16.0.0, 16.x and 17.x, and Node 24 and 26 against 17.x; a weekly job runs the suite against Stylelint `next` (18.0.0-next.0 passes). Upgrading from 2.x: [docs/MIGRATING_TO_3.md](docs/MIGRATING_TO_3.md).
148
148
 
149
149
  ## Contributing and support
150
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-plugin-rhythmguard",
3
- "version": "3.16.0",
3
+ "version": "3.17.0",
4
4
  "description": "Nobody chose 13px. Catches off-scale spacing in CSS and Tailwind class strings and snaps it to your scale or tokens. Stylelint rules, an ESLint companion, and an audit CLI.",
5
5
  "bin": {
6
6
  "rhythmguard": "src/cli/index.js"
@@ -184,7 +184,7 @@
184
184
  "postcss-value-parser": "^4.2.0"
185
185
  },
186
186
  "devDependencies": {
187
- "@anthropic-ai/sdk": "^0.137.0",
187
+ "@anthropic-ai/sdk": "^1.0.0",
188
188
  "@eslint/js": "^10.0.0",
189
189
  "@types/node": "^22.20.1",
190
190
  "c8": "^12.0.0",
@@ -203,5 +203,8 @@
203
203
  "publishConfig": {
204
204
  "access": "public"
205
205
  },
206
- "license": "MIT"
206
+ "license": "MIT",
207
+ "overrides": {
208
+ "minimatch": "^11.0.3"
209
+ }
207
210
  }
@@ -32,6 +32,26 @@ function resolveScssSyntax() {
32
32
  return scssSyntaxCache;
33
33
  }
34
34
 
35
+ /**
36
+ * Stylelint is an optional peer, so an ESLint-only project can reach this
37
+ * without it. The `rhythmguard` package depends on it; this package's own
38
+ * command says what to install instead of failing on a module path.
39
+ */
40
+ async function loadStylelint() {
41
+ try {
42
+ return (await import('stylelint')).default;
43
+ } catch (error) {
44
+ if (error && error.code === 'ERR_MODULE_NOT_FOUND' && /'stylelint'/.test(error.message)) {
45
+ throw new Error(
46
+ 'Auditing stylesheets needs Stylelint, which this project does not have. '
47
+ + 'Install it with: npm install --save-dev stylelint',
48
+ { cause: error },
49
+ );
50
+ }
51
+ throw error;
52
+ }
53
+ }
54
+
35
55
  async function runStylelintAudit(cssFiles, options) {
36
56
  if (cssFiles.length === 0) {
37
57
  const empty = [];
@@ -42,7 +62,7 @@ async function runStylelintAudit(cssFiles, options) {
42
62
  return empty;
43
63
  }
44
64
 
45
- const { default: stylelint } = await import('stylelint');
65
+ const stylelint = await loadStylelint();
46
66
  const rules = {
47
67
  'rhythmguard/use-scale': [
48
68
  true,
@@ -93,6 +93,22 @@
93
93
  "dist/units/units.custom-properties.css"
94
94
  ],
95
95
  "note": "--spacing-xs..2xl in px; Protocol's Sass $spacing-* come from the same package"
96
+ },
97
+ {
98
+ "name": "@wordpress/base-styles",
99
+ "files": [
100
+ "_variables.scss"
101
+ ],
102
+ "tokenPattern": "^\\$grid-unit-\\d+$",
103
+ "note": "WordPress names its spacing scale $grid-unit-05..80 (4 to 64px, multiples of $grid-unit)"
104
+ },
105
+ {
106
+ "name": "@wordpress/theme",
107
+ "files": [
108
+ "prebuilt/css/design-tokens.css"
109
+ ],
110
+ "tokenPattern": "^--wpds-dimension-(?:gap|padding)-",
111
+ "note": "--wpds-dimension-gap-* and --wpds-dimension-padding-* in px; size and surface tokens are not spacing"
96
112
  }
97
113
  ]
98
114
  }