eslint-plugin-ts-custom-rules

1.0.7 • Public • Published

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-dev

Next, install eslint-plugin-ts-custom-rules:

npm install pick68/eslint-plugin-ts-custom-rules --save-dev

Usage

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",
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i eslint-plugin-ts-custom-rules

Weekly Downloads

5

Version

1.0.7

License

MIT

Unpacked Size

20 kB

Total Files

8

Last publish

Collaborators

  • pick68