Skip to content

userEvent.hover returns a promise - no-await-sync-events vs no-floating-promises reasoning #804

Closed
@mkosir

Description

@mkosir

Have you read the Troubleshooting section?

Yes

Plugin version

v6.0.0

ESLint version

v8.47.0

Node.js version

18.17.1

package manager and version

npm 9.6.7

Operating system

macOS Ventura, version 13.5.1

Bug description

For userEvent.hover no-await-sync-events rule reports that it's a sync event, from what I assume the typings could be wrong?
image

Not sure how much benefits does no-await-sync-events rule brings, since we already have no-floating-promises from typescript-eslint package.

When await keyword is being removed, no-floating-promises rule of course fails since type definition is indicating that hover function is returning a promise.

Steps to reproduce

  • clone the repo
  • run npm i
  • run npm run lint -> no error
  • In package.json upgrade eslint-plugin-testing-library to v6.0.0
  • run npm i
  • run npm run lint -> error

Error output/screenshots

image

If we remove await
image

ESLint configuration

"rules": {
    "@typescript-eslint/no-floating-promises": "error"
  }

Rule(s) affected

https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-await-sync-events.md

Anything else?

No response

Do you want to submit a pull request to fix this bug?

No

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions