stylelint-plugin-rhythmguard 3.16.0 → 3.16.1
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 +10 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/package.json +6 -3
- package/src/audit/scan/stylesheets.js +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ The format follows Keep a Changelog principles and semantic versioning.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [3.16.1] - 2026-11-01
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `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.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- 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.
|
|
18
|
+
|
|
9
19
|
## [3.16.0] - 2026-11-01
|
|
10
20
|
|
|
11
21
|
### Changed
|
package/LICENSE
CHANGED
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
|
[](https://github.com/petrilahdelma/stylelint-plugin-rhythmguard/actions/workflows/ci.yml)
|
|
10
|
-
[](https://www.npmjs.com/package/stylelint-plugin-rhythmguard)
|
|
11
11
|
[](https://www.npmjs.com/package/stylelint-plugin-rhythmguard)
|
|
12
12
|
[](./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`
|
|
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.
|
|
3
|
+
"version": "3.16.1",
|
|
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.
|
|
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
|
|
65
|
+
const stylelint = await loadStylelint();
|
|
46
66
|
const rules = {
|
|
47
67
|
'rhythmguard/use-scale': [
|
|
48
68
|
true,
|