1.0.7 • Published 2 years ago
eslint-plugin-ts-custom-rules v1.0.7
eslint-plugin-ts-js-custom-rules
Some custom rules to apply to typescript.
- function-in-alpha-order - Allows checking that functions are in alpha order in a module or class
- no-throw-with-error - Disallow throw with Error - must sub-class Error
- throw-error-with-new - Indicates whether a throw of Error is used with a new (ie. throw new Error)
Installation
You'll first need to install ESLint:
npm i eslint --save-devNext, install eslint-plugin-ts-custom-rules:
npm install pick68/eslint-plugin-ts-custom-rules --save-devUsage
Add ts-custom-rules to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"eslint-plugin-ts-custom-rules"
]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"ts-custom-rules/throw-error-with-new": "warn",
"ts-custom-rules/no-throw-with-error": "warn",
"ts-custom-rules/functions-in-alpha-order": "warn",
}
}