ESLint plugin for preventing memory leaks around observers (ResizeObserver, IntersectionObserver, MutationObserver)
npm install eslint-plugin-observersESLint plugin for preventing memory leaks around observers (ResizeObserver, IntersectionObserver, MutationObserver)
| npm | yarn | pnpm |
| --- | ---- | ---- |
| npm i eslint -D | yarn add eslint -D | pnpm add eslint -D |
| 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.
Add observers to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
``json`
{
"plugins": ["observers"]
}
Then configure the rules you want to use under the rules section.
`json`
{
"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
`json`
{
"extends": ["plugin:observers/recommended"]
}
We also support a "strict" settings which enabled all of the rules for you
`json``
{
"extends": ["plugin:observers/strict"]
}
- no-missing-unobserve-or-disconnect
- matching-unobserve-target