Custom rules for TSLint
Install as an npm devDependency. TypeScript and TSLint should also be installed.
npm install --save-dev typescript tslint @mcmath/tslint-rules
Include a tslint.json
file in your project and add "@mcmath/tslint-rules"
to
the "extends"
field. Custom rules can then be enabled under "rules"
.
{
"extends": ["@mcmath/tslint-rules"],
"rules": {
"enum-member-name": [true, "caps-case"]
}
}
Ensures enum
members follow a consistent naming convention.
This rule accepts a single string option. If no option is given, "pascal-case" is assumed.
Option | Attributes | Example |
---|---|---|
"pascal-case" | default | PascalCase |
"camel-case" | camelCase | |
"caps-case" | CAPS_CASE | |
"snake-case" | snake_case |
Ensures enum
identifiers follow a consistent naming convention.
This rule accepts a single string option. If no option is given, "pascal-case" is assumed.
Option | Attributes | Example |
---|---|---|
"pascal-case" | default | PascalCase |
"camel-case" | camelCase | |
"caps-case" | CAPS_CASE | |
"snake-case" | snake_case |
Copyright © 2017 Akim McMath. Licensed under the MIT License.