ESLint plugin that provides rules to prevent memory leaks caused by event listeners that are not removed. Current stable version is 1.5.1, with infrequent releases. It checks for missing removeEventListener calls, mismatched add/remove listener functions, and inline function listeners. Unlike generic linting approaches, this plugin is purpose-built for event listener hygiene in JavaScript/TypeScript projects.
npm install eslint-plugin-listenersVerified import paths — ran on the pinned version, not inferred.
Quickstart showing installation, configuration, and a rule violation detection using the plugin.
Ensure addEventListener and removeEventListener calls are in the same function scope or use proper references.
Use the 'removeAllListeners' option in rule configuration to include removeAllListeners calls.
Upgrade to >=1.4.0 for proper TypeScript support.
Use static function references whenever possible; manually review dynamic cases.
Run `npm install --save-dev eslint-plugin-listeners` in the project directory.
Check rule configuration in .eslintrc; ensure it's an object with severity string (e.g., 'error') or array with options.
No dependency data recorded yet.