{"id":19996,"library":"eslint-rule-docs","title":"eslint-rule-docs","description":"A utility library (v1.1.235) that returns the documentation URL for a given ESLint rule, supporting both core rules and known plugins. Updated daily via cron job to keep plugin mappings current. Differentiates itself from manual lookup by providing exact-match URLs for core rules, per-plugin documentation for known plugins (e.g., React, Flowtype), and fallback to repository URL or empty object for unknown plugins. Works in Node.js with CommonJS/ESM.","status":"active","version":"1.1.235","language":"javascript","source_language":"en","source_url":"https://github.com/stefanbuck/eslint-rule-docs","tags":["javascript","eslint","eslint-plugin","docs","documenation","rules","rule"],"install":[{"cmd":"npm install eslint-rule-docs","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-rule-docs","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-rule-docs","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The default export is a function. Named export 'getRuleUrl' does not exist; must use default import or require.","wrong":"const { getRuleUrl } = require('eslint-rule-docs')","symbol":"default (getRuleUrl)","correct":"import getRuleUrl from 'eslint-rule-docs'"},{"note":"CommonJS require gives the function directly, not an object with default property.","wrong":"const { default: getRuleUrl } = require('eslint-rule-docs')","symbol":"default (getRuleUrl) via require","correct":"const getRuleUrl = require('eslint-rule-docs')"},{"note":"Package does not ship TypeScript types. Use a .d.ts file or rely on inference.","wrong":"","symbol":"TypeScript types","correct":"getRuleUrl has no types; use @types/eslint-rule-docs or inline definition"}],"quickstart":{"code":"const getRuleUrl = require('eslint-rule-docs');\n\nconst coreResult = getRuleUrl('no-undef');\nconsole.log(coreResult);\n// { exactMatch: true, url: 'https://eslint.org/docs/rules/no-undef' }\n\nconst pluginResult = getRuleUrl('react/sort-prop-types');\nconsole.log(pluginResult);\n// { exactMatch: true, url: 'https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md' }\n\nconst unknownResult = getRuleUrl('unknown-foo/bar');\nconsole.log(unknownResult);\n// {}","lang":"javascript","description":"Demonstrates usage to get rule documentation URLs for core ESLint rules, plugin rules, and unknown rules."},"warnings":[{"fix":"Use the official rule name (kebab-case for core rules, slash-separated for plugins).","message":"The rule name must be exactly as ESLint expects (e.g., 'no-undef', not 'no_undef').","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check if result has an 'exactMatch' property or a 'url' property to determine if it was found.","message":"Plugin rules are only supported if the plugin is known to the library; unknown plugins return an empty object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Do not rely on the URL being permanent; always fetch the latest version of the library.","message":"URLs for core rules point to eslint.org/docs/rules/, which may change if ESLint updates its documentation structure.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check ESLint core rules documentation for removed rules; the library may still return old URLs.","message":"The package may rely on outdated mappings for deprecated ESLint rules.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"If you need multiple URLs, consider additional sources or fork the package.","message":"The library only returns one URL per rule; it does not support multiple documentation sources.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install eslint-rule-docs`","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'eslint-rule-docs'"},{"fix":"Use `import getRuleUrl from 'eslint-rule-docs'` or `const getRuleUrl = require('eslint-rule-docs')`","cause":"Wrong import style: imported as named export instead of default.","error":"getRuleUrl is not a function"},{"fix":"Import default: `import getRuleUrl from 'eslint-rule-docs'`","cause":"Attempted to destructure import incorrectly, e.g., `const { getRuleUrl } = require('eslint-rule-docs')`.","error":"TypeError: getRuleUrl is not a function"},{"fix":"Check the list of supported plugins; if missing, contribute to the database or use the fallback manual URL.","cause":"Plugin is not included in the library's mapping.","error":"{} returned for a rule I know exists"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}