useFilenamingConvention (since v1.5.0)
Diagnostic Category: lint/style/useFilenamingConvention
Inspired from: filename-case
Enforce naming conventions for JavaScript and TypeScript filenames.
Enforcing naming conventions helps to keep the codebase consistent.
A filename consists of two parts: a name and a set of consecutive extension.
For instance, my-filename.test.js has my-filename as name, and two consecutive extensions: .test and .js.
The name of a filename can start with a dot, be prefixed and suffixed by underscores _.
For example, .filename.js, __filename__.js, or even .__filename__.js.
By default, the rule ensures that the filename is either in camelCase, kebab-case, snake_case,
or equal to the name of one export in the file.
Options
Section titled OptionsThe rule provides two options that are detailed in the following subsections.
{ "//": "...", "options": { "strictCase": false, "enumMemberCase": ["camelCase", "export"] }}strictCase
Section titled strictCaseWhen this option is set to true, it forbids consecutive uppercase characters in camelCase.
For instance, when the option is set to true, agentID will throw an error.
This name should be renamed to agentId.
When the option is set to false, consecutive uppercase characters are allowed.
agentID is so valid.
Default: true
requireAscii
Section titled requireAsciiWhen this option is set to true, it forbids names that include non-ASCII characters.
For instance, when the option is set to true, café or 안녕하세요 will throw an error.
When the option is set to false, anames may include non-ASCII characters.
café and 안녕하세요 are so valid.
Default: false
This option will be turned on by default in Biome 2.0.
filenameCases
Section titled filenameCasesBy default, the rule enforces that the filename is either in camelCase, kebab-case, snake_case, or equal to the name of one export in the file.
You can enforce a stricter convention by setting filenameCases option.
filenameCases accepts an array of cases among the following cases: camelCase, kebab-case, PascalCase, snake_case, and export.