Package Exports
- eslint-plugin-observers
- eslint-plugin-observers/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-observers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
eslint-plugin-observers
ESLint plugin for preventing memory leaks around observers (ResizeObserver, IntersectionObserver, MutationObserver)
Installation
You'll first need to install ESLint:
npm | yarn | pnpm |
---|---|---|
npm i eslint -D |
yarn add eslint -D |
pnpm add eslint -D |
Next, install eslint-plugin-observers
:
npm | yarn | pnpm |
---|---|---|
npm i eslint-plugin-observers -D |
yarn add eslint-plugin-observers -D |
pnpm add eslint-plugin-observers -D |
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-observers
globally.
Usage
Add observers
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["observers"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"observers/no-missing-unobserve-or-disconnect": "error",
"observers/matching-unobserve-target": "error",
}
}
or
You can use our "recommended" settings which enables most of the rules for you
{
"extends": ["plugin:observers/recommended"]
}
We also support a "strict" settings which enabled all of the rules for you
{
"extends": ["plugin:observers/strict"]
}
Rule Documentation
Credits
This package is based on eslint-plugin-listeners, most of the functions were reused or based on functions used in eslint-plugin-listeners. Because of that, this plugin deserves a lot of credit.