Registry / testing / eslint-plugin-rulesdir

eslint-plugin-rulesdir

JSON →
library0.2.2jsnpmunverified

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.

npm install eslint-plugin-rulesdir
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-RULE
E
eslint-plugin-rulesdir
testingjavascriptv0.2.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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.

default
const rulesDirPlugin = require('eslint-plugin-rulesdir');
import rulesDirPlugin from 'eslint-plugin-rulesdir';
This package is CJS-only; ESM import will cause a runtime error.
RULES_DIR property
rulesDirPlugin.RULES_DIR = './my-rules';
rulesDirPlugin.RULES_DIR = 'my-rules';
Path is relative to current working directory. Using a relative path without './' may be unclear but works.
plugin usage in config
plugins: ['rulesdir']
plugins: ['eslint-plugin-rulesdir']
ESLint plugin names omit the 'eslint-plugin-' prefix when listed in the plugins array.
rule configuration
'rulesdir/my-rule': 'error'
'my-rule': 'error'
Rules from the local directory must be prefixed with 'rulesdir/' to distinguish them.

Shows how to set up eslint-plugin-rulesdir with a local rules directory and configure a custom rule.

// Install: npm install eslint --save-dev && npm install eslint-plugin-rulesdir --save-dev // .eslintrc.js const rulesDirPlugin = require('eslint-plugin-rulesdir'); rulesDirPlugin.RULES_DIR = './local-rules'; module.exports = { plugins: ['rulesdir'], rules: { 'rulesdir/my-custom-rule': 'error', }, };
Debug
Known issues
gotchaRULES_DIR must be set before the config is evaluated; it is a runtime property, not part of the config object.
fix
Ensure the require() and assignment to RULES_DIR happens at the top level of your config file, before module.exports.
affects: >=0.0.1
gotchaThe plugin name in the plugins array is 'rulesdir', not the full package name.
fix
Use 'rulesdir' in the plugins array.
affects: >=0.0.1
breakingThis plugin is experimental and its API may change. RULES_DIR property and behavior might not be stable.
fix
Pin to a specific version and monitor the repository for breaking changes.
affects: 0.x
gotchaPath resolution is from the current working directory (cwd), not the config file's location. Running ESLint from a different directory may break rule loading.
fix
Use absolute paths or ensure cwd consistency with process.chdir() or --cwd flag.
affects: >=0.0.1
gotchaMultiple directories are supported via array, but only since version 0.2.0? (Check docs). Combining with single string may cause confusion.
fix
If using an older version, only strings are accepted. Upgrade to 0.2.0+ for array support.
affects: >=0.2.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-rulesdir".
Plugin is not installed or is installed globally while ESLint is local.
fix
Run 'npm install eslint-plugin-rulesdir --save-dev' in your project directory.
Cannot read property 'RULES_DIR' of undefined
require('eslint-plugin-rulesdir') returned undefined or the plugin was not properly loaded.
fix
Ensure the package is installed and the require path is correct: const rulesDirPlugin = require('eslint-plugin-rulesdir');
Rule "rulesdir/my-rule" was not found.
The RULES_DIR path is incorrect or the rule file does not exist.
fix
Verify that the rule file exists at the specified path relative to cwd. Check RULES_DIR assignment.
Configuration for rule "rulesdir/my-rule" is invalid: Severity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '"error"').
Severity strings like 'error' are not supported; must use numeric values or full severity strings in newer ESLint.
fix
Use 'error' as a string (ESLint >= 3.0.0 supports strings) or number 2. Check your ESLint version.
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
eslint-plugin-rulesdir — npm install eslint-plugin-rulesdir · libregistry