✅ This rule is part of the recommended config.
While EventEmitter is only available in Node.js, EventTarget is also available in Deno and browsers.
This rule reduces the bundle size and makes your code more cross-platform friendly.
See the differences between EventEmitter
and EventTarget
.
import EventEmitter from 'node:event';
class Foo extends EventEmitter {
}
const emitter = new EventEmitter;
class Foo extends EventTarget {
}
const target = new EventTarget;