{"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,"search_vec":"'1.2.0':17 '2025':19 'base':27 'cadenc':63 'camel':30 'case':28 'convent':14 'current':15 'differenti':48 'enforc':11,29 'eslint':2,6,21,65 'eslint-plugin-validate-filenam':1 'exampl':58 'exclus':38,53 'extens':41,46 'featur':23 'file':12 'filenam':5,66 'flat':34 'folder':26,51 'folder-bas':25 'includ':24 'integr':57 'javascript':64 'kebab':33 'limit':45 'limit-extens':44 'mainten':60 'maintenance-ori':59 'match':37 'name':13 'next.js':56 'orient':61 'pascal':31 'pattern':36,39 'per':50 'per-fold':49 'plugin':3,7 'regex':35 'releas':18,62 'rule':9,47,52 'snake':32 'support':20,54 'v7':22 'valid':4 'version':16 'via':43 'whitelist':42","created_at":"2026-04-25T11:20:38.320869+00:00","updated_at":"2026-04-25T11:20:38.320869+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/hiro08gh/eslint-plugin-validate-filename","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-validate-filename","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}}