{"id":19923,"library":"eslint-plugin-rulesdir","title":"eslint-plugin-rulesdir","description":"Allows a local ESLint rules directory to be used without the --rulesdir command-line flag. Version 0.2.2 is experimental and its API may change. It requires manual configuration by setting the RULES_DIR property on the plugin object before use. Unlike eslint-plugin-local-rules, which scans for a local directory automatically, rulesdir provides explicit control over which directories to load rules from. Works with Node >=4.0.0 and ESLint.","status":"maintenance","version":"0.2.2","language":"javascript","source_language":"en","source_url":"https://github.com/not-an-aardvark/eslint-plugin-rulesdir","tags":["javascript","eslint","eslintplugin","eslint-plugin"],"install":[{"cmd":"npm install eslint-plugin-rulesdir","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-rulesdir","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-rulesdir","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CJS-only; ESM import will cause a runtime error.","wrong":"import rulesDirPlugin from 'eslint-plugin-rulesdir';","symbol":"default","correct":"const rulesDirPlugin = require('eslint-plugin-rulesdir');"},{"note":"Path is relative to current working directory. Using a relative path without './' may be unclear but works.","wrong":"rulesDirPlugin.RULES_DIR = 'my-rules';","symbol":"RULES_DIR property","correct":"rulesDirPlugin.RULES_DIR = './my-rules';"},{"note":"ESLint plugin names omit the 'eslint-plugin-' prefix when listed in the plugins array.","wrong":"plugins: ['eslint-plugin-rulesdir']","symbol":"plugin usage in config","correct":"plugins: ['rulesdir']"},{"note":"Rules from the local directory must be prefixed with 'rulesdir/' to distinguish them.","wrong":"'my-rule': 'error'","symbol":"rule configuration","correct":"'rulesdir/my-rule': 'error'"}],"quickstart":{"code":"// Install: npm install eslint --save-dev && npm install eslint-plugin-rulesdir --save-dev\n\n// .eslintrc.js\nconst rulesDirPlugin = require('eslint-plugin-rulesdir');\nrulesDirPlugin.RULES_DIR = './local-rules';\n\nmodule.exports = {\n  plugins: ['rulesdir'],\n  rules: {\n    'rulesdir/my-custom-rule': 'error',\n  },\n};","lang":"javascript","description":"Shows how to set up eslint-plugin-rulesdir with a local rules directory and configure a custom rule."},"warnings":[{"fix":"Ensure the require() and assignment to RULES_DIR happens at the top level of your config file, before module.exports.","message":"RULES_DIR must be set before the config is evaluated; it is a runtime property, not part of the config object.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use 'rulesdir' in the plugins array.","message":"The plugin name in the plugins array is 'rulesdir', not the full package name.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Pin to a specific version and monitor the repository for breaking changes.","message":"This plugin is experimental and its API may change. RULES_DIR property and behavior might not be stable.","severity":"breaking","affected_versions":"0.x"},{"fix":"Use absolute paths or ensure cwd consistency with process.chdir() or --cwd flag.","message":"Path resolution is from the current working directory (cwd), not the config file's location. Running ESLint from a different directory may break rule loading.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"If using an older version, only strings are accepted. Upgrade to 0.2.0+ for array support.","message":"Multiple directories are supported via array, but only since version 0.2.0? (Check docs). Combining with single string may cause confusion.","severity":"gotcha","affected_versions":">=0.2.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-plugin-rulesdir --save-dev' in your project directory.","cause":"Plugin is not installed or is installed globally while ESLint is local.","error":"ESLint couldn't find the plugin \"eslint-plugin-rulesdir\"."},{"fix":"Ensure the package is installed and the require path is correct: const rulesDirPlugin = require('eslint-plugin-rulesdir');","cause":"require('eslint-plugin-rulesdir') returned undefined or the plugin was not properly loaded.","error":"Cannot read property 'RULES_DIR' of undefined"},{"fix":"Verify that the rule file exists at the specified path relative to cwd. Check RULES_DIR assignment.","cause":"The RULES_DIR path is incorrect or the rule file does not exist.","error":"Rule \"rulesdir/my-rule\" was not found."},{"fix":"Use 'error' as a string (ESLint >= 3.0.0 supports strings) or number 2. Check your ESLint version.","cause":"Severity strings like 'error' are not supported; must use numeric values or full severity strings in newer ESLint.","error":"Configuration for rule \"rulesdir/my-rule\" is invalid: Severity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '\"error\"')."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}