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

@rnx-kit/lint-json

v0.2.0

Published

EXPERIMENTAL - USE WITH CAUTION - lint-json

Readme

@rnx-kit/lint-json

Build npm version

🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧

This tool is EXPERIMENTAL - USE WITH CAUTION

🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧

A small library for asserting and fixing values in a JSON file. Build your own linter on top of it — declare what should be at a path, run in validation mode to report drift, or in fix mode to write the corrected file back to disk.

Installation

yarn add @rnx-kit/lint-json --dev

Usage

import { createJSONValidator } from "@rnx-kit/lint-json";

const validator = createJSONValidator("package.json", undefined, {
  fix: process.argv.includes("--fix"),
});

validator.enforce("license", "MIT");
validator.enforce("repository.type", "git");
validator.enforce(["scripts", "build"], "rnx-kit-scripts build");
validator.enforce("private", undefined); // remove the property

process.exit(validator.finish());

In validation mode (the default), mismatches and missing values are collected and reported as a tree on finish(), which returns 1. In fix mode, the same mismatches are applied to the in-memory object and the file is rewritten; finish() returns 0.

API

createJSONValidator(jsonPath, json?, options?)

  • jsonPath — path to the JSON file. Used in default error headers and as the write target in fix mode.
  • json — the parsed object to validate. If omitted, the file at jsonPath is read from disk.
  • options — see below. All optional.

| Option | Type | Default | | ------------- | --------------------------- | ------------------------------ | | fix | boolean | false | | header | string | "errors in: <relative path>" | | footer | string | (none) | | reportError | (message: string) => void | console.error |

validator.enforce(path, value)

Asserts that path resolves to value. If it doesn't:

  • in validation mode, an error is recorded;
  • in fix mode, intermediate objects are created as needed and the value is written.

path is either a dotted string ("dependencies.react") or an array (["exports", ".", "import"]). Use an array when keys may contain dots.

Passing undefined for value removes the property at path.

validator.error(message)

Records an arbitrary error. finish() will return 1 even if no enforce calls failed.

validator.finish()

Returns 0 on success, 1 if any errors were recorded. In fix mode, writes the file before returning if any changes were made.

Other validator properties

  • validator.fixboolean, read-only. The mode the validator is running in.
  • validator.rawJSONObject, read-only reference to the object being validated. Property mutation by enforce happens in place; the field itself can't be reassigned.
  • validator.dirty(path) — called internally when enforce mutates the raw object in fix mode. Wrappers that delegate to this validator can override dirty to react to specific paths (for example, invalidating a cache when path[0] matches a watched key).

Notes

  • Object key order is significant. Two objects with the same keys in a different order are treated as unequal. In fix mode this causes a rewrite with the desired key order — useful for keeping package.json fields ordered, but be aware of it.
  • Prototype-pollution paths are blocked. Any path containing __proto__, constructor, or prototype throws from enforce.