@bonniernews/eslint-plugin-typescript-rules

0.9.0 • Public • Published

Eslint plugin typescript rules

Tests

A plugin for enforcing some Javascript best practices when using Typescript as "typed" Javascript. This plugin can also be used together with Javascript to prevent the usage of Class extends.

Usage

Install eslint and the plugin npm i eslint eslint-plugin-typescript-rules --save-dev

Add typescript-rules to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["typescript-rules"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "typescript-rules/disallow-class-extends": "error",
    "typescript-rules/disallow-abstract-class": "error",
    "typescript-rules/disallow-non-es-compatible": "error"
  }
}

Recommended

This plugin exports a recommended configuration that includes all the rules enabled.

To enable this configuration use the extends property in your .eslintrc config file:

{
  "extends": [
    "eslint:recommended",
    "plugin:typescript-rules/recommended"
  ]
}

Rules

Name                       Description
disallow-abstract-class Prevent usage of abstract classes.
disallow-class-extends Prevent extending classes. Unless it's an Error class.
disallow-non-es-compatible Prevent usage of non EcmaScript compatible functionality when using Typescript, such as decorators, enums, private methods and properties.

License

Released under the MIT license.

Package Sidebar

Install

npm i @bonniernews/eslint-plugin-typescript-rules

Weekly Downloads

1,076

Version

0.9.0

License

MIT

Unpacked Size

8.47 kB

Total Files

7

Last publish

Collaborators

  • erandersson
  • daghall
  • andreas.samuelsson
  • norla
  • mattiasobn
  • chrissode
  • jzachrisson
  • hilleso
  • adam.hakansson
  • amundsentb
  • jonaek
  • drgeobn
  • mikael.mattsson
  • morre
  • takolander
  • vitryssen
  • herbola
  • nifo
  • johark
  • aliceboberg
  • varneynz
  • gusliden
  • mxtr
  • karlbergc
  • martindanielson
  • joelekman
  • chavah
  • matsrorbecker
  • axeljohanssonbonniernews
  • markusn
  • linuss
  • joelabrahamsson
  • jonaswalden
  • indeedshouts
  • marcusgronblad