43081j / eslint-plugin-lit

lit-html support for ESLint
120 stars 22 forks source link

Add rule to ensure scrolling event handlers are passively bound #93

Open stramel opened 3 years ago

stramel commented 3 years ago

This is a perf enhancement suggested by lighthouse.

When wheel, touchstart, mousewheel, touchmove, orscroll are bound in the template, they should utilize the passive: true property.

To achieve this, you could:

Tricky things to note, these 2 cases should pass:

https://web.dev/uses-passive-event-listeners/ https://github.com/GoogleChrome/lighthouse/blob/75735c6b2a2c13f0b92a0b9d00067235ffa21fcc/lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html#L273