-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Package breaks when using import assertions #270
Comments
After upgraded to prettier 3.1.1, the error message is changed from |
We need to allow passing the
If the |
Another requirement is to bump prettier-plugin-sort-imports/package.json Line 36 in 61d0697
|
@trivago/prettier-plugin-sort-imports does not yet support import assertions. See: trivago/prettier-plugin-sort-imports#270
I have the same problem. I tried to fiddle but the Babel parser |
You can use |
Is there any solution to this, even just a way to make a prettier lint check or in-IDE check not fail? I tried I need to have this because I'm importing some JSON into a Playwright test and it can't handle it without the assert for some reason. |
it is not working |
Your Environment
Describe the bug
When running prettier against the import assertion syntax,
(
import X from 'y' assert { type: 'json' }
)both using the new
with
and the deprecatedassert
keywords,the passing breaks for the given file.
This is especially problematic because newer node versions require the assertion to be present when running under esm otherwise
the application will throw runtime exceptions, if not running through a bundler first
ERR_IMPORT_ASSERTION_TYPE_MISSING
.To Reproduce
prettier-plugin-import-attributes-issue.zip
npm install && npm run prettier
Notes:
.prettierrc.cjs
Expected behavior
Import assertions should not break the parsing.
Screenshots, code sample, etc
Configuration File (.prettier.cjs)
Error log
The text was updated successfully, but these errors were encountered: