Registry / testing / eslint-plugin-filenames

eslint-plugin-filenames

JSON →
library1.3.2jsnpmunverified

An ESLint plugin that enforces consistent filenames for JavaScript files. Current stable version is 1.3.2 (last updated 2019). It provides three rules: `match-regex` for custom regex patterns, `match-exported` to align filename with the default export, and `no-index` to disallow `index.js` files. The plugin only lints `.js` and `.jsx` files that ESLint processes. Unlike alternatives like `eslint-plugin-filenames-simple` or `eslint-plugin-unicorn`'s filename rule, this one is lightweight and focused, but note it is not actively maintained.

npm install eslint-plugin-filenames
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-FILE
E
eslint-plugin-filenames
testingjavascriptv1.3.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

plugin
✓ plugins: ['filenames'] in .eslintrc
✗ require('eslint-plugin-filenames') without registering
This is an ESLint plugin, not an importable module in code. Register it in your ESLint config under 'plugins'.
match-regex
✓ rules: { 'filenames/match-regex': [2, '^[a-z_]+$'] }
✗ rules: { 'filenames/match-regex': 'error' } (missing array)
The rule accepts an array with regex pattern and optional boolean for ignoring exported files.
match-exported
✓ rules: { 'filenames/match-exported': 2 }
✗ rules: { 'filenames/match-exported': [2, 'camel'] } (transform names are lowercase strings, e.g. 'camel', 'kebab')
Transform parameter can be a string, an array of strings/null, or omitted. Use null for no transform.
no-index
✓ rules: { 'filenames/no-index': 2 }
✗ rules: { 'filenames/no-index': 'error' } (should be numeric severity)
Simple rule; no options. Just set severity.
all rules
✓ const plugin = require('eslint-plugin-filenames'); plugin.rules
✗ import plugin from 'eslint-plugin-filenames' (ESM not supported)
This package is CommonJS only; ESM import may fail in Node.js without bundler.

Shows installation, ESLint configuration with all three rules, and a test that triggers match-regex.

// 1. Install the plugin and ESLint // npm install eslint eslint-plugin-filenames --save-dev // 2. Create .eslintrc.json: { "plugins": ["filenames"], "rules": { "filenames/match-regex": [2, "^[a-z_]+$"], "filenames/match-exported": [2, null, "\\.react$"], "filenames/no-index": 2 } } // 3. Create a file test-foo.js (not matching regex) and run: // npx eslint test-foo.js // Expected output: error: Filename does not match the naming convention (filenames/match-regex)
Debug
Known issues
gotchaPlugin only lints files that ESLint processes; non-JS/JSX files are ignored.
fix
Ensure all files you want to lint are included in ESLint's --ext or config.
affects: >=1.0.0
deprecatedPackage is no longer actively maintained; last release in 2019.
fix
Consider migrating to eslint-plugin-simple-filenames or eslint-plugin-unicorn's filename rule.
affects: >=1.3.0
gotchamatch-exported rule does not respect exported function calls; it only matches names of default exports.
fix
Use only default export patterns like function, class, or variable declarations.
affects: >=1.0.0
gotchamatch-exported with multiple transforms: use null for no transform (not omitted).
fix
Example: [2, [null, 'kebab', 'snake']] instead of [2, ['kebab', 'snake']].
affects: >=1.0.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-filenames"
Plugin is not installed or not in node_modules.
fix
Run npm install eslint-plugin-filenames --save-dev and ensure it's in the same directory as your .eslintrc.
Configuration for rule "filenames/match-regex" is invalid: Value [2, "^[a-z_]+$"] is not a valid severity.
Severity must be a number or string like 'error', not an array if not using options.
fix
Use a number for severity if no options: "filenames/match-regex": 2. If using options, keep array format but ensure first element is severity: [2, "^[a-z_]+$"].
Cannot read property 'match' of undefined
Plugin not properly registered; eslint cannot access rules.
fix
Add 'filenames' to the plugins array in your ESLint config.
Upgrade
Version history
1.3.2latest on npm
Audit
Dependencies
eslintrequiredpeer dependency; requires eslint >=1.0.0
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-filenames — npm install eslint-plugin-filenames · libregistry