Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 883 Bytes

filenames-match-regex.md

File metadata and controls

47 lines (31 loc) · 883 Bytes

github/filenames-match-regex

📝 Require filenames to match a regex naming convention.

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