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

eslint-plugin-ts-data-forge

v0.4.1

Published

ESLint rules that steer code toward ts-data-forge idioms.

Readme

eslint-plugin-ts-data-forge

ESLint rules that steer TypeScript code toward ts-data-forge idioms — e.g. preferring Arr.isNonEmpty(xs) over xs.length > 0, isRecord(x) && hasKey(x, k) over Object.hasOwn(x, k), or Num.safeParseInt over parseInt. Every rule is auto-fixable.

Installation

npm install --save-dev eslint-plugin-ts-data-forge

Requires ESLint 9+ (flat config) and TypeScript. Some rules are type-aware and need a configured TypeScript project.

Usage (flat config)

The plugin ships a recommended config preset that registers the plugin and turns on every rule at error:

// eslint.config.mts
import { eslintPluginTsDataForge } from 'eslint-plugin-ts-data-forge';

export default [eslintPluginTsDataForge.configs.recommended];

Since the preset is a plain flat-config object, individual rules can be adjusted by a later config entry:

// eslint.config.mts
import {
    eslintPluginTsDataForge,
    type EslintTsDataForgeRules,
} from 'eslint-plugin-ts-data-forge';

export default [
    eslintPluginTsDataForge.configs.recommended,
    {
        rules: {
            'ts-data-forge/prefer-range-for-loop': 'off',
        } satisfies Partial<EslintTsDataForgeRules>,
    },
];

Or register the plugin yourself and pick the rules one by one:

// eslint.config.mts
import {
    eslintPluginTsDataForge,
    type EslintTsDataForgeRules,
} from 'eslint-plugin-ts-data-forge';

export default [
    {
        plugins: { 'ts-data-forge': eslintPluginTsDataForge },
        rules: {
            'ts-data-forge/prefer-canonical-length-guard': 'error',
            'ts-data-forge/prefer-canonical-length-cast': 'error',
            'ts-data-forge/prefer-is-record-and-has-key': 'error',
            // ...enable the rules you want
        } satisfies Partial<EslintTsDataForgeRules>,
    },
];

Rules

| Rule | Description | | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | prefer-canonical-array-slicing | Unify non-mutating array add/remove patterns into Arr.tail/skip/take/etc. | | prefer-canonical-length-guard | Normalize array-length checks to the canonical Arr guard (xs.length > 0Arr.isNonEmpty, Arr.isFixedLengthArray(0, xs)Arr.isEmpty, Arr.isFixedLengthTuple(0, xs)Arr.isEmptyTuple, …). | | prefer-canonical-length-cast | Normalize a degenerate Arr length cast to the canonical one (Arr.asMinLengthArray(1, xs)Arr.asNonEmptyArray(xs), Arr.asBoundedLengthArray(n, n, xs)Arr.asFixedLengthArray(n, xs), …). | | prefer-arr-is-array | Replace Array.isArray with Arr.isArray. | | prefer-arr-sum | Replace xs.reduce((a, b) => a + b, 0) with Arr.sum(xs) / Arr.sumBy(xs, fn). | | prefer-as-int | Replace branded-number assertions (x as Int) with asInt(x)-style casts. | | prefer-is-non-null-object | Replace typeof u === 'object' && u !== null with isNonNullObject(u). | | prefer-range-for-loop | Replace C-style for loops with for (const i of range(begin, end)). | | prefer-is-record-and-has-key | Replace Object.hasOwn(obj, key) / key in obj with isRecord(obj) && hasKey(…). | | prefer-num-safe-parse-int | Replace parseInt(x, 10) with Result.unwrapOkOr(Num.safeParseInt(x), NaN). | | prefer-num-safe-parse-float | Replace parseFloat(x) / Number(x) with Num.safeParseFloat-based parsing. | | no-unnecessary-type-guard | Flag ts-data-forge type-guard calls that do no narrowing (type-aware). | | prefer-comparison-over-nullish-guard | Prefer direct === null / !== undefined over isNull / isNotUndefined calls. |

License

Apache-2.0