{"id":19761,"library":"eslint-plugin-folders","title":"eslint-plugin-folders","description":"An ESLint plugin that enforces consistent folder naming conventions for JavaScript/JSX files using regular expressions. Current stable version is 1.0.4. The plugin provides a single rule `match-regex` that can be configured with a regex pattern and a root directory. It only lints folders containing `.js` or `.jsx` files processed by ESLint. Alternatives like `eslint-plugin-import` or `eslint-plugin-filenames` focus on filenames, not folder names. The plugin requires ESLint >=1.0.0 as a peer dependency.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":"git://github.com/christopherbradleybanks/eslint-plugin-folders","tags":["javascript","eslint","eslintplugin","eslint-plugin","folder","folders","path"],"install":[{"cmd":"npm install eslint-plugin-folders","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-folders","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-folders","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to load and run the plugin","package":"eslint","optional":false}],"imports":[{"note":"This is an ESLint plugin, not a standalone module. It's configured via .eslintrc rather than imported in code.","wrong":"import folders from 'eslint-plugin-folders'","symbol":"default","correct":"module.exports = {\n  plugins: ['folders'],\n  rules: { 'folders/match-regex': [2, '^[a-z_]+$', '/root/'] }\n};"},{"note":"The regex is provided as a string without slashes. The second parameter is the root path.","wrong":"\"folders/match-regex\": [2, \"/^[a-z_]+$/\", \"/root/\"]","symbol":"match-regex","correct":"\"folders/match-regex\": [2, \"^[a-z_]+$\", \"/root/\"]"},{"note":"The plugin exposes a rules object. Individual rules are accessed via string keys like 'match-regex'.","wrong":"const { matchRegex } = require('eslint-plugin-folders');","symbol":"RULES","correct":"const rules = require('eslint-plugin-folders').rules; console.log(Object.keys(rules));"}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"plugins\": [\"folders\"],\n  \"rules\": {\n    \"folders/match-regex\": [2, \"^[a-z_]+$\", \".\"]\n  }\n}\n\n// This config enforces snake_case folder names in all folders below the root.\n// To test, create a folder with a wrong name (e.g., 'MyFolder') containing a JS file.\n// Run ESLint: npx eslint .\n// You'll see an error like:\n//   error  Folder 'MyFolder' doesn't match the pattern ^[a-z_]+$  folders/match-regex","lang":"javascript","description":"Shows how to configure the match-regex rule in .eslintrc.json to enforce snake_case folder names."},"warnings":[{"fix":"Ensure each folder you want to lint contains at least one .js or .jsx file that ESLint processes.","message":"The plugin only lints folders of .js and .jsx files. Folders without JS/JSX files are ignored.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use plain regex string without surrounding slashes.","message":"The regex pattern is provided as a string without delimiters. E.g., '^[a-z_]+$' not '/^[a-z_]+$/'.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade ESLint to version 1.0.0 or later.","message":"ESLint >=1.0.0 required. Older versions may not load the plugin correctly.","severity":"breaking","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":"Use an array: [severity, patternString, rootPath]. E.g., [2, \"^[a-z]+$\", \".\"].","cause":"The rule configuration format is wrong; typically the regex is not a string.","error":"Error: .eslintrc: Configuration for rule \"folders/match-regex\" is invalid"},{"fix":"Run: npm install eslint-plugin-folders --save-dev","cause":"Plugin not installed as a dev dependency.","error":"Error: Cannot find module 'eslint-plugin-folders'"},{"fix":"Set parserOptions: { ecmaVersion: 6 } in .eslintrc or use a parser like babel-eslint.","cause":"ESLint is not configured for ES6 syntax.","error":"Parsing error: The keyword 'const' is reserved"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}