Skip to content

Commit 6707e14

Browse files
author
Dmitry Drozdov
committed
feat(prefer-user-event): add support for React Native events
Closes #957
1 parent 657ed01 commit 6707e14

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

docs/rules/prefer-user-event.md

+3
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,6 @@ The following table lists all the possible equivalents from the low-level API `f
138138
| `pointerOut` | <ul><li>`unhover`</li></ul> |
139139
| `pointerOver` | <ul><li>`hover`</li><li>`selectOptions`</li><li>`deselectOptions`</li></ul> |
140140
| `pointerUp` | <ul><li>`click`</li><li>`dblClick`</li><li>`selectOptions`</li><li>`deselectOptions`</li></ul> |
141+
| `press` | <ul><li>`press`</li></ul> |
142+
| `scroll` | <ul><li>`scrollTo`</li></ul> |
143+
| `type` | <ul><li>`type`</li></ul> |

lib/rules/prefer-user-event.ts

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export const UserEventMethods = [
2424
'hover',
2525
'unhover',
2626
'paste',
27+
'press',
28+
'scrollTo',
2729
] as const;
2830
type UserEventMethodsType = (typeof UserEventMethods)[number];
2931

@@ -51,6 +53,9 @@ export const MAPPING_TO_USER_EVENT: Record<string, UserEventMethodsType[]> = {
5153
pointerOut: ['unhover'],
5254
pointerOver: ['hover', 'selectOptions', 'deselectOptions'],
5355
pointerUp: ['click', 'dblClick', 'selectOptions', 'deselectOptions'],
56+
press: ['press'],
57+
scroll: ['scrollTo'],
58+
type: ['type'],
5459
};
5560

5661
function buildErrorMessage(fireEventMethod: string) {

0 commit comments

Comments
 (0)