Import Assertions to Attributes
This recipe converts import assertions (assert syntax) to the standardized import attributes (with syntax). It modifies code like:
ts
Usage
Run this codemod with:
sh
When is it useful?
The import assertions syntax is being deprecated in favor of the standardized import attributes syntax. This codemod helps transition existing codebases to the new syntax, ensuring compatibility with future versions of Node.js.
Node.js drop support of import assertions in favor of import attributes in version 22.0.0
But the support for import attributes was added in Node.js version 18.20.0