From eeab74a313448181f193f9b8b65b9fedc7c72406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Tue, 22 Aug 2023 14:45:53 +0200 Subject: [PATCH 1/9] feat(no-await-sync-events): disable user-event by default --- lib/rules/no-await-sync-events.ts | 54 ++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/lib/rules/no-await-sync-events.ts b/lib/rules/no-await-sync-events.ts index e9fa9b9d..4f7322ad 100644 --- a/lib/rules/no-await-sync-events.ts +++ b/lib/rules/no-await-sync-events.ts @@ -10,13 +10,28 @@ import { } from '../node-utils'; const USER_EVENT_ASYNC_EXCEPTIONS: string[] = ['type', 'keyboard']; -const VALID_EVENT_MODULES = ['fire-event', 'user-event'] as const; +const FIRE_EVENT_OPTION = 'fire-event' as const; +const USER_EVENT_OPTION = 'user-event' as const; +const VALID_EVENT_MODULES = [FIRE_EVENT_OPTION, USER_EVENT_OPTION]; export const RULE_NAME = 'no-await-sync-events'; export type MessageIds = 'noAwaitSyncEvents'; -type Options = [ - { eventModules?: readonly (typeof VALID_EVENT_MODULES)[number][] } -]; + +type ValidEventModules = (typeof VALID_EVENT_MODULES)[number]; +type EventModulesOptions = ReadonlyArray | ValidEventModules; +type Options = [{ eventModules?: EventModulesOptions }]; + +function getEnabledEventModules( + eventModulesOption?: EventModulesOptions | undefined +): ReadonlyArray { + if (typeof eventModulesOption === 'undefined') { + // This should match the default option + return [FIRE_EVENT_OPTION]; + } else if (typeof eventModulesOption === 'string') { + return [eventModulesOption]; + } + return eventModulesOption; +} export default createTestingLibraryRule({ name: RULE_NAME, @@ -25,9 +40,9 @@ export default createTestingLibraryRule({ docs: { description: 'Disallow unnecessary `await` for sync events', recommendedConfig: { - dom: 'error', - angular: 'error', - react: 'error', + dom: ['error', { eventModules: 'fire-event' }], + angular: ['error', { eventModules: 'fire-event' }], + react: ['error', { eventModules: 'fire-event' }], vue: false, marko: false, }, @@ -41,18 +56,22 @@ export default createTestingLibraryRule({ type: 'object', properties: { eventModules: { - type: 'array', - minItems: 1, - items: { - enum: VALID_EVENT_MODULES, - }, + default: FIRE_EVENT_OPTION, + oneOf: [ + { type: 'string', enum: VALID_EVENT_MODULES }, + { + type: 'array', + itmes: { type: 'string', enum: VALID_EVENT_MODULES }, + minItems: 1, + }, + ], }, }, additionalProperties: false, }, ], }, - defaultOptions: [{ eventModules: VALID_EVENT_MODULES }], + defaultOptions: [{ eventModules: FIRE_EVENT_OPTION }], create(context, [options], helpers) { const { eventModules = VALID_EVENT_MODULES } = options; @@ -90,6 +109,11 @@ export default createTestingLibraryRule({ }, 'AwaitExpression > CallExpression'(node: TSESTree.CallExpression) { const simulateEventFunctionIdentifier = getDeepestIdentifierNode(node); + const enabledEventModules = getEnabledEventModules(eventModules); + const isFireEventEnabled = + enabledEventModules.includes(FIRE_EVENT_OPTION); + const isUserEventEnabled = + enabledEventModules.includes(USER_EVENT_OPTION); if (!simulateEventFunctionIdentifier) { return; @@ -107,10 +131,10 @@ export default createTestingLibraryRule({ return; } - if (isFireEventMethod && !eventModules.includes('fire-event')) { + if (isFireEventMethod && !isFireEventEnabled) { return; } - if (isUserEventMethod && !eventModules.includes('user-event')) { + if (isUserEventMethod && !isUserEventEnabled) { return; } From 2259a86303bc0ce6fef7d0cc786d4807859da883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Tue, 22 Aug 2023 15:02:53 +0200 Subject: [PATCH 2/9] docs(no-await-sync-events): reflect user-event changes --- docs/rules/no-await-sync-events.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/rules/no-await-sync-events.md b/docs/rules/no-await-sync-events.md index 4c9e0519..5366053c 100644 --- a/docs/rules/no-await-sync-events.md +++ b/docs/rules/no-await-sync-events.md @@ -4,7 +4,7 @@ -Ensure that sync simulated events are not awaited unnecessarily. +Ensure that sync events are not awaited unnecessarily. ## Rule Details @@ -22,6 +22,12 @@ Some examples of simulating events not returning any Promise are: This rule aims to prevent users from waiting for those function calls. +> ⚠️ `fire-event` methods are async only on following Testing Library packages: +> +> - `@testing-library/vue` (supported by this plugin) +> - `@testing-library/svelte` (not supported yet by this plugin) +> - `@marko/testing-library` (supported by this plugin) + Examples of **incorrect** code for this rule: ```js @@ -87,13 +93,9 @@ const qux = async () => { This rule provides the following options: -- `eventModules`: array of strings. The possibilities are: `"fire-event"` and `"user-event"`. Defaults to `["fire-event", "user-event"]` - -### `eventModules` - -This option gives you more granular control of which event modules you want to report, so you can choose to only report methods from either `fire-event`, `user-event` or both. +- `eventModules`: string, or array of strings. Defines which event module should be linted for sync event methods. The possibilities are: `"fire-event"` and `"user-event"`. Defaults to `"fire-event"`. -Example: +### Example: ```js module.exports = { @@ -106,7 +108,11 @@ module.exports = { }; ``` +## When Not To Use It + +- `"fire-event"` option: should be disabled only for those Testing Library packages where fire-event methods are async. +- `"user-event"` option: should be disabled only if using v14 or greater. + ## Notes -- Since `user-event` v14 all its methods are async, so you should disable reporting them by setting the `eventModules` to just `"fire-event"` so `user-event` methods are not reported. -- There is another rule `await-async-events`, which is for awaiting async events for `user-event` v14 or `fire-event` only in Vue Testing Library. Please do not confuse with this rule. +There is another rule `await-async-events`, which is for awaiting async events for `user-event` v14 or `fire-event` only in Testing Library packages with async methods. Please do not confuse with this rule. From 424616c4f5cec9ea36a0b9ee88001916e7746548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Tue, 22 Aug 2023 16:26:05 +0200 Subject: [PATCH 3/9] test(no-await-sync-events): update test cases --- tests/lib/rules/no-await-sync-events.test.ts | 21 +++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/lib/rules/no-await-sync-events.test.ts b/tests/lib/rules/no-await-sync-events.test.ts index 8145138e..216ce0ff 100644 --- a/tests/lib/rules/no-await-sync-events.test.ts +++ b/tests/lib/rules/no-await-sync-events.test.ts @@ -219,6 +219,16 @@ ruleTester.run(RULE_NAME, rule, { `, options: [{ eventModules: ['fire-event'] }], })), + + // valid tests for user-event with default options (user-event disabled) + ...USER_EVENT_SYNC_FUNCTIONS.map((func) => ({ + code: ` + import userEvent from '@testing-library/user-event'; + test('should not report userEvent.${func} by default', async() => { + await userEvent.${func}('foo'); + }); + `, + })), ], invalid: [ @@ -254,6 +264,7 @@ ruleTester.run(RULE_NAME, rule, { await userEvent.${func}('foo'); }); `, + options: [{ eventModules: 'user-event' }], errors: [ { line: 4, @@ -277,7 +288,6 @@ ruleTester.run(RULE_NAME, rule, { await fireEvent.${func}('foo'); }); `, - options: [{ eventModules: ['fire-event'] }], errors: [ { line: 4, @@ -289,8 +299,7 @@ ruleTester.run(RULE_NAME, rule, { } as const) ) ), - // sync userEvent sync methods with await operator are not valid - // when only fire-event set in eventModules + ...USER_EVENT_SYNC_FUNCTIONS.map( (func) => ({ @@ -320,6 +329,7 @@ ruleTester.run(RULE_NAME, rule, { await userEvent.keyboard('foo'); }); `, + options: [{ eventModules: ['user-event'] }], errors: [ { line: 4, @@ -343,6 +353,7 @@ ruleTester.run(RULE_NAME, rule, { await userEvent.keyboard('foo', { delay: 0 }); }); `, + options: [{ eventModules: ['user-event'] }], errors: [ { line: 4, @@ -370,6 +381,7 @@ ruleTester.run(RULE_NAME, rule, { await renamedUserEvent.keyboard('foo', { delay: 0 }); }); `, + options: [{ eventModules: ['user-event', 'fire-event'] }], errors: [ { line: 6, @@ -397,6 +409,7 @@ ruleTester.run(RULE_NAME, rule, { await userEvent.type('foo', { delay }); } `, + options: [{ eventModules: ['user-event'] }], errors: [ { line: 3, @@ -414,6 +427,7 @@ ruleTester.run(RULE_NAME, rule, { await userEvent.type('foo', { delay, skipHover }); } `, + options: [{ eventModules: ['user-event'] }], errors: [ { line: 5, @@ -433,6 +447,7 @@ ruleTester.run(RULE_NAME, rule, { await userEvent.type('foo', { delay, skipHover }); } `, + options: [{ eventModules: ['user-event'] }], errors: [ { line: 7, From 33729aee166deec684ed0680051c019a9ce0de0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Tue, 22 Aug 2023 16:33:52 +0200 Subject: [PATCH 4/9] chore(no-await-sync-events): regenerate presets --- lib/configs/angular.ts | 5 ++++- lib/configs/dom.ts | 5 ++++- lib/configs/react.ts | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/configs/angular.ts b/lib/configs/angular.ts index 8defb66b..3a08b90d 100644 --- a/lib/configs/angular.ts +++ b/lib/configs/angular.ts @@ -11,7 +11,10 @@ export = { ], 'testing-library/await-async-queries': 'error', 'testing-library/await-async-utils': 'error', - 'testing-library/no-await-sync-events': 'error', + 'testing-library/no-await-sync-events': [ + 'error', + { eventModules: 'fire-event' }, + ], 'testing-library/no-await-sync-queries': 'error', 'testing-library/no-container': 'error', 'testing-library/no-debugging-utils': 'warn', diff --git a/lib/configs/dom.ts b/lib/configs/dom.ts index 3e5830ac..98ef9f1b 100644 --- a/lib/configs/dom.ts +++ b/lib/configs/dom.ts @@ -11,7 +11,10 @@ export = { ], 'testing-library/await-async-queries': 'error', 'testing-library/await-async-utils': 'error', - 'testing-library/no-await-sync-events': 'error', + 'testing-library/no-await-sync-events': [ + 'error', + { eventModules: 'fire-event' }, + ], 'testing-library/no-await-sync-queries': 'error', 'testing-library/no-global-regexp-flag-in-query': 'error', 'testing-library/no-node-access': 'error', diff --git a/lib/configs/react.ts b/lib/configs/react.ts index 538b4fc9..5849e9dd 100644 --- a/lib/configs/react.ts +++ b/lib/configs/react.ts @@ -11,7 +11,10 @@ export = { ], 'testing-library/await-async-queries': 'error', 'testing-library/await-async-utils': 'error', - 'testing-library/no-await-sync-events': 'error', + 'testing-library/no-await-sync-events': [ + 'error', + { eventModules: 'fire-event' }, + ], 'testing-library/no-await-sync-queries': 'error', 'testing-library/no-container': 'error', 'testing-library/no-debugging-utils': 'warn', From 0135b339b42811b4f4bf598c6ba7dbbc8a22c701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Wed, 23 Aug 2023 10:28:56 +0200 Subject: [PATCH 5/9] chore(no-await-sync-events): revert accepting string option --- docs/rules/no-await-sync-events.md | 2 +- lib/rules/no-await-sync-events.ts | 26 ++++++++------------ tests/lib/rules/no-await-sync-events.test.ts | 2 +- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/docs/rules/no-await-sync-events.md b/docs/rules/no-await-sync-events.md index 5366053c..8e953882 100644 --- a/docs/rules/no-await-sync-events.md +++ b/docs/rules/no-await-sync-events.md @@ -93,7 +93,7 @@ const qux = async () => { This rule provides the following options: -- `eventModules`: string, or array of strings. Defines which event module should be linted for sync event methods. The possibilities are: `"fire-event"` and `"user-event"`. Defaults to `"fire-event"`. +- `eventModules`: array of strings. Defines which event module should be linted for sync event methods. The possibilities are: `"fire-event"` and `"user-event"`. Defaults to `["fire-event"]`. ### Example: diff --git a/lib/rules/no-await-sync-events.ts b/lib/rules/no-await-sync-events.ts index 4f7322ad..512e803f 100644 --- a/lib/rules/no-await-sync-events.ts +++ b/lib/rules/no-await-sync-events.ts @@ -18,7 +18,7 @@ export const RULE_NAME = 'no-await-sync-events'; export type MessageIds = 'noAwaitSyncEvents'; type ValidEventModules = (typeof VALID_EVENT_MODULES)[number]; -type EventModulesOptions = ReadonlyArray | ValidEventModules; +type EventModulesOptions = ReadonlyArray; type Options = [{ eventModules?: EventModulesOptions }]; function getEnabledEventModules( @@ -27,9 +27,8 @@ function getEnabledEventModules( if (typeof eventModulesOption === 'undefined') { // This should match the default option return [FIRE_EVENT_OPTION]; - } else if (typeof eventModulesOption === 'string') { - return [eventModulesOption]; } + return eventModulesOption; } @@ -40,9 +39,9 @@ export default createTestingLibraryRule({ docs: { description: 'Disallow unnecessary `await` for sync events', recommendedConfig: { - dom: ['error', { eventModules: 'fire-event' }], - angular: ['error', { eventModules: 'fire-event' }], - react: ['error', { eventModules: 'fire-event' }], + dom: ['error', { eventModules: ['fire-event'] }], + angular: ['error', { eventModules: ['fire-event'] }], + react: ['error', { eventModules: ['fire-event'] }], vue: false, marko: false, }, @@ -56,22 +55,17 @@ export default createTestingLibraryRule({ type: 'object', properties: { eventModules: { - default: FIRE_EVENT_OPTION, - oneOf: [ - { type: 'string', enum: VALID_EVENT_MODULES }, - { - type: 'array', - itmes: { type: 'string', enum: VALID_EVENT_MODULES }, - minItems: 1, - }, - ], + type: 'array', + itmes: { type: 'string', enum: VALID_EVENT_MODULES }, + minItems: 1, + default: [FIRE_EVENT_OPTION], }, }, additionalProperties: false, }, ], }, - defaultOptions: [{ eventModules: FIRE_EVENT_OPTION }], + defaultOptions: [{ eventModules: [FIRE_EVENT_OPTION] }], create(context, [options], helpers) { const { eventModules = VALID_EVENT_MODULES } = options; diff --git a/tests/lib/rules/no-await-sync-events.test.ts b/tests/lib/rules/no-await-sync-events.test.ts index 216ce0ff..a7a93125 100644 --- a/tests/lib/rules/no-await-sync-events.test.ts +++ b/tests/lib/rules/no-await-sync-events.test.ts @@ -264,7 +264,7 @@ ruleTester.run(RULE_NAME, rule, { await userEvent.${func}('foo'); }); `, - options: [{ eventModules: 'user-event' }], + options: [{ eventModules: ['user-event'] }], errors: [ { line: 4, From 88bb6a9260edbe33d982930bde2b12fe7ce6bf09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Wed, 23 Aug 2023 10:31:31 +0200 Subject: [PATCH 6/9] chore(no-await-sync-events): regenerate presets --- lib/configs/angular.ts | 2 +- lib/configs/dom.ts | 2 +- lib/configs/react.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/configs/angular.ts b/lib/configs/angular.ts index 3a08b90d..270e4d48 100644 --- a/lib/configs/angular.ts +++ b/lib/configs/angular.ts @@ -13,7 +13,7 @@ export = { 'testing-library/await-async-utils': 'error', 'testing-library/no-await-sync-events': [ 'error', - { eventModules: 'fire-event' }, + { eventModules: ['fire-event'] }, ], 'testing-library/no-await-sync-queries': 'error', 'testing-library/no-container': 'error', diff --git a/lib/configs/dom.ts b/lib/configs/dom.ts index 98ef9f1b..ed568225 100644 --- a/lib/configs/dom.ts +++ b/lib/configs/dom.ts @@ -13,7 +13,7 @@ export = { 'testing-library/await-async-utils': 'error', 'testing-library/no-await-sync-events': [ 'error', - { eventModules: 'fire-event' }, + { eventModules: ['fire-event'] }, ], 'testing-library/no-await-sync-queries': 'error', 'testing-library/no-global-regexp-flag-in-query': 'error', diff --git a/lib/configs/react.ts b/lib/configs/react.ts index 5849e9dd..275a0c3a 100644 --- a/lib/configs/react.ts +++ b/lib/configs/react.ts @@ -13,7 +13,7 @@ export = { 'testing-library/await-async-utils': 'error', 'testing-library/no-await-sync-events': [ 'error', - { eventModules: 'fire-event' }, + { eventModules: ['fire-event'] }, ], 'testing-library/no-await-sync-queries': 'error', 'testing-library/no-container': 'error', From e6484f5d3a5e1ca9849458fdd8c77191c7d533e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Wed, 23 Aug 2023 15:03:36 +0200 Subject: [PATCH 7/9] fix: items typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michaël De Boey Signed-off-by: Mario Beltrán --- lib/rules/no-await-sync-events.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/no-await-sync-events.ts b/lib/rules/no-await-sync-events.ts index 512e803f..04acb084 100644 --- a/lib/rules/no-await-sync-events.ts +++ b/lib/rules/no-await-sync-events.ts @@ -56,7 +56,7 @@ export default createTestingLibraryRule({ properties: { eventModules: { type: 'array', - itmes: { type: 'string', enum: VALID_EVENT_MODULES }, + items: { type: 'string', enum: VALID_EVENT_MODULES }, minItems: 1, default: [FIRE_EVENT_OPTION], }, From 5da236cac0dd9082bab388112347ee504155cc07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Wed, 23 Aug 2023 16:30:27 +0200 Subject: [PATCH 8/9] refactor: extract default option --- lib/rules/no-await-sync-events.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/rules/no-await-sync-events.ts b/lib/rules/no-await-sync-events.ts index 04acb084..9a1d3e93 100644 --- a/lib/rules/no-await-sync-events.ts +++ b/lib/rules/no-await-sync-events.ts @@ -13,6 +13,7 @@ const USER_EVENT_ASYNC_EXCEPTIONS: string[] = ['type', 'keyboard']; const FIRE_EVENT_OPTION = 'fire-event' as const; const USER_EVENT_OPTION = 'user-event' as const; const VALID_EVENT_MODULES = [FIRE_EVENT_OPTION, USER_EVENT_OPTION]; +const DEFAULT_EVENT_MODULES = [FIRE_EVENT_OPTION]; export const RULE_NAME = 'no-await-sync-events'; export type MessageIds = 'noAwaitSyncEvents'; @@ -24,12 +25,7 @@ type Options = [{ eventModules?: EventModulesOptions }]; function getEnabledEventModules( eventModulesOption?: EventModulesOptions | undefined ): ReadonlyArray { - if (typeof eventModulesOption === 'undefined') { - // This should match the default option - return [FIRE_EVENT_OPTION]; - } - - return eventModulesOption; + return eventModulesOption ?? DEFAULT_EVENT_MODULES; } export default createTestingLibraryRule({ @@ -39,9 +35,9 @@ export default createTestingLibraryRule({ docs: { description: 'Disallow unnecessary `await` for sync events', recommendedConfig: { - dom: ['error', { eventModules: ['fire-event'] }], - angular: ['error', { eventModules: ['fire-event'] }], - react: ['error', { eventModules: ['fire-event'] }], + dom: ['error', { eventModules: DEFAULT_EVENT_MODULES }], + angular: ['error', { eventModules: DEFAULT_EVENT_MODULES }], + react: ['error', { eventModules: DEFAULT_EVENT_MODULES }], vue: false, marko: false, }, @@ -58,14 +54,14 @@ export default createTestingLibraryRule({ type: 'array', items: { type: 'string', enum: VALID_EVENT_MODULES }, minItems: 1, - default: [FIRE_EVENT_OPTION], + default: DEFAULT_EVENT_MODULES, }, }, additionalProperties: false, }, ], }, - defaultOptions: [{ eventModules: [FIRE_EVENT_OPTION] }], + defaultOptions: [{ eventModules: DEFAULT_EVENT_MODULES }], create(context, [options], helpers) { const { eventModules = VALID_EVENT_MODULES } = options; From afad834d3add641131b4debc3258291bded3b457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Thu, 24 Aug 2023 08:51:08 +0200 Subject: [PATCH 9/9] refactor: pr comments --- lib/rules/no-await-sync-events.ts | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/rules/no-await-sync-events.ts b/lib/rules/no-await-sync-events.ts index 9a1d3e93..989ddcda 100644 --- a/lib/rules/no-await-sync-events.ts +++ b/lib/rules/no-await-sync-events.ts @@ -22,12 +22,6 @@ type ValidEventModules = (typeof VALID_EVENT_MODULES)[number]; type EventModulesOptions = ReadonlyArray; type Options = [{ eventModules?: EventModulesOptions }]; -function getEnabledEventModules( - eventModulesOption?: EventModulesOptions | undefined -): ReadonlyArray { - return eventModulesOption ?? DEFAULT_EVENT_MODULES; -} - export default createTestingLibraryRule({ name: RULE_NAME, meta: { @@ -64,7 +58,7 @@ export default createTestingLibraryRule({ defaultOptions: [{ eventModules: DEFAULT_EVENT_MODULES }], create(context, [options], helpers) { - const { eventModules = VALID_EVENT_MODULES } = options; + const { eventModules = DEFAULT_EVENT_MODULES } = options; let hasDelayDeclarationOrAssignmentGTZero: boolean; // userEvent.type() and userEvent.keyboard() are exceptions, which returns a @@ -99,11 +93,6 @@ export default createTestingLibraryRule({ }, 'AwaitExpression > CallExpression'(node: TSESTree.CallExpression) { const simulateEventFunctionIdentifier = getDeepestIdentifierNode(node); - const enabledEventModules = getEnabledEventModules(eventModules); - const isFireEventEnabled = - enabledEventModules.includes(FIRE_EVENT_OPTION); - const isUserEventEnabled = - enabledEventModules.includes(USER_EVENT_OPTION); if (!simulateEventFunctionIdentifier) { return; @@ -121,10 +110,10 @@ export default createTestingLibraryRule({ return; } - if (isFireEventMethod && !isFireEventEnabled) { + if (isFireEventMethod && !eventModules.includes(FIRE_EVENT_OPTION)) { return; } - if (isUserEventMethod && !isUserEventEnabled) { + if (isUserEventMethod && !eventModules.includes(USER_EVENT_OPTION)) { return; }