0.0.9 • Published 1 year ago
eslint-plugin-compat-js v0.0.9
eslint-plugin-compat-js
Checks built-in methods compatibility. It uses browser-compat-data to determine incompatible method calls.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-compat-js
:
$ npm install eslint-plugin-compat-js --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-compat-js
globally.
Usage
Add compat-js
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["compat-js"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"compat-js/no-incompatible-builtins": 2
}
}
You can ignore certain built-ins, usually after adding a polyfill:
{
"settings": {
"compat-js-ignore": ["assign", "startsWith"]
}
}
Configure supported browsers in package.json
(see browserslist):
{
"browserslist": ["last 1 versions", "not ie <= 8"]
}
Contributing
Contributions are welcome! Just open an issues with any idea or pull-request if it is no-brainer. Make sure all tests and linting rules pass.