Open cnhongwei opened 8 months ago
Your Environment
Describe the bug
format a file lingui.d.ts
lingui.d.ts
declare module "*.po" { const messages: { [key: string]: string; }; export { messages }; }
To Reproduce yarn prettier --write lingui.d.ts
[error] lingui.d.ts: SyntaxError: Export 'messages' is not defined. (5:11) [error] 1 | declare module "*.po" { [error] 2 | const messages: { [error] 3 | [key: string]: string; [error] 4 | }; [error] 5 | export { messages }; [error] 6 | } [error] 7 | error Command failed with exit code 2.
Using IDEA for formatting, the same error is obtained.
SyntaxError: Export 'messages' is not defined. (5:14) [0m [90m 1 |[39m declare module [32m"*.po"[39m {[0m [0m [90m 2 |[39m [36mconst[39m messages[33m:[39m {[0m [0m [90m 3 |[39m [key[33m:[39m string][33m:[39m string[33m;[39m[0m [0m [90m 4 |[39m }[33m;[39m[0m [0m [90m 5 |[39m [36mexport[39m { messages }[33m;[39m[0m [0m [90m 6 |[39m }[0m [0m [90m 7 |[39m[0m at instantiate (xxx/node_modules/@babel/parser/lib/index.js:63:32) at constructor (xxx/node_modules/@babel/parser/lib/index.js:358:12) at TypeScriptParserMixin.raise (xxx/node_modules/@babel/parser/lib/index.js:3255:19) at TypeScriptParserMixin.parseProgram (xxx/node_modules/@babel/parser/lib/index.js:12463:14) at TypeScriptParserMixin.parseTopLevel (xxx/node_modules/@babel/parser/lib/index.js:12450:25) at TypeScriptParserMixin.parse (xxx/node_modules/@babel/parser/lib/index.js:14345:10) at TypeScriptParserMixin.parse (xxx/node_modules/@babel/parser/lib/index.js:10024:18) at parse (xxx/node_modules/@babel/parser/lib/index.js:14386:38) at preprocessor (xxx/node_modules/@trivago/prettier-plugin-sort-imports/lib/src/preprocessors/preprocessor.js:15:34) at Object.defaultPreprocessor [as preprocess] (xxx/node_modules/@trivago/prettier-plugin-sort-imports/lib/src/preprocessors/default-processor.js:9:44)
Expected behavior
Able to format correctly.
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
{ "importOrder": [ "^react(\/[^\/]+)?$", "^react-dom(\/[^\/]+)?$", "^react-native(\/[^\/]+)?$", "^next(\/[^\/]+)?$", "", "^[./]" ], "importOrderSeparation": true, "importOrderSortSpecifiers": true, "importOrderGroupNamespaceSpecifiers": true, "xmlWhitespaceSensitivity": "ignore" }
Same as https://github.com/trivago/prettier-plugin-sort-imports/issues/213
Your Environment
Describe the bug
format a file
lingui.d.ts
To Reproduce yarn prettier --write lingui.d.ts
Using IDEA for formatting, the same error is obtained.
Expected behavior
Able to format correctly.
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
{ "importOrder": [ "^react(\/[^\/]+)?$", "^react-dom(\/[^\/]+)?$", "^react-native(\/[^\/]+)?$", "^next(\/[^\/]+)?$", "",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderGroupNamespaceSpecifiers": true,
"xmlWhitespaceSensitivity": "ignore"
}