0.15.0 • Published 5 months ago

eslint-plugin-ts-compat v0.15.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

eslint-plugin-ts-compat

npm version Build Status License

This is a eslint-plugin to check browser compat base on TypeScript.

  • You can ban some code even Babel and Polyfills could not solve.
  • Use Typescript for type check.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-ts-compat:

npm install eslint-plugin-ts-compat --save-dev

Usage

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

{
    "plugins": ["ts-compat"],
    "parser": "@typescript-eslint/parser",
}

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

{
    "rules": {
        "ts-compat/no-regexp-flags": 2
    }
}

This plugin exports a recommended config that enforces good practices.

{
    "extends": [
        "plugin:ts-compat/recommended"
    ]
}

Support a browserslist configuration to preset rules.

{
    "extends": [
        "plugin:ts-compat/browserslist"
    ]
}

Rules

💼 Configurations enabled in.\ ✅ Set in the recommended configuration.\ 🔧 Automatically fixable by the --fix CLI option.

Name                      Description💼🔧
no-class-listDisable classList
no-date-parseNot allow parse date string.
no-document-current-scriptDisable document.currentScript.
no-event-listenerDisable standard event
no-event-timestampDisable Event.prototype.timeStamp
no-function-lengthDisable Function.prototype.length
no-function-nameDisable Function.prototype.name
no-regexp-flagsDisable RegExp.prototype.flags
no-regexp-stickyDisable regexp sticky
no-regexp-unicodeDisable JavaScript built-in: RegExp: unicode
no-regexp-unicode-setsDisable JavaScript built-in: RegExp: unicodeSet
no-string-indexDisable string index🔧
no-symbolDisable Symbol factory function.
no-timer-args-exceedNot allow using the third argument of setTimeout & setInterval.
no-top-level-awaitDisable Top-Level await.
prefer-immuable-urlPrefer immuable url
prefer-inner-textPrefer .innerText🔧
prefer-url-hrefPrefer url href.🔧
sealed-classPrefer sealed class
0.15.0

5 months ago

0.14.0

8 months ago

0.13.0

8 months ago

0.12.0

1 year ago

0.11.0

1 year ago

0.10.0

1 year ago

0.6.0

1 year ago

0.5.0

1 year ago

0.4.1

2 years ago

0.4.0

2 years ago

0.1.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.0.0

2 years ago