Linting on Node.js v22.8.0 led to the following ERR_IMPORT_ATTRIBUTE_MISSING error:
TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module "file:///home/runner/work/preflight/preflight/package.json" needs an import attribute of "type: json"
at validateAttributes (node:internal/modules/esm/assert:88:15)
at defaultLoad (node:internal/modules/esm/load:133:3)
at async ModuleLoader.load (node:internal/modules/esm/loader:567:7)
at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:442:45)
at async ModuleJob._link (node:internal/modules/esm/module_job:106:19)
ELIFECYCLE Command failed with exit code 2.
I needed to switch from the assert keyword to the with keyword in the dynamic import, because the "import assertions" proposal (using the assert keyword) changed to the "import attributes" proposal (using the with keyword).
The old "import assertions" proposal has been renamed to "import attributes" with the following major changes:
The keyword is now with instead of assert.
Unknown assertions cause an error rather than being ignored.
Linting on Node.js v22.8.0 led to the following
ERR_IMPORT_ATTRIBUTE_MISSING
error:I needed to switch from the
assert
keyword to thewith
keyword in the dynamic import, because the "import assertions" proposal (using theassert
keyword) changed to the "import attributes" proposal (using thewith
keyword).