Rule: file-name-casing
Enforces a consistent file naming convention
Rationale
Helps maintain a consistent style across a file hierarchy
Config
One of the following arguments must be provided:
camel-case
: File names must be camel-cased:fileName.ts
.pascal-case
: File names must be Pascal-cased:FileName.ts
.kebab-case
: File names must be kebab-cased:file-name.ts
.snake-case
: File names must be snake-cased:file_name.ts
.ignore
: File names are ignored (useful for the object configuration).
Or an object, where the key represents a regular expression that matches the file name, and the value is the file name rule from the previous list.
- { “.tsx”: “pascal-case”, “.ts”: “camel-case” }
Config examples
"file-name-casing": [true, "camel-case"]
"file-name-casing": [true, "pascal-case"]
"file-name-casing": [true, "kebab-case"]
"file-name-casing": [true, "snake-case"]
"file-name-casing": [true, {".tsx": "pascal-case", ".ts": "camel-case"}]
"file-name-casing": [true, {".style.ts": "kebab-case", ".tsx": "pascal-case", ".*": "camel-case"}]
"file-name-casing": [true, {".ts": "ignore", ".tsx": "pascal-case"}]
Schema
{ "type": "array", "items": { "anyOf": [ { "type": "array", "items": [ { "type": "string", "enum": [ "camel-case", "ignore", "pascal-case", "kebab-case", "snake-case" ] } ] }, { "type": "object", "additionalProperties": { "type": "string", "enum": [ "camel-case", "ignore", "pascal-case", "kebab-case", "snake-case" ] }, "minProperties": 1 } ] } }