Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 876 Bytes

filenames-match-regex.md

File metadata and controls

45 lines (30 loc) · 876 Bytes

Ensure filenames match a regex naming convention (github/filenames-match-regex)

Rule Details

Rule to ensure that filenames match a convention, with a default of kebab case or camelCase with one hump for flat config.

👎 Examples of incorrect filename for this default rule:

  • fileNameRule.js

👍 Examples of correct code for this rule:

  • fileName.js
  • file-name.js

Options

regex - Regex to match the filename structure. Defaults to kebab case or camelCase with one hump.

Default:

{
  "filenames-match-regex": [
    "error"
  ]
}

If you want to add custom regex such as matching all camelCase, add the regex as a string. For example, for camelCase it would look like:

{
  "filenames-match-regex": [
    "error",
    "^([a-z0-9]+)([A-Z][a-z0-9]+)*$"
  ]
}

Version

4.3.2