CodeFactor appears to pick up incorrect dependency version #53758
Labels
scope: tools/scripts
Scripts for supporting dev work, generating config and build artifacts, etc.
status: waiting triage
This issue needs help from moderators and users to reproduce and confirm its validity and fix.
Describe the bug
I'm working on #53739, in which I added a new unit test with
testing-library
. The test uses theuserEvent.click()
method, which was flagged by CodeFactor for not usingasync/await
to handle the returned promise.Log: https://github.com/freeCodeCamp/freeCodeCamp/pull/53739/checks?check_run_id=21641281833
This is interesting because the ESLint rule that CodeFactor referenced (
testing-library/await-async-events
) is only available ineslint-plugin-testing-library
v6, but we are on v5. It's also worth noting that we have two versions ofeslint-plugin-testing-library
in our codebase, which I guess is a separate issue, but I don't think it's related to this one.freeCodeCamp/package.json
Line 137 in 6963489
freeCodeCamp/client/package.json
Line 187 in 6963489
Reproduction
I created #53757 as a POC.
I was able to reproduce the issue by:
userEvent.click()
As expected, CodeFactor failed with the same ESLint error: https://github.com/freeCodeCamp/freeCodeCamp/pull/53757/checks?check_run_id=21641461588.
I was able to bypass the check by disabling the ESLint rule. CodeFactor still flagged the issue (but why?), but it passed anyway: https://github.com/freeCodeCamp/freeCodeCamp/pull/53757/checks?check_run_id=21641486181.
Resolution
I'm not familiar with CodeFactor so I'm not sure if this is a problem on its end or on our end (and maybe the problem lies in the dependency tree of the
ui-components
project).As for #53739, the only solution I have to unblock it is to temporarily disable the
testing-library/await-async-events
rule. The rule is applicable only when we upgrade@testing-library/user-event
to v14 (we are on v13), becauseuserEvent.click()
becomes async in v14. Another option is to upgrade@testing-library/user-event
andeslint-plugin-testing-library
to the latest version first, then continue #53739 with necessary updates to the tests.References
eslint-plugin-testing-library
v6 changelog: https://github.com/testing-library/eslint-plugin-testing-library/releases/tag/v6.0.0testing-library/await-async-events
rule: https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-events.mdThe text was updated successfully, but these errors were encountered: