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

statelint

v0.1.0

Published

Static analysis CLI to audit interactive state coverage in CSS and Tailwind codebases

Readme

statelint

CI codecov npm version

Static analysis CLI that audits interactive state coverage in frontend codebases. Detects missing :hover, :focus, :disabled, and other states on buttons, links, and form controls.

Why?

Designers define multiple interactive states for UI components. Developers often miss some during implementation:

  • Accessibility issues — Missing :focus makes sites unusable for keyboard users
  • Incomplete UX — No :disabled styling confuses users
  • Late QA catches — Issues found late require rework

statelint catches these gaps automatically.

Requirements

  • Node.js 20 or later

Installation

# Using bun
bun add -d statelint

# Using npm
npm install --save-dev statelint

Usage

# Analyze src directory
npx statelint ./src

# With coverage threshold (fails if below)
npx statelint ./src --min-coverage 80

# Specific file patterns
npx statelint "src/components/**/*.tsx"

# Output as JSON
npx statelint ./src --output json

Example Output

statelint - State Coverage Report
──────────────────────────────────────────────────

Files: 12  Elements: 24
Unresolved: 2 elements with dynamic classNames (excluded from coverage)

Missing states:
  src/components/Button.tsx
    line 15: <button> missing: focus, disabled
  src/components/Link.tsx
    line 8: <a> missing: focus

──────────────────────────────────────────────────
Coverage: 85% (41/48)

PASS: Coverage meets threshold (80%)

Supported Files

| Format | States Detected | |--------|-----------------| | CSS | :hover, :focus, :disabled, etc. | | JSX/TSX | Tailwind variants: hover:, focus:, etc. | | Vue SFC | Both <style> and <template> | | Svelte | Both <style> and markup |

Configuration

Create statelint.config.json in your project root:

{
  "include": ["src/**/*.{css,tsx,jsx,vue,svelte}"],
  "exclude": ["**/*.test.*", "**/node_modules/**"],
  "minCoverage": 80,
  "output": "terminal",
  "requiredStates": {
    "button": ["hover", "focus", "disabled"],
    "a": ["hover", "focus"],
    "input": ["focus", "disabled"]
  }
}

Config Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | include | string[] | ["**/*.{css,tsx,jsx,vue,svelte}"] | File patterns to analyze | | exclude | string[] | ["**/node_modules/**", "**/*.test.*"] | Patterns to ignore | | minCoverage | number | 0 | Minimum coverage percentage (0-100) | | output | string | "terminal" | Output format: terminal, json, markdown, sarif | | requiredStates | object | See defaults | Override required states per element type | | strict | boolean | false | Fail on parse errors |

CLI Options

Usage: statelint [options] [glob]

Arguments:
  glob                   Files to analyze (default: "src/**/*.{css,tsx,jsx,vue,svelte}")

Options:
  -V, --version          Output version number
  -c, --config <path>    Path to config file
  --min-coverage <n>     Minimum coverage percentage (0-100)
  -o, --output <format>  Output format: terminal, json, markdown, sarif
  --strict               Fail on parse errors
  -v, --verbose          Show details for unresolved elements
  -h, --help             Display help

CI Integration

# GitHub Actions
- name: Lint interactive states
  run: npx statelint ./src --min-coverage 80
# With SARIF upload for code scanning
- name: Run statelint
  run: npx statelint ./src --output sarif > statelint.sarif

- name: Upload SARIF
  uses: github/codeql-action/upload-sarif@v2
  with:
    sarif_file: statelint.sarif

Default Required States

| Element | Required States | |---------|-----------------| | button | hover, focus, disabled* | | a | hover, focus | | input | focus, disabled* | | select | focus, disabled* | | textarea | focus, disabled* | | role="button" | hover, focus, disabled* | | role="link" | hover, focus |

* Only required when the element has the corresponding attribute

License

MIT