{"id":19970,"library":"eslint-plugin-validate-filename","title":"eslint-plugin-validate-filename","description":"ESLint plugin with rules to enforce file naming conventions. Current version 1.2.0 (released 2025). Supports ESLint v7+. Features include folder-based case enforcement (camel, pascal, snake, kebab, flat), regex pattern matching, exclusion patterns, and extension whitelisting via limit-extensions rule. Differentiators: per-folder rules, exclusion support, and Next.js integration examples. Maintenance-oriented release cadence.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/hiro08gh/eslint-plugin-validate-filename","tags":["javascript","eslint","filename"],"install":[{"cmd":"npm install eslint-plugin-validate-filename","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-validate-filename","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-validate-filename","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for ESLint plugin","package":"eslint","optional":false}],"imports":[{"note":"ESM-only; the plugin exports a single object with rules","wrong":"const validateFilename = require('eslint-plugin-validate-filename')","symbol":"default export","correct":"import validateFilename from 'eslint-plugin-validate-filename'"},{"note":"Named export 'rules' contains all rule definitions","wrong":null,"symbol":"rules","correct":"import { rules } from 'eslint-plugin-validate-filename'"},{"note":"In ESLint flat config, you must pass the plugin object, not a string","wrong":"plugins: ['validate-filename']  // Not valid for flat config","symbol":"Plugin config","correct":"import validateFilename from 'eslint-plugin-validate-filename'; plugins: { 'validate-filename': validateFilename }"}],"quickstart":{"code":"// .eslintrc.js (legacy)\nmodule.exports = {\n  plugins: ['validate-filename'],\n  rules: {\n    'validate-filename/naming-rules': ['error', {\n      rules: [\n        { case: 'pascal', target: '**/components/**' },\n        { case: 'camel', target: '**/hooks/**', patterns: '^use' }\n      ]\n    }],\n    'validate-filename/limit-extensions': ['error', {\n      rules: [\n        { target: '**/hooks/**', extensions: ['.ts', '.tsx'] }\n      ]\n    }]\n  }\n};\n\n// eslint.config.js (flat config)\nimport validateFilename from 'eslint-plugin-validate-filename';\nexport default [\n  {\n    plugins: { 'validate-filename': validateFilename },\n    rules: {\n      'validate-filename/naming-rules': ['error', {\n        rules: [\n          { case: 'pascal', target: '**/components/**' },\n          { case: 'camel', target: '**/hooks/**', patterns: '^use' }\n        ]\n      }],\n      'validate-filename/limit-extensions': ['error', {\n        rules: [\n          { target: '**/hooks/**', extensions: ['.ts', '.tsx'] }\n        ]\n      }]\n    }\n  }\n];","lang":"javascript","description":"Configure eslint-plugin-validate-filename with naming-rules and limit-extensions in both legacy and flat ESLint configs."},"warnings":[{"fix":"Use import validateFilename from 'eslint-plugin-validate-filename'; and set plugins: { 'validate-filename': validateFilename }.","message":"ESLint v9 requires flat config; plugin must be imported as object.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Explicitly set 'case' to required value if case enforcement is intended.","message":"Rule naming-rules 'case' property is optional since v1.2.0; if omitted, no case enforcement occurs.","severity":"deprecated","affected_versions":">=1.2.0"},{"fix":"Use glob patterns such as '**/schemas/**'.","message":"limit-extensions 'target' expects a glob pattern, not a regex; common mistake using regex like '/schemas/'.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"For literal '.' use '\\\\.' in regex patterns.","message":"Patterns in naming-rules are regular expressions, not glob; ensure proper escaping.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade Node.js to version 18.18.0 or later.","message":"Node.js >=18.18.0 required starting from v1.0.0.","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":"Ensure plugin is registered: in flat config use plugins: { 'validate-filename': validateFilename }.","cause":"Plugin not added to plugins array or incorrectly configured in flat config.","error":"ESLint: Error while loading rule 'validate-filename/naming-rules': Rule is not found"},{"fix":"Run 'npm install --save-dev eslint-plugin-validate-filename'.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'eslint-plugin-validate-filename'"},{"fix":"Use one of: camel, pascal, snake, kebab, flat.","cause":"Typo or unsupported case value.","error":"Invalid option 'case' - must be one of camel, pascal, snake, kebab, flat"},{"fix":"Use proper glob patterns like '**/components/**'.","cause":"target uses regex or invalid glob syntax.","error":"target is not a valid glob pattern"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}