codemod-missing-await-act
Advanced tools
Changelog
0.3.0
#48 5898881
Thanks @eps1lon! - Add support for propagating through relative paths
The import config (from --import-config-path
) can now contain imports to absolute
paths prefixed as file URLs.
File URLs will be matched against relative imports.
Given this import config
import { render as render1 } from "file:///root/relative-paths/utils.js";
the import import { render } from './utils'
in /root/index.test.js
will be
considered as newly async and each call of render
will be awaited.
#49 00f35d5
Thanks @eps1lon! - Summarize follow-up items when codemod finished
When newly async functions are exported, the codemod will not automatically update all references. However, we now summarize at the end which files are impacted and generate an import config that can be used to update the remaining references if these are imported via relative imports. However, if these exports are imported via package specifiers or other path aliases, users need to manually adjust the import sources which is explained in the README.
#26 c74e8af
Thanks @eps1lon! - Ensure different import configs can be used during module lifetime
#32 eaefca3
Thanks @eps1lon! - Update Node.js support matrix
Codemod officially supports all currently Node.js versions listed in https://nodejs.org/en/about/previous-releases#release-schedule.
#30 25492dd
Thanks @eps1lon! - Add support for files using import assertions
E.g. import manifest from './package.json' assert { type: 'json' }
Changelog
0.2.0
#20 b22e5ff
Thanks @eps1lon! - Codemod React Native Testing Library by default
#14 408a664
Thanks @eps1lon! - Warn when a newly-async function is exported
This codemod can only propagate newly async methods within a file. Once a function is exported, we can't propagate that with a codemod. We'll later add support for configuring detection mechanisms. Once that is done, we'll instruct to rerun the codemod with updated configuration until no more warnings remain.
#19 4608966
Thanks @eps1lon! - Skip .d.mts
files
We already skiped .d.ts
and .d.cts
.
#15 3fd0c4e
Thanks @eps1lon! - Stop codemodding declaration files
#12 8625705
Thanks @eps1lon! - Consider import aliases
Previously, we didn't check if a call was from an import alias.
For example, given import { act as domAct } from '@testing-library/react'
, we didn't consider domAct
to be async
since we only looked for exports from @testing-library/dom
with the name act
.
Now we properly map renames.
#18 e844aba
Thanks @eps1lon! - Fix crash when import config used default imports
#17 fc70a45
Thanks @eps1lon! - Warn on newly async if exported direct
E.g. export function render() { act() }
used to not trigger warnings.
Only on export { render }
.
Now export ...
correctly triggers a warning if the exported value is now an async function.