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

@lint-suite/eslint-plugin-util-purity

v1.0.0

Published

Disallow impure operations in utility modules

Readme

@lint-suite/eslint-plugin-util-purity

@lint-suite/eslint-plugin-util-purity is an ESLint rule for TypeScript utility modules. In production utils/*.util.ts files, it prevents I/O, ambient browser or Node state, nondeterminism, side-effecting calls, and module-level mutable state. Files below test/ and testing/ are excluded.

Install

Requires Node.js 24+, ESLint ^10.9.1, and TypeScript 6.0.3+.

pnpm add -D @lint-suite/eslint-plugin-util-purity eslint@^10.9.1 typescript@">=6.0.3" typescript-eslint

The plugin does not configure a TypeScript parser. Use typescript-eslint for TypeScript files:

// eslint.config.js
import utilPurity from '@lint-suite/eslint-plugin-util-purity';
import tseslint from 'typescript-eslint';

export default [{
  files: ['**/*.ts'],
  languageOptions: { parser: tseslint.parser },
  plugins: { utilPurity },
  rules: { 'utilPurity/util-purity': 'error' }
}];

Options

bannedModules defaults to:

[
  'node:fs', 'fs', 'node:fs/promises', 'fs/promises',
  'node:child_process', 'child_process', 'node:os', 'os',
  'node:process', 'process', 'node:http', 'http', 'node:https', 'https',
  'node:net', 'net', 'node:worker_threads', 'worker_threads'
]
rules: {
  'utilPurity/util-purity': ['error', { bannedModules: ['node:fs', 'fs'] }]
}

A configured bannedModules array replaces the default. File naming is required: only production paths matching utils/<name>.util.ts are checked. A .spec.util.ts file is excluded only when it is below test/ or testing/.

Examples

Each snippet is checked by this rule alone. The filename comment is part of the fixture.

Valid examples

1. Deterministic string transformation

// src/utils/slug.util.ts
export const slug = (value: string): string => value.trim().toLowerCase();

2. Non-banned dependency

// src/utils/parse.util.ts
import { z } from 'zod';
export const parse = (value: unknown) => z.string().parse(value);

3. Module-level immutable primitive

// src/utils/limit.util.ts
const LIMIT = 10;
export const capped = (value: number): number => Math.min(value, LIMIT);

4. Mutable collection created per call

// src/utils/unique.util.ts
export const unique = (values: string[]): string[] => [...new Set(values)];

5. Test utility under test/

// src/test/utils/read.spec.util.ts
import { readFileSync } from 'node:fs';
export const readFixture = (file: string): string => readFileSync(file, 'utf8');

Invalid examples

1. Banned filesystem import

// src/utils/read.util.ts
import { readFileSync } from 'node:fs';
export const read = (file: string): string => readFileSync(file, 'utf8');

2. Module-level let

// src/utils/counter.util.ts
let counter = 0;
export const next = (): number => ++counter;

3. Module-level Map

// src/utils/cache.util.ts
const cache = new Map<string, string>();
export const lookup = (key: string): string | undefined => cache.get(key);

4. Ambient process state

// src/utils/environment.util.ts
export const mode = (): string | undefined => process.env['NODE_ENV'];

5. Nondeterministic clock

// src/utils/timestamp.util.ts
export const timestamp = (): number => Date.now();

6. Side-effecting timer call

// src/utils/defer.util.ts
export const defer = (): void => setTimeout(() => {}, 10);

The named utilPurityRule export is for composed plugin registries.