---
url: /docs/guide/usage/linter/rules/unicorn/filename-case.md
---

### What it does

Enforces a consistent case style for filenames to improve project organization and maintainability.
By default, `kebab-case` is enforced, but other styles can be configured.

Files named `index.js`, `index.ts`, etc. are exempt from this rule as they cannot reliably be
renamed to other casings (mainly just a problem with PascalCase).

### Why is this bad?

Inconsistent file naming conventions make it harder to locate files, navigate projects, and enforce
consistency across a codebase. Standardizing naming conventions improves readability, reduces cognitive
overhead, and aligns with best practices in large-scale development.

### Examples

Examples of **correct** filenames for each case:

#### `kebabCase`

* `some-file-name.js`
* `some-file-name.test.js`
* `some-file-name.test-utils.js`

#### `camelCase`

* `someFileName.js`
* `someFileName.test.js`
* `someFileName.testUtils.js`

#### `snakeCase`

* `some_file_name.js`
* `some_file_name.test.js`
* `some_file_name.test_utils.js`

#### `pascalCase`

* `SomeFileName.js`
* `SomeFileName.Test.js`
* `SomeFileName.TestUtils.js`

#### `lowercase`

Only rejects uppercase letters; separators are allowed.

* `somefilename.js`
* `some-file-name.js`
* `some_file_name.js`

#### `screamingSnakeCase`

* `SOME_FILE_NAME.js`
* `SOME_FILE_NAME.TEST.js`
* `SOME_FILE_NAME.TEST_UTILS.js`

## Configuration

This rule accepts a configuration object with the following properties:

### case

type: `"kebabCase" | "camelCase" | "snakeCase" | "pascalCase" | "lowercase" | "screamingSnakeCase"`

default: `null`

The case style to enforce for filenames.

You can set the `case` option like this:

```json
{
  "unicorn/filename-case": [
    "error",
    {
      "case": "kebabCase"
    }
  ]
}
```

### cases

type: `object`

default: `null`

The case style(s) to allow/enforce for filenames. `true` means the case style is allowed, `false` means it is banned.

You can set the `cases` option like this:

```json
{
  "unicorn/filename-case": [
    "error",
    {
      "cases": {
        "camelCase": true,
        "pascalCase": true
      }
    }
  ]
}
```

#### cases.camelCase

type: `boolean`

default: `false`

Whether camel case is allowed, e.g. `someFileName.js`.

#### cases.kebabCase

type: `boolean`

default: `false`

Whether kebab case is allowed, e.g. `some-file-name.js`.

#### cases.lowercase

type: `boolean`

default: `false`

Whether lowercase is allowed, e.g. `somefilename.js`.

#### cases.pascalCase

type: `boolean`

default: `false`

Whether pascal case is allowed, e.g. `SomeFileName.js`.

#### cases.screamingSnakeCase

type: `boolean`

default: `false`

Whether screaming snake case is allowed, e.g. `SOME_FILE_NAME.js`.

#### cases.snakeCase

type: `boolean`

default: `false`

Whether snake case is allowed, e.g. `some_file_name.js`.

### ignore

type: `string[]`

An array of regular expression patterns for filenames to ignore.

You can set the `ignore` option like this:

```json
{
  "unicorn/filename-case": [
    "error",
    {
      "ignore": ["^foo.*$"]
    }
  ]
}
```

### multipleFileExtensions

type: `boolean`

default: `true`

Whether to treat additional, `.`-separated parts of a filename as
parts of the extension rather than parts of the filename.

## How to use

## Version

This rule was added in v0.0.14.

## References
