eslint-plugin-ts-compat
v0.12.0
Published
Check browser compat base on TypeScript.
Downloads
14
Maintainers
Readme
eslint-plugin-ts-compat
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-list | Disable classList | ✅ | | | no-document-current-script | Disable document.currentScript. | ✅ | | | no-event-listener | Disable standard event | ✅ | | | no-event-timestamp | Disable Event.prototype.timeStamp | | | | no-function-length | Disable Function.prototype.length | ✅ | | | no-function-name | Disable Function.prototype.name | ✅ | | | no-regexp-flags | Disable RegExp.prototype.flags | ✅ | | | no-regexp-sticky | Disable regexp sticky | ✅ | | | no-regexp-unicode | Disable JavaScript built-in: RegExp: unicode | ✅ | | | no-string-index | Disable string index | ✅ | 🔧 | | no-symbol | Disable Symbol factory function. | ✅ | | | no-top-level-await | Disable Top-Level await. | ✅ | | | prefer-immuable-url | Prefer immuable url | ✅ | | | prefer-inner-text | Prefer .innerText | ✅ | 🔧 | | prefer-url-href | Prefer url href. | | 🔧 | | sealed-class | Prefer sealed class | | |