Open adam-marshall opened 2 years ago
I don't know what's the "correct" way to fix this issue. It is working for me with
"importOrderParserPlugins": ["typescript", "decorators-legacy"]
Just in case if somebody else stumbles over this bug.
I don't know what's the "correct" way to fix this issue. It is working for me with
"importOrderParserPlugins": ["typescript", "decorators-legacy"]
Just in case if somebody else stumbles over this bug.
Where did you define that?
Where did you define that?
In .prettierrc
I'm still seeing the SyntaxError: Decorators cannot be used to decorate parameters.
error, even with
importOrderParserPlugins: [
'typescript',
'classProperties',
'["decorators", { "version": "legacy" }]',
]
Any advice?
Actually, what I get is just error Parsing error: prettier/prettier
, on every instance of us using decorators on parameters, when running eslint
.
If I try to run prettier
directly, I get this:
SyntaxError: This experimental syntax requires enabling one of the following parser plugin(s): "decorators", "decorators-legacy".
But I have it enabled, as you can tell from my config posted above.
Ah, this seem to be an actual bug in prettier-plugin-sort-imports
.
Could you try a prettier config below? It's worked for me with the same issue.
{
...
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrder": [
"<THIRD_PARTY_MODULES>",
"^rxjs(.*)$",
"^lodash(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderParserPlugins": ["typescript", "classProperties", "decorators-legacy"]
}
Discussed in https://github.com/trivago/prettier-plugin-sort-imports/discussions/122
the Angular unit test fails due to an error
SyntaxError: Decorators cannot be used to decorate parameters.
if the example includes parameters with decorators.the unit test could be updated and an FAQ added if different plugins are required to support this.