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-neverthrow-must-use

v0.1.2

Published

An ESLint plugin enforcing proper handling of neverthrow Result values.

Readme

eslint-plugin-neverthrow-must-use

An ESLint plugin enforcing proper handling of neverthrow Result values.

You are forced to consume the result in one of the following three ways:

  • Calling .match
  • Calling .unwrapOr
  • Calling ._unsafeUnwrap

📦 Installation

Install the plugin and required dependencies:

npm install neverthrow
npm install --save-dev eslint-plugin-neverthrow-must-use eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin typescript

⚙️ Configuration

1️⃣ Create eslint.config.mjs

import neverthrowMustUse from "eslint-plugin-neverthrow-must-use"; // Import plugin
import tsPlugin from "@typescript-eslint/eslint-plugin"; // Import TypeScript plugin
import tsParser from "@typescript-eslint/parser"; // Import TypeScript parser

export default [
	{
		files: ["src/**/*.ts", "src/**/*.tsx"], // Apply to TypeScript files
		languageOptions: {
			parser: tsParser, // Set TypeScript parser
			parserOptions: {
				ecmaVersion: "latest",
				sourceType: "module",
				project: "./tsconfig.json", // Ensure ESLint reads tsconfig
				tsconfigRootDir: process.cwd(),
			},
		},
		plugins: {
			"@typescript-eslint": tsPlugin, // Enable TypeScript ESLint rules
			"neverthrow-must-use": neverthrowMustUse, // Register the plugin
		},
		rules: {
			"@typescript-eslint/no-unused-vars": "error", // Example TypeScript rule
			"neverthrow-must-use/must-use-result": "error", // Enforce `neverthrow` rule
		},
	},
];

2️⃣ Create tsconfig.json

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "Node",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src"]
}

❌ Incorrect Usage:

import { ok, err, Result } from "neverthrow";

function divide(a: number, b: number): Result<number, Error> {
  return b === 0 ? err(new Error("Cannot divide by zero")) : ok(a / b);
}

function main() {
  const result = divide(10, 2);
  result.map((value) => {
    console.log(value); // ❌ ESLint will throw an error
  });
}

✅ Correct Usage:

import { ok, err, Result } from "neverthrow";

function divide(a: number, b: number): Result<number, Error> {
  return b === 0 ? err(new Error("Cannot divide by zero")) : ok(a / b);
}

function main() {
  const result = divide(10, 2);
  result.match({
    ok: (value) => console.log(value),
    err: (error) => console.error(error),
  }); // ✅ Proper handling
}

🛠 Troubleshooting

1️⃣ Ensure ESLint is detecting the plugin

Run:

npx eslint --debug

You should see output showing that neverthrow-must-use is loaded.

2️⃣ If ESLint isn't enforcing the rule

Check that the plugin is installed:

npm ls eslint-plugin-neverthrow-must-use

If missing, reinstall it:

npm install --save-dev eslint-plugin-neverthrow-must-use

3️⃣ Ensure ESLint can find tsconfig.json

Run:

npx eslint --ext .ts,.tsx src

If you see an error like:

Cannot read file 'tsconfig.json': ENOENT: no such file or directory

Make sure tsconfig.json exists in your project.


📜 License

This project is licensed under the MIT License.


💡 Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue.


📢 Acknowledgments

Inspired by functional programming best practices and the neverthrow library.