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
Babel plugin importAttributes
can't be enabled and formatting fails
#15911
Comments
The version of @babel/parser and plugins you have installed has no effect on Prettier's output. Also import attributes syntax has been supported by Prettier 3.1.1. Can you reproduce on playground? Prettier 3.1.1 --parser typescript Input: import content from "./content.json" assert { type: "json" }; Output: import content from "./content.json" assert { type: "json" }; |
@sosukesuzuki I've made a reproduction repo: https://github.com/hdodov/mcve-prettier-import-attributes It appears that somehow @trivago/prettier-plugin-sort-imports is causing the issue. If I remove it from .prettierrc.json in the reproduction repo, everything works. Maybe the error message generated by Prettier is misleading? I can see that @fisker's PR is related to something like that. |
#15928 is hiding this kind of error message, since we don't read the babel config. |
Maybe caused by this line, can you open an issue there? |
FYI I found this issue first and fixed it for the plugin with this:
|
I'm trying to format a TypeScript file called index.ts with the following line inside:
…but I get the following error:
I tried adding a babel.config.json file containing the following:
…but it didn't work.
I also tried installing @babel/plugin-syntax-import-assertions and putting it in babel.config.json, .babelrc, .prettierrc.json as well, etc, but nothing seems to enable the plugin.
Environments:
npx prettier --write .
Steps to reproduce:
Try to format the aforementioned line with Prettier 3.1.1 and you'll see an error.
The text was updated successfully, but these errors were encountered: