Registry / testing / eslint-plugin-validate-filename

eslint-plugin-validate-filename

JSON →
library1.2.0jsnpmunverified

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.

npm install eslint-plugin-validate-filename
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-VALI
E
eslint-plugin-validate-filename
testingjavascriptv1.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export
import validateFilename from 'eslint-plugin-validate-filename'
const validateFilename = require('eslint-plugin-validate-filename')
ESM-only; the plugin exports a single object with rules
rules
import { rules } from 'eslint-plugin-validate-filename'
Named export 'rules' contains all rule definitions
Plugin config
import validateFilename from 'eslint-plugin-validate-filename'; plugins: { 'validate-filename': validateFilename }
plugins: ['validate-filename'] // Not valid for flat config
In ESLint flat config, you must pass the plugin object, not a string

Configure eslint-plugin-validate-filename with naming-rules and limit-extensions in both legacy and flat ESLint configs.

// .eslintrc.js (legacy) module.exports = { plugins: ['validate-filename'], rules: { 'validate-filename/naming-rules': ['error', { rules: [ { case: 'pascal', target: '**/components/**' }, { case: 'camel', target: '**/hooks/**', patterns: '^use' } ] }], 'validate-filename/limit-extensions': ['error', { rules: [ { target: '**/hooks/**', extensions: ['.ts', '.tsx'] } ] }] } }; // eslint.config.js (flat config) import validateFilename from 'eslint-plugin-validate-filename'; export default [ { plugins: { 'validate-filename': validateFilename }, rules: { 'validate-filename/naming-rules': ['error', { rules: [ { case: 'pascal', target: '**/components/**' }, { case: 'camel', target: '**/hooks/**', patterns: '^use' } ] }], 'validate-filename/limit-extensions': ['error', { rules: [ { target: '**/hooks/**', extensions: ['.ts', '.tsx'] } ] }] } } ];
Debug
Known issues
breakingESLint v9 requires flat config; plugin must be imported as object.
fix
Use import validateFilename from 'eslint-plugin-validate-filename'; and set plugins: { 'validate-filename': validateFilename }.
affects: >=1.0.0
deprecatedRule naming-rules 'case' property is optional since v1.2.0; if omitted, no case enforcement occurs.
fix
Explicitly set 'case' to required value if case enforcement is intended.
affects: >=1.2.0
gotchalimit-extensions 'target' expects a glob pattern, not a regex; common mistake using regex like '/schemas/'.
fix
Use glob patterns such as '**/schemas/**'.
affects: >=0.0.0
gotchaPatterns in naming-rules are regular expressions, not glob; ensure proper escaping.
fix
For literal '.' use '\\.' in regex patterns.
affects: >=0.0.0
breakingNode.js >=18.18.0 required starting from v1.0.0.
fix
Upgrade Node.js to version 18.18.0 or later.
affects: >=1.0.0
Errors
Common errors & fixes
ESLint: Error while loading rule 'validate-filename/naming-rules': Rule is not found
Plugin not added to plugins array or incorrectly configured in flat config.
fix
Ensure plugin is registered: in flat config use plugins: { 'validate-filename': validateFilename }.
Cannot find module 'eslint-plugin-validate-filename'
Package not installed or not in node_modules.
fix
Run 'npm install --save-dev eslint-plugin-validate-filename'.
Invalid option 'case' - must be one of camel, pascal, snake, kebab, flat
Typo or unsupported case value.
fix
Use one of: camel, pascal, snake, kebab, flat.
target is not a valid glob pattern
target uses regex or invalid glob syntax.
fix
Use proper glob patterns like '**/components/**'.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency for ESLint plugin
Agent activity
8 hits · last 30 days
node
8
Resources
eslint-plugin-validate-filename — npm install eslint-plugin-validate-filename · libregistry