Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sindresorhus/eslint-plugin-unicorn/llms.txt

Use this file to discover all available pages before exploring further.

Inconsistent filename casing makes it harder to navigate a codebase and can cause problems on case-insensitive file systems. This rule enforces a single consistent case style across all linted files and requires file extensions to be lowercase.
Recommendedrecommended
Fixable
Suggestions
Files named index.js, index.mjs, index.cjs, index.ts, index.tsx, and index.vue are ignored by default. Characters other than a–z, A–Z, 0–9, -, and _ in the filename are also ignored. The default case style is kebabCase.
// fooBar.js — camelCase filename when kebabCase is required
export default function fooBar() {}

Configuration options

You can use either the case option (single style) or the cases option (allow multiple styles), but not both.

case

Type: string
Allowed values: "camelCase", "kebabCase", "snakeCase", "pascalCase"
Enforce a single case style.
"unicorn/filename-case": ["error", { "case": "kebabCase" }]

cases

Type: object Allow multiple case styles simultaneously. Set each allowed style to true.
"unicorn/filename-case": [
  "error",
  {
    "cases": {
      "camelCase": true,
      "pascalCase": true
    }
  }
]

ignore

Type: Array<string | RegExp>
Default: []
Filenames to skip. Strings are interpreted as regular expressions.
"unicorn/filename-case": [
  "error",
  {
    "case": "kebabCase",
    "ignore": ["^FOOBAR\\.js$", "^vendor"]
  }
]

multipleFileExtensions

Type: boolean
Default: true
When true (default), additional dot-separated segments like .test or .spec are treated as part of the file extension and are not subject to case enforcement.
// With "pascalCase" and multipleFileExtensions: false
// FooBar.test.js — "test" is checked against pascal case and fails
export default function fooBar() {}
Use cases instead of case when your project mixes component files (PascalCase) with utility files (kebab-case). React projects often allow both camelCase and pascalCase.

Build docs developers (and LLMs) love