{"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,"search_vec":"'1.0.0':79 '1.0.4':24 'altern':58 'configur':37 'consist':10 'contain':50 'convent':13 'current':20 'depend':83 'directori':45 'enforc':9 'eslint':2,6,57,61,66,78,85,88 'eslint-plugin':87 'eslint-plugin-filenam':65 'eslint-plugin-fold':1 'eslint-plugin-import':60 'eslintplugin':86 'express':19 'file':16,54 'filenam':68,71 'focus':69 'folder':4,11,49,73,90,91 'import':63 'javascript':84 'javascript/jsx':15 'js':51 'jsx':53 'like':59 'lint':48 'match':32 'match-regex':31 'name':12,74 'path':92 'pattern':41 'peer':82 'plugin':3,7,26,62,67,76,89 'process':55 'provid':27 'regex':33,40 'regular':18 'requir':77 'root':44 'rule':30 'singl':29 'stabl':21 'use':17 'version':22","created_at":"2026-04-25T11:19:31.577209+00:00","updated_at":"2026-04-25T11:19:31.577209+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/christopherbradleybanks/eslint-plugin-folders","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-folders","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}