prettier-plugin-sort-imports
prettier-plugin-sort-imports copied to clipboard
top level await
Your Environment
- Prettier version: 2.5.1
- node version [16.13.0]:
- package manager: [npm@8]
- IDE: [VScode]
Describe the bug
Top level await is considered a syntax error.
To Reproduce
- Create index.mjs with the following code:
await Promise.resolve();
console.log("hello");
- Install prettier and try to format file (everything should work).
- Install @trivago/prettier-plugin-sort-imports and try to format file (A syntax error message should appear).
Expected behavior
There should be no syntax error.
Screenshots, code sample, etc
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
Error log
[error] index.mjs: SyntaxError: 'await' is only allowed within async functions. (1:0)
[error] 1 | await Promise.resolve();
[error] 2 | console.log("hello");
[error] 3 |
Contribute to @trivago/prettier-plugin-sort-imports
- [ ] I'm willing to fix this bug 🥇
This issue is preventing us from adopting the tool
This is caused by the locked babel parser version #141 #147