Registry / testing / eslint-plugin-neverthrow

eslint-plugin-neverthrow

JSON →
library1.1.4jsnpmunverified

ESLint plugin enforcing that neverthrow Result types are handled. Current stable version is 1.1.4, released November 2021. It provides a single rule `must-use-result` that flags unhandled `Result` values from the neverthrow library. The plugin is TypeScript‑first, requires `@typescript-eslint/parser`, and relies on type information to detect unhandled results. Unlike manual lint rules, it integrates with ESLint's type‑aware analysis. No updates since 2021; the plugin is stable and low‑maintenance.

testingdevops
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESLint automatically adds the 'eslint-plugin-' prefix. So the plugin name in config is just 'neverthrow'.

plugins: ['neverthrow']

Rules are always prefixed with the plugin name, e.g., 'neverthrow/rule-name'.

rules: { 'neverthrow/must-use-result': 'error' }

Full format is 'plugin:pluginName/configName'. Otherwise ESLint will look for an npm package 'eslint-config-neverthrow'.

extends: ['plugin:neverthrow/recommended']

Shows ESLint configuration to enforce handling neverthrow Result types and an example that triggers the rule.

// .eslintrc.js module.exports = { plugins: ['neverthrow'], rules: { 'neverthrow/must-use-result': 'error', }, parser: '@typescript-eslint/parser', parserOptions: { ecmaVersion: 2021, sourceType: 'module', project: ['./tsconfig.json'], tsconfigRootDir: __dirname, }, }; // Example.ts import { ok, err, Result } from 'neverthrow'; function compute(): Result<number, string> { return ok(42); } const result = compute(); // ❌ flagged: result not handled type: 'typescript'
Debug
Known footguns
gotchaThe plugin requires type information from TypeScript. Without setting 'parserOptions.project' pointing to a valid tsconfig.json, the rule will silently not work (no errors reported).
gotchaThe rule only works on synchronous code. Async/await with neverthrow Result is not detected (see issue #3).
deprecatedAs of v1.1.2, the plugin switched from using '@typescript-eslint/experimental-utils' to internal utilities to fix incompatibility with ESLint >=8. Ensure your ESLint version is >=5.16.
gotchaThe plugin is not the official neverthrow plugin. It's community-maintained and has only one rule. For comprehensive handling, consider combining with other lint rules.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
10 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources