consistent-filename
Enforce filename casing consistency.
Targeted pattern scopeโ
This rule validates the current fileโs stem (filename without extension) against one configured casing format.
What this rule reportsโ
This rule reports a file when its stem is not already in the configured casing.
Supported casing formats:
camelCasekebab-case(default)PascalCase
Why this rule existsโ
Consistent file naming reduces navigation friction and prevents style drift across packages.
โ Incorrectโ
// filename: user_service.ts
export const value = 1;
// โ with default format "kebab-case"
โ Correctโ
// filename: user-service.ts
export const value = 1;
Deprecatedโ
- Lifecycle: Deprecated and frozen.
- Deprecated since:
v1.0.0 - Available until:
v2.0.0 - Use instead:
unicorn/filename-case
Behavior and migration notesโ
This rule is deprecated in favor of unicorn/filename-case.
It reports only and does not provide an autofix.
Optionsโ
type Options = [
{
format?: "camelCase" | "kebab-case" | "PascalCase";
},
];
Default:
{
format: "kebab-case";
}
Statusโ
Use the Deprecated section above for lifecycle details.
Additional examplesโ
// filename: dataLoader.ts
// โ
valid with { format: "camelCase" }
// filename: DataLoader.ts
// โ
valid with { format: "PascalCase" }
ESLint flat config exampleโ
import etcMisc from "eslint-plugin-etc-misc";
export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/consistent-filename": "error",
},
},
];
When not to use itโ
Disable this rule if your repository intentionally mixes naming styles by
directory or if you are already standardizing on unicorn/filename-case.
Package documentationโ
Rule catalog ID: R006
Further readingโ
Adoption resourcesโ
- Start at warning level in CI, then move to error after cleanup.
- Use focused codemods/autofix batches per package or directory.