JSPM

eslint-plugin-listeners

1.4.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3661
  • Score
    100M100P100Q123134F
  • License MIT

ESLint plugin for preventing memory leaks around event listeners

Package Exports

  • eslint-plugin-listeners
  • eslint-plugin-listeners/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-listeners) 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-listeners

Test

This project aims to provide formatting rules to prevent memory leaks around event listeners

Installation

You'll first need to install ESLint:

$ yarn add eslint --dev

Next, install eslint-plugin-listeners:

$ yarn add eslint-plugin-listeners --dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-listeners globally.

Usage

Add listeners to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["listeners"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "listeners/no-missing-remove-event-listener": "error",
    "listeners/matching-remove-event-listener": "error",
    "listeners/no-inline-function-event-listener": "error"
  }
}

or

You can use our "recommended" settings which enables most of the rules for you

{
  "extends": ["plugin:listeners/recommended"]
}

We also support a "strict" settings which enables all of the rules for you

{
  "extends": ["plugin:listeners/strict"]
}

Rule Documentation

Credits

This package is based off of https://github.com/tipsi/eslint-plugin-tipsi