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

@markuplint/create-rule

v4.18.1

Published

Rule generator for markuplint

Downloads

601

Readme

@markuplint/create-rule

npm version

Overview

A CLI scaffolding tool for creating new markuplint rules. It provides both an interactive wizard and a non-interactive CLI mode that generates all the boilerplate files needed for rule development, including source files, tests, and configuration.

Usage

Interactive mode

Run without arguments to start the guided wizard:

$ npx @markuplint/create-rule

Non-interactive mode

Pass CLI options to create a rule in a single command:

# Add a rule to this project
$ npx @markuplint/create-rule -p project -n my-plugin -r no-empty-alt

# Create a publishable package (JavaScript, no tests)
$ npx @markuplint/create-rule -p package -n my-plugin -r no-empty-alt -l js --no-test

# Contribute to core
$ npx @markuplint/create-rule -p core -r no-empty-alt -d "Disallow empty alt" -c a11y -s error

# JSON output (useful for scripting and AI tooling)
$ npx @markuplint/create-rule -p project -n my-plugin -r no-empty-alt --json

Options

| Option | Short | Description | Default | | ---------------------- | ----- | ---------------------------------------- | -------------------------------- | | --purpose <type> | -p | Purpose: project, package, or core | (required) | | --plugin-name <name> | -n | Plugin/directory name in kebab-case | (required for project/package) | | --rule-name <name> | -r | Rule name in kebab-case | (required) | | --lang <lang> | -l | Language: ts or js | ts | | --test | -t | Generate test files | true | | --no-test | | Skip test file generation | | | --description <text> | -d | Rule description | (required for core) | | --category <cat> | -c | Category (see below) | (required for core) | | --severity <level> | -s | Severity: error or warning | (required for core) | | --json | | Output result as JSON | false | | --help | -h | Show help message | |

Available categories: validation, a11y, naming-convention, maintainability, style

When contributing to core (--purpose core), --lang is always TypeScript and --test is always enabled regardless of the options provided.

Modes

The CLI supports three scaffolding modes depending on your goal:

| Mode | Description | When to use | | ---------------------- | ------------------------------------------------------------- | ------------------------------------------------- | | Add to project | Creates a local plugin directory in your project | Adding a custom rule to an existing project | | Publish as package | Scaffolds a standalone npm package with package.json | Distributing a rule as an installable npm package | | Contribute to core | Adds a rule to @markuplint/rules (only inside the monorepo) | Contributing a new built-in rule to markuplint |

Interactive Flow

The CLI asks questions in the following order:

  1. Purpose — Select one of the three modes above
  2. Directory / plugin name — The directory name (for project mode) or plugin name (for package mode); skipped for core mode
  3. Rule name — The kebab-case name of the rule (e.g., no-empty-alt)
  4. Core-only questions (contribute to core only):
    • Description
    • Category (validation, a11y, naming-convention, maintainability, style)
    • Severity (error or warning)
  5. Language — TypeScript or JavaScript (core mode always uses TypeScript)
  6. Tests — Whether to generate test files (core mode always includes tests)

Generated Files

Add to project

<pluginName>/
├── index.ts (or .js)               — Plugin entry point
└── rules/
    ├── <ruleName>.ts (or .js)      — Rule implementation
    └── <ruleName>.spec.ts (or .js) — Test file (if selected)

Publish as package

<cwd>/
├── package.json                     — Package manifest with scripts
├── tsconfig.json                    — TypeScript config (if TypeScript)
├── README.md                        — Package README
└── src/
    ├── index.ts (or .js)            — Plugin entry point
    └── rules/
        └── <ruleName>.ts (or .js)   — Rule implementation

Contribute to core

packages/@markuplint/rules/src/<ruleName>/
├── index.ts                         — Rule implementation
├── index.spec.ts                    — Test file
├── meta.ts                          — Rule metadata
├── schema.json                      — Value/options JSON Schema
├── README.md                        — English documentation
└── README.ja.md                     — Japanese documentation

Programmatic API

The scaffolding logic can be used programmatically:

import { createRuleHelper } from '@markuplint/create-rule';

const result = await createRuleHelper({
  purpose: 'ADD_TO_PROJECT',
  pluginName: 'my-plugin',
  ruleName: 'no-empty-alt',
  lang: 'TYPESCRIPT',
  needTest: true,
});

See src/types.ts for the full type definitions of CreateRuleHelperParams and CreateRuleHelperResult.