npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

stylelint-plugin-rhythmguard

v3.8.0

Published

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.

Readme

stylelint-plugin-rhythmguard

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.

CI npm version npm downloads License: MIT

Rhythmguard is scale-aware rather than a blanket ban: values on your scale pass, values off it are reported with the two nearest steps, and tokens are only ever suggested from a map you control. It works on CSS and SCSS declarations through Stylelint and on Tailwind class strings through an ESLint companion, and it ships an audit CLI so you can measure drift and ratchet it down before enforcing anything.

What it is not: it does not check colors or hex values, and the Stylelint rules do not see Tailwind class strings (that is the separate ESLint companion below). Pair it with a color linter if you need one; do not expect one tool to do both.

Start here

npx stylelint-plugin-rhythmguard

No install, no config. It detects your stack and token files, infers your spacing scale from your own tokens, audits the current directory, and prints the exact .stylelintrc.json (and ESLint snippet for Tailwind) to paste. This is the whole run on Bootstrap's v6-dev branch, unedited:

Then:

npm install --save-dev stylelint stylelint-plugin-rhythmguard
{
  "extends": ["stylelint-plugin-rhythmguard/configs/recommended"]
}

That enables rhythmguard/use-scale on spacing properties with the default 4px scale. Tailwind projects use the tailwind config instead, which also extracts spacing tokens from @theme:

{
  "extends": ["stylelint-plugin-rhythmguard/configs/tailwind"]
}

For class strings in JSX, TSX, Vue, Svelte or Astro, add the ESLint companion. It is the same rules under two names: stylelint-plugin-rhythmguard/eslint if you already have this package, or eslint-plugin-rhythmguard on its own.

// eslint.config.js
import rhythmguard from 'stylelint-plugin-rhythmguard/eslint';

export default [
  {
    plugins: { 'rhythmguard-tailwind': rhythmguard },
    rules: { 'rhythmguard-tailwind/tailwind-class-use-scale': ['error', { scale: [0, 4, 8, 12, 16, 24, 32] }] },
  },
];

Rules

| Rule | What it reports | Fix | | --- | --- | --- | | rhythmguard/use-scale | Length values off the configured scale | Nearest scale value | | rhythmguard/prefer-token | Raw literals where a design token exists | Token from your map | | rhythmguard/no-offscale-transform | Off-scale translate* offsets | Nearest scale value | | rhythmguard/use-motion-scale | Off-scale durations and raw easing curves. Opt-in, experimental | Nearest duration | | rhythmguard-tailwind/tailwind-class-use-scale | Off-scale Tailwind arbitrary spacing values (p-[13px]) in class strings | Nearest scale value | | rhythmguard-tailwind/tailwind-class-use-motion-scale | Off-scale duration-[...], delay-[...], raw ease-[...]. Opt-in | Nearest duration |

Every rule validates its options up front. Unknown option names and wrong shapes are reported, never ignored.

Configs

recommended, strict, tailwind, motion (experimental), and embed for authors of shared configs (see docs/FOR_CONFIG_AUTHORS.md). All are stylelint-plugin-rhythmguard/configs/<name>. What each enables, the full custom setup, and the scale-selection precedence are in docs/CONFIGS.md. Built-in and community scale presets are in docs/SCALE_PRESETS.md.

Audit before you enforce

npx rhythmguard audit ./src --format markdown
npx rhythmguard audit ./src --write-baseline
npx rhythmguard audit ./src --since-baseline --fail-on-new-drift
npx rhythmguard audit ./src --format github

The audit scans CSS declarations, Tailwind class strings and your token contract, prints a scale-cleanliness score, and supports baselines so legacy codebases can gate only new drift. Formats: text, Markdown, JSON 2.0, HTML, GitHub Actions annotations, and a shields.io badge document for your README. Full reference in docs/AUDIT.md, rollout recipe and the badge workflow in docs/CI_ADOPTION.md. In GitHub Actions, PetriLahdelma/rhythmguard-action@v1 runs the audit, annotates the diff, comments on the pull request and fails on new drift in one step.

npx rhythmguard audit ./src --plan turns the report into a proposed decisions section (adopt a value, allow it, or snap it), and npx rhythmguard fix ./src --value 10px --to "var(--space-sm)" --write executes one decision as one reviewable change; see decisions. npx rhythmguard init writes a starter config for your stack, and init --agents all installs the coding-agent instructions. npx rhythmguard doctor checks the setup.

Guides

Compatibility

Stylelint 16 and 17. Node 20.19 or newer. Three runtime dependencies (known-css-properties, postcss, postcss-value-parser); 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. Upgrading from 2.x: docs/MIGRATING_TO_3.md.

Contributing and support

Development setup, semver policy, benchmarking and the release process are in CONTRIBUTING.md. Bugs and feature requests: GitHub issues. Security: see SECURITY.md.

License

MIT. See LICENSE.