{"id":19842,"library":"eslint-plugin-neverthrow","title":"eslint-plugin-neverthrow","description":"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.","status":"active","version":"1.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/mdbetancourt/eslint-plugin-nevethrow","tags":["javascript","typescript","template","eslint","eslintplugin","eslint-plugin"],"install":[{"cmd":"npm install eslint-plugin-neverthrow","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-neverthrow","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-neverthrow","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: required as runtime","package":"eslint","optional":false},{"reason":"peer dependency: used to parse TypeScript and provide type information","package":"@typescript-eslint/parser","optional":false}],"imports":[{"note":"ESLint automatically adds the 'eslint-plugin-' prefix. So the plugin name in config is just 'neverthrow'.","wrong":"plugins: ['eslint-plugin-neverthrow']","symbol":"eslint-plugin-neverthrow (plugin)","correct":"plugins: ['neverthrow']"},{"note":"Rules are always prefixed with the plugin name, e.g., 'neverthrow/rule-name'.","wrong":"rules: { 'must-use-result': 'error' }","symbol":"must-use-result rule","correct":"rules: { 'neverthrow/must-use-result': 'error' }"},{"note":"Full format is 'plugin:pluginName/configName'. Otherwise ESLint will look for an npm package 'eslint-config-neverthrow'.","wrong":"extends: ['neverthrow/recommended']","symbol":"recommended config","correct":"extends: ['plugin:neverthrow/recommended']"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  plugins: ['neverthrow'],\n  rules: {\n    'neverthrow/must-use-result': 'error',\n  },\n  parser: '@typescript-eslint/parser',\n  parserOptions: {\n    ecmaVersion: 2021,\n    sourceType: 'module',\n    project: ['./tsconfig.json'],\n    tsconfigRootDir: __dirname,\n  },\n};\n\n// Example.ts\nimport { ok, err, Result } from 'neverthrow';\n\nfunction compute(): Result<number, string> {\n  return ok(42);\n}\n\nconst result = compute(); // ❌ flagged: result not handled\ntype: 'typescript'","lang":"typescript","description":"Shows ESLint configuration to enforce handling neverthrow Result types and an example that triggers the rule."},"warnings":[{"fix":"Add 'parser: '@typescript-eslint/parser'' and 'parserOptions.project' pointing to your tsconfig.json.","message":"The 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).","severity":"gotcha","affected_versions":"all"},{"fix":"For async functions, manually handle the result or use a helper like .unwrapOr() within the async context.","message":"The rule only works on synchronous code. Async/await with neverthrow Result is not detected (see issue #3).","severity":"gotcha","affected_versions":">=1.0.0 <=1.1.4"},{"fix":"Update to v1.1.2 or later if using ESLint 8. If on an older version, still upgrade to avoid shared type issues.","message":"As 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.","severity":"deprecated","affected_versions":">=1.1.2"},{"fix":"Verify the plugin meets your needs; consider supplementing with manual checks or other plugins.","message":"The 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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev @typescript-eslint/parser","cause":"Missing required peer dependency @typescript-eslint/parser.","error":"Error: Cannot find module '@typescript-eslint/parser'"},{"fix":"npm install --save-dev eslint-plugin-neverthrow","cause":"Plugin not installed or ESLint cannot resolve it.","error":"Error: Failed to load plugin 'neverthrow': Cannot find module 'eslint-plugin-neverthrow'"},{"fix":"Ensure plugins: ['neverthrow'] is present in config and rule is 'neverthrow/must-use-result' (lowercase).","cause":"Plugin not loaded in the config's 'plugins' array or misspelled rule name.","error":"Definition for rule 'neverthrow/must-use-result' was not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}