Skip to content

no-await-sync-query reports error on my getBy* function #634

@razbensimon

Description

@razbensimon

Have you read the Troubleshooting section?

Yes

Plugin version

v5.6.0

ESLint version

v7.32.0

Node.js version

v16.10.0

package manager and version

pnpm v6.16.0

Operating system

macOS Monterey, version 12.3.1

Bug description

no-await-sync-query yells on unrelated testing-library code.

Steps to reproduce

  1. enable the rule
  2. create getBySomething function
  3. call the new getBySomething function

Error output/screenshots

  1. image
135:41  error  `getById` query is sync so it does not need to be awaited  testing-library/no-await-sync-query
  1. image

  2. also tried to create a new method
    image

ESLint configuration

{
	"plugins": [
		"jest",
		 // ...
		"testing-library",
		"jest-dom"
	],
	"extends": [
		// ...
		"plugin:testing-library/react",
		"plugin:jest-dom/recommended"
	],
	"rules": {
		// ...
		"testing-library/no-await-sync-events": "error",
		"testing-library/no-global-regexp-flag-in-query": "error",
		"testing-library/no-manual-cleanup": "error",
		"testing-library/prefer-explicit-assert": "error",
		"testing-library/prefer-user-event": "error",
		"testing-library/no-render-in-setup": "off",
		"testing-library/render-result-naming-convention": "off"
	}
}

Rule(s) affected

no-await-sync-query

Anything else?

No response

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

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions