@hollowverse/validate-filenames

CLI for validating filenames in a directory according to customizable rules

Stats

StarsIssuesVersionUpdatedCreatedSize
@hollowverse/validate-filenames
203.0.23 years ago4 years agoMinified + gzip package size for @hollowverse/validate-filenames in KB

Readme

@hollowverse/validate-filenames Build Status

You can use this package to validate that the filenames in your git repository meet your validation rules.

Current validation rules are camelCase, PascalCase, and ignore.

Installation

yarn add @hollowverse/validate-filenames

Add as an npm script

In your package.json

{
  "scripts": {
    "validate-filenames": "validate-filenames"
  }
}

Usage

In a git-managed repo run:

yarn validate-filenames

When you do that, the tool will retrieve a list of all the filenames under git control and will validate them based on the rules that you have in your config file.

Config file

You can configure validate-filenames by dropping a file called validateFilenames.json or validateFilenames.js at the root of your repo.

validate-filenames can be configured as follows

{
  "rules": [
    {
      "validation": "camelCase",
      "patterns": ["**/*"]
    },
    {
      "validation": "ignore",
      "patterns": [
        "README.md",
        "Dockerfile",
        "LICENSE.md",
        "customTypings/*",
        "typings/*"
      ]
    }
  ]
}

If you're using the js version of the configurations, you need to export an object such as the above.

Notice that rules is an array. Each item in the array is an object with two properties: validation and patterns.

validation

validation can be one of three values: camelCase, PascalCase, or ignore.

patterns

patterns is an array of glob patterns that tells validate-filenames that the validation rule applies to files that fall within this glob pattern.

Rule order

The order of the rules matter. The last rule wins. This allows us to have general rules and override those general rules with specific rules for specific paths. In the example above, we're saying all filenames within our repo should be camelCased except for certain files which should be ignored.

For issues or questions

A lot of the above may very well not make much sense. So feel free to post issues or questions here:

https://github.com/hollowverse/hollowverse/issues

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.