From 2ae6beaf72b7460c3a5cfa4c0e61aa6c718d5129 Mon Sep 17 00:00:00 2001 From: Boris Petrov Date: Mon, 5 Dec 2022 19:10:38 +0200 Subject: [PATCH 1/2] Update events handled by `no-useless-passive` Check: https://github.com/ignasdamunskis/passive-events-support/blob/65879a4a57a01763c9a8a07a762f60a2ac268f53/src/utils.js#L24 --- docs/rules/no-useless-passive.md | 2 +- lib/rules/no-useless-passive.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/rules/no-useless-passive.md b/docs/rules/no-useless-passive.md index edf43ec0..52cff7c1 100644 --- a/docs/rules/no-useless-passive.md +++ b/docs/rules/no-useless-passive.md @@ -2,7 +2,7 @@ This rule disallows setting `passive: true` for events on which it will have no effect. -Events where `passive: true` has an effect are: `touchstart`, `touchmove`, `wheel`, and `mousewheel`. +Events where `passive: true` has an effect are: `touchstart`, `touchmove`, `touchenter`, `touchend`, `touchleave`, `wheel`, and `mousewheel`. ## Rule Details diff --git a/lib/rules/no-useless-passive.js b/lib/rules/no-useless-passive.js index d53b2047..5fd8dc18 100644 --- a/lib/rules/no-useless-passive.js +++ b/lib/rules/no-useless-passive.js @@ -1,4 +1,12 @@ -const passiveEventListenerNames = new Set(['touchstart', 'touchmove', 'wheel', 'mousewheel']) +const passiveEventListenerNames = new Set([ + 'touchstart', + 'touchmove', + 'touchenter', + 'touchend', + 'touchleave', + 'wheel', + 'mousewheel' +]) const propIsPassiveTrue = prop => prop.key && prop.key.name === 'passive' && prop.value && prop.value.value === true From 99d4276962092d00fbfe8a39881a9eff8ec3b19a Mon Sep 17 00:00:00 2001 From: Boris Petrov Date: Mon, 5 Dec 2022 19:33:12 +0200 Subject: [PATCH 2/2] Update events handled by `require-passive-events` --- docs/rules/require-passive-events.md | 2 +- lib/rules/require-passive-events.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/rules/require-passive-events.md b/docs/rules/require-passive-events.md index e94eca86..aa01b545 100644 --- a/docs/rules/require-passive-events.md +++ b/docs/rules/require-passive-events.md @@ -1,6 +1,6 @@ # Require Passive Events -This rule enforces adding `passive: true` to high frequency event listeners (`touchstart`, `touchmove`, `wheel`, `mousewheel`). +This rule enforces adding `passive: true` to high frequency event listeners (`touchstart`, `touchmove`, `touchenter`, `touchend`, `touchleave`, `wheel`, `mousewheel`). ## Rule Details diff --git a/lib/rules/require-passive-events.js b/lib/rules/require-passive-events.js index bce8787b..5e6314db 100644 --- a/lib/rules/require-passive-events.js +++ b/lib/rules/require-passive-events.js @@ -1,4 +1,12 @@ -const passiveEventListenerNames = new Set(['touchstart', 'touchmove', 'wheel', 'mousewheel']) +const passiveEventListenerNames = new Set([ + 'touchstart', + 'touchmove', + 'touchenter', + 'touchend', + 'touchleave', + 'wheel', + 'mousewheel' +]) const propIsPassiveTrue = prop => prop.key && prop.key.name === 'passive' && prop.value && prop.value.value === true