# eslint-plugin-observers

> ESLint plugin for preventing memory leaks around observers (ResizeObserver, IntersectionObserver, MutationObserver)

Latest version **1.0.1** (published 2023-03-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-observers
pnpm add eslint-plugin-observers
yarn add eslint-plugin-observers
bun add eslint-plugin-observers
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-03-10 |
| First published | 2023-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.10.0 |
| Dependencies | 1 |
| Unpacked size | 44.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | German Quinteros |
| Maintainers | gquinteros93 |
| Keywords | eslint, eslint-plugin, eslintplugin, event, observers, ResizeObserver, IntersectionObserver, MutationObserver |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-observers
- Repository: https://github.com/gquinteros93/eslint-plugin-observers
- Issues: https://github.com/gquinteros93/eslint-plugin-observers/issues
- npm.io page: https://npm.io/package/eslint-plugin-observers

## Dependencies (1)

- [lodash.merge](https://npm.io/package/lodash.merge.md) 4.6.2

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-03-10
- 1.0.0 — 2023-03-09

## README

# eslint-plugin-observers

ESLint plugin for preventing memory leaks around observers ([ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver), [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API), [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver))


## Installation

### You'll first need to install [ESLint](http://eslint.org):

| 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:

```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"]
}
```

# Rule Documentation

- [no-missing-unobserve-or-disconnect](docs/rules/no-missing-unobserve-or-disconnect.md)
- [matching-unobserve-target](docs/rules/matching-unobserve-target.md)

# Credits
This package is based on [eslint-plugin-listeners](https://github.com/foad/eslint-plugin-listeners), most of the functions were reused or based on functions used in [eslint-plugin-listeners](https://github.com/foad/eslint-plugin-listeners). Because of that, this plugin deserves a lot of credit.

---
_Source: https://npm.io/package/eslint-plugin-observers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
