1.0.1 • Published 2 years ago

@another_works/namelint v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

namelint

namelint is a tool that creates rules for code and file naming conventions and automatically detects them. The mission of this tool is to free you from the hassle of checking naming conventions in code reviews.

Installation and Usage

$ npm install namelint --save-dev

Place a file named namelint.json in the root folder

$ touch namelint.json
$ ./node_modules/.bin/namelint

Configuration

{
    "rules": [
        {
            "dir": "src/consts",
            "test": [
                {
                  "type": "namespace",
                  "regex": ".+Consts$"
                },
                {
                    "type": "filename",
                    "regex": ".+Consts.ts$"
                },
                {
                    "type": "filenameInCode"
                }
            ]
        }
    ]
}
  • "dir" is target directory
  • "test" is Inspection Items
  • "type" is filename or classname or namespace or functionname or filenameInCode
  • "regex" is regular expression text

Type

filename

Check if the filename matches the regex.

classname

Check if the classname matches the regex.

namespace

Check if the namespace matches the regex.

functionname

Check if the functionname matches the regex.

filenameInCode

Whether the file name is used in the code or not case-insensitive