Plugin does not support TypeScript `using` keyword
valtyr opened this issue · 1 comments
valtyr commented
Your Environment
- Prettier version: 3.2.5
- node version v20.11.0
- package manager: pnpm@8.6.10
- IDE: VScode
Describe the bug
The plugin does not support the explicit resource management using
keyword in TypeScript.
To Reproduce
using foo = 'bar';
Expected behavior
I expected the plugin to support this syntax. It seems like the version of Babel that the plugin uses does not, without enabling a specific configuration flag.
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
{
"tabWidth": 2,
"singleQuote": true,
"bracketSameLine": true,
"trailingComma": "all",
"importOrder": [
"^(react|react-native)$",
"<THIRD_PARTY_MODULES>",
"^@/components/.*$",
"^@/.*$",
"^@euler/.*$",
"^@api/.*$",
"^~/.*$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"plugins": [
"@trivago/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss"
]
}
Error log
[error] apps/api/src/worker.ts: SyntaxError: This experimental syntax requires enabling the parser plugin: explicitResourceManagement". (40:4)
Contribute to @trivago/prettier-plugin-sort-imports
- I'm willing to fix this bug 🥇
valtyr commented
Just realized that you already expose the plugins as a config variable. Solved by updating my prettier config to include this:
"importOrderParserPlugins": [
"typescript",
"jsx",
"explicitResourceManagement"
],