I use eslint and tslint to help me avoid silly mistakes.
However, today, I made a mistake when declaring an event listener to catch uncaught promise rejections:
window.addEventListener('unhandledRejection', debugError)
The correct type is unhandledrejection
, not unhandledRejection
. I wasted a lot of time debugging this before I realized I had made a typo. Given the prevelance of camelCase in JS, I fear I will make the same mistake again.
Is there some way to lint this against known event types? I don’t use any custom events in my app.