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

mejora

v3.2.1

Published

Prevent regressions. Allow improvement.

Readme

mejora

Prevent regressions. Allow improvement. mejora (Spanish for "improvement")

actions version downloads Install Size

mejora runs checks, compares them to a stored baseline, and fails only when things get worse.

Behavior

Each check produces a snapshot.

Snapshots are compared against a baseline.

  • New items are regressions and fail the run
  • Removed items are improvements and pass the run

Snapshots use the items format to represent issues:

{
  "checks": {
    "eslint": {
      "type": "items",
      "items": [
        {
          "id": "a1b2c3d4...",
          "file": "src/example.ts",
          "line": 12,
          "column": 5,
          "rule": "no-unused-vars",
          "message": "'foo' is declared but never used"
        }
      ]
    }
  }
}

[!NOTE] Issue identifiers (id) are stable across runs and generally insensitive to code movement, while remaining unique for repeated issues.

The baseline represents the last accepted state and should be committed to the repository.

Default location:

.mejora/baseline.json

When a run produces fewer items than the baseline, the run passes and the baseline is updated automatically.

Regressions fail the run.

mejora --force updates the baseline even when regressions are present.

Output

Output is non-interactive and deterministic.

  • Plain text by default
  • Markdown output for human-friendly review and navigation
  • --json produces structured output for CI and automation

Exit Codes

  • 0 pass or improvement
  • 1 regression detected or baseline out of sync
  • 2 configuration or runtime error

Installation

pnpm add -D mejora

[!NOTE] mejora requires Node.js 22.18.0 or later.

Usage

Run checks:

pnpm mejora

Force the baseline to accept regressions:

pnpm mejora --force

JSON output for CI and automation:

pnpm mejora --json

Run only a subset of checks:

pnpm mejora --only "eslint > *"

Skip checks:

pnpm mejora --skip typescript

Programmatic API

import { run } from "mejora";

const result = await run();
// with options (config is loaded from disk by default)
const resultWithOptions = await run({ force: true });

Configuration

Create one of:

  • mejora.config.ts
  • mejora.config.js
  • mejora.config.mjs
  • mejora.config.mts
import { defineConfig, eslint, regex, typescript } from "mejora";

export default defineConfig({
  checks: [
    eslint({
      name: "no-nested-ternary",
      files: ["src/**/*.{ts,tsx,js,jsx}"],
      rules: {
        "no-nested-ternary": "error",
      },
    }),
    typescript({
      name: "no-implicit-any",
      compilerOptions: {
        noImplicitAny: true,
      },
    }),
    regex({
      name: "no-todos",
      files: ["src/**/*"],
      patterns: [
        {
          pattern: /\/\/\s*TODO(?:\((?<owner>[^)]+)\))?:\s*(?<task>.*)/gi,
          message: (match) => {
            const task = match.groups?.task?.trim() || "no description";
            const owner = match.groups?.owner;
            const truncated =
              task.length > 80 ? `${task.slice(0, 80)}...` : task;

            return owner ? `[${owner}] ${truncated}` : truncated;
          },
          rule: "todo",
        },
      ],
    }),
  ],
});

Each check’s name is used as its ID in the baseline and output.

Supported Checks

ESLint

  • Snapshot type: "items"
  • Each lint message is treated as an issue
  • Regressions are new issues

[!NOTE] eslint (^9.34.0) is required as a peer dependency when using the ESLint check

TypeScript

  • Snapshot type: "items"
  • Each compiler diagnostic is treated as an issue
  • Regressions are new issues
  • Uses the nearest tsconfig.json by default, or an explicit one if provided

[!NOTE] typescript (^5.0.0) is required as a peer dependency when using the TypeScript check

Regex

  • Snapshot type: "items"
  • Each pattern match is treated as an issue
  • Regressions are new matches
  • Works on any file type (not just code)

Custom Checks

Define custom checks using defineCheck():

import { defineConfig, defineCheck } from "mejora";
import { glob, readFile } from "node:fs/promises";

const noHardcodedUrls = defineCheck<{ files: string[] }>({
  type: "no-hardcoded-urls",
  async run(config) {
    const violations = [];

    for await (const file of glob(config.files, { cwd: process.cwd() })) {
      const content = await readFile(file, "utf-8");
      const lines = content.split("\n");

      for (let i = 0; i < lines.length; i++) {
        const line = lines[i];
        const matches = line.matchAll(/https?:\/\/[^\s'"]+/g);

        for (const match of matches) {
          violations.push({
            file,
            line: i + 1,
            column: match.index + 1,
            rule: "no-hardcoded-urls",
            message: `Hardcoded URL found: ${match[0]}`,
          });
        }
      }
    }

    return violations;
  },
});

export default defineConfig({
  checks: [
    noHardcodedUrls({
      name: "urls-in-src",
      files: ["src/**/*.ts"],
    }),
    noHardcodedUrls({
      name: "urls-in-lib",
      files: ["lib/**/*.ts"],
    }),
  ],
});

CI

When running in CI, mejora does not write the baseline.

Instead, it compares the committed baseline to the expected results from the current codebase.

If there is any difference between the committed baseline and the expected results, the run fails.

Merge Conflicts

mejora can automatically resolve merge conflicts in both baseline.json and baseline.md.

After merging branches, you may see conflicts like:

$ git status
both modified:   .mejora/baseline.json
both modified:   .mejora/baseline.md

Instead of resolving these by hand, simply run mejora:

$ mejora
Merge conflict detected in baseline, auto-resolving...
✔ Baseline conflict resolved

mejora reconciles both sides of the conflict and regenerates a consistent baseline.

Credits