-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Labels
awaiting responseWaiting for a reply from the OPWaiting for a reply from the OPwontfixThis will not be worked onThis will not be worked on
Description
Plugin version
4.6.0
ESLint version
7.17.0
Node.js version
12.13.1
npm/yarn version
6.12.1
Operating system
macOS Catalina, Version 10.15.7
Bug description
Related to: #122
We're running into a false positive from this rule triggering outside of test files. In particular, it seems to match on any async function that starts with getBy*
, regardless of whether the function is from testing-library
.
Steps to reproduce
- Run ESLint as configured against the following file:
const getBytes = async () => Promise.resolve("myData");
export const doSomething = async () => {
const bytes = await getBytes();
console.log("Doing something to", bytes);
};
This applies to any other function that has the naming convention getBy*
. It's possible to rename the function for our use case, but I wouldn't expect the rule to trigger when this file doesn't use testing-library
.
Error output/screenshots
Output from running ESLint:
4:23 error `getBytes` query is sync so it does not need to be awaited testing-library/no-await-sync-query
ESLint configuration
module.exports = {
env: {
browser: true,
node: true,
},
extends: [],
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
},
plugins: [
"@typescript-eslint",
"import",
"jest",
"jsdoc",
"prefer-arrow",
"react",
"react-hooks",
"testing-library",
],
rules: {
"testing-library/no-await-sync-query": "error",
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
react: {
version: "detect",
},
},
};
Rule(s) affected
no-await-sync-query
Anything else?
#208 closed #122, which seems to have resolved this for await-async-query
, but it doesn't look like it changed no-await-sync-query
.
Do you want to submit a pull request to fix this bug?
No
Metadata
Metadata
Assignees
Labels
awaiting responseWaiting for a reply from the OPWaiting for a reply from the OPwontfixThis will not be worked onThis will not be worked on