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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ module.exports = {
plugins: ['folders'],
rules: { 'folders/match-regex': [2, '^[a-z_]+$', '/root/'] }
};
✗ import folders from 'eslint-plugin-folders'
This is an ESLint plugin, not a standalone module. It's configured via .eslintrc rather than imported in code.
match-regex
✓ "folders/match-regex": [2, "^[a-z_]+$", "/root/"]
✗ "folders/match-regex": [2, "/^[a-z_]+$/", "/root/"]
The regex is provided as a string without slashes. The second parameter is the root path.
RULES
✓ const rules = require('eslint-plugin-folders').rules; console.log(Object.keys(rules));
✗ const { matchRegex } = require('eslint-plugin-folders');
The plugin exposes a rules object. Individual rules are accessed via string keys like 'match-regex'.
Shows how to configure the match-regex rule in .eslintrc.json to enforce snake_case folder names.
// .eslintrc.json
{
"plugins": ["folders"],
"rules": {
"folders/match-regex": [2, "^[a-z_]+$", "."]
}
}
// This config enforces snake_case folder names in all folders below the root.
// To test, create a folder with a wrong name (e.g., 'MyFolder') containing a JS file.
// Run ESLint: npx eslint .
// You'll see an error like:
// error Folder 'MyFolder' doesn't match the pattern ^[a-z_]+$ folders/match-regex
Errors
Common errors & fixes
Error: .eslintrc: Configuration for rule "folders/match-regex" is invalid
The rule configuration format is wrong; typically the regex is not a string.
fixUse an array: [severity, patternString, rootPath]. E.g., [2, "^[a-z]+$", "."].
Error: Cannot find module 'eslint-plugin-folders'
Plugin not installed as a dev dependency.
fixRun: npm install eslint-plugin-folders --save-dev
Parsing error: The keyword 'const' is reserved
ESLint is not configured for ES6 syntax.
fixSet parserOptions: { ecmaVersion: 6 } in .eslintrc or use a parser like babel-eslint. Audit
Dependencies
eslintrequiredpeer dependency required to load and run the plugin