I had the same problem, but I was able to get it working by running npm install --save-dev @babel/plugin-proposal-decorators and adding ["@babel/plugin-proposal-decorators", { "legacy": true }] to the plugins section in my .babelrc.

The plugins section of .babelrc, for me, now looks like this:

"plugins": [
  ["@babel/plugin-proposal-decorators", { "legacy": true }]
]
Answer from Christopher Bradshaw on Stack Overflow
🌐
GitHub
github.com › trivago › prettier-plugin-sort-imports › issues › 120
Decorators Experimental Syntax Error · Issue #120 · trivago/prettier-plugin-sort-imports
December 17, 2021 - ["ERROR" - 8:50:25 PM] Error formatting document. ["ERROR" - 8:50:25 PM] This experimental syntax requires enabling one of the following parser plugin(s): 'decorators-legacy, decorators' (32:0)
Published   Dec 17, 2021
🌐
Prettier
prettier.io › docs › plugins.html
Plugins · Prettier
Plugins are ways of adding new languages or formatting rules to Prettier. Prettier’s own implementations of all languages are expressed using the plugin API. The core prettier package contains JavaScript and other web-focused languages built in.
🌐
GitHub
github.com › trivago › prettier-plugin-sort-imports › issues › 12
Decorators problem for Angular project. · Issue #12 · trivago/prettier-plugin-sort-imports
June 23, 2020 - > prettier --write src/app/app.component.ts --config ./.prettierrc src\app\app.component.ts [error] src\app\app.component.ts: SyntaxError: This experimental syntax requires enabling one of the following parser plugin(s): 'decorators-legacy, decorators' (5:0) [error] 1 | import { isEmpty } from ...
Published   Dec 02, 2020
🌐
npm
npmjs.com › package › @trivago › prettier-plugin-sort-imports
@trivago/prettier-plugin-sort-imports - npm
To pass the options to the babel parser plugins: Since prettier options are limited to string, you can pass plugins with options as a JSON string of the plugin array: "[\"plugin-name\", { \"pluginOption\": true }]". "importOrderParserPlugins" : ["classProperties", "[\"decorators\", { \"decoratorsBeforeExport\": true }]"]
      » npm install @trivago/prettier-plugin-sort-imports
    
Published   Jan 28, 2025
Version   5.2.2
Author   Ayush Sharma
🌐
CodeSandbox
codesandbox.io › examples › package › eslint-plugin-prettier
eslint-plugin-prettier examples - CodeSandbox
[template] vue + nuxt + typescript + decorators · erik-trantt · Master -Coding- React-Challenge air quality site, and search filter form · jishnukoottalaFind more examples or templates · AboutRuns prettier as an eslint rule20,264,747Weekly Downloads · Latest version5.5.4 · LicenseMIT · External Links · github.com/prettier/eslint-plugin-prettier#readme ·
🌐
npm
npmjs.com › package › @ianvs › prettier-plugin-sort-imports
@ianvs/prettier-plugin-sort-imports - npm
To pass the options to the babel parser plugins: Since prettier options are limited to string, you can pass plugins with options as a JSON string of the plugin array: "[\"plugin-name\", { \"pluginOption\": true }]". "importOrderParserPlugins" : ["classProperties", "[\"decorators\", { \"decoratorsBeforeExport\": true }]"]
      » npm install @ianvs/prettier-plugin-sort-imports
    
🌐
GitHub
github.com › prettier › prettier › issues › 988
Inline decorator support · Issue #988 · prettier/prettier
Hi, regarding decorators, it looks like class C { @observable a = 12; @computed get a1(){ return this.a + 1; }; @action inc = () => this.a++; } is turned into class C { @observable a = 12; @computed get a1() { return this.a + 1; } @actio...
Published   Mar 11, 2017
Author   arackaf
🌐
Prettier
prettier.io › docs › rationale.html
Rationale · Prettier
Note: Prettier 1.14.x and older tried to automatically move your decorators, so if you've run an older Prettier version on your code you might need to manually join up some decorators here and there to avoid inconsistencies:
Find elsewhere
🌐
GitHub
github.com › prettier › prettier › issues › 2628
Enable decorator stage 2 · Issue #2628 · prettier/prettier
Is someone interested in trying out the new stage 2 decorators inside of prettier? It should be as easy as enabling a flag on babylon: https://twitter.com/Vjeux/status/897494644224741376 · The text was updated successfully, but these errors were encountered: Copy link · Collaborator · I have a PR for this nearly done! Hope to get it up asap. existentialism mentioned this issue · Aug 16, 2017 · Switch to updated decorators plugin in Babylon #2630 ·
Published   Aug 15, 2017
Author   vjeux
🌐
GitHub
github.com › prettier › prettier › issues › 2613
inline decorators · Issue #2613 · prettier/prettier
continue from #325, I think it need more discussion It's really ugly to put them in one line in field definition like in TypeORM. maybe only decorators without () should be inline? before @Entity() export class Board { @PrimaryGeneratedC...
🌐
Lightrun
lightrun.com › answers › trivago-prettier-plugin-sort-imports-running-with-mobx-decorator-got-error
Running with mobx decorator got error
The solution to support both decorator plugins it was to support none by default, but with the new option added (importOrderParserPlugins) you can override that default config, no? Now prettier, without prettier-plugin-sort-imports, can successfully format the next code:
🌐
npm
npmjs.com › package › @plasmohq › prettier-plugin-sort-imports
@plasmohq/prettier-plugin-sort-imports - npm
To pass the options to the babel parser plugins: Since prettier options are limited to string, you can pass plugins with options as a JSON string of the plugin array: "[\"plugin-name\", { \"pluginOption\": true }]". "importOrderParserPlugins" : ["classProperties", "[\"decorators\", { \"decoratorsBeforeExport\": true }]"]
      » npm install @plasmohq/prettier-plugin-sort-imports
    
Published   Jul 14, 2023
Version   4.0.1
Author   Plasmo Corp.
🌐
GitHub
github.com › trivago › prettier-plugin-sort-imports › issues › 15
decorators an class properties errors on a react project · Issue #15 · trivago/prettier-plugin-sort-imports
September 4, 2020 - s[error] packages/react-common/stores/RecipesRepoStore.ts: SyntaxError: This experimental syntax requires enabling one of the following parser plugin(s): 'decorators-legacy, decorators' (9:1)
Published   Dec 10, 2020
🌐
GitHub
github.com › prettier › prettier › pull › 12299
Support decorator auto accessors syntax by sosukesuzuki · Pull Request #12299 · prettier/prettier
Description Supports auto accessors syntax from new decorator proposal. Partial of #12255 Checklist I’ve added tests to confirm my change works. (If the change is user-facing) I’ve added my c...
Author   prettier
🌐
GitHub
github.com › ggascoigne › prettier-plugin-import-sort › issues › 3
Parsing error: Stage 2 decorators cannot be used to decorate parameters · Issue #3 · ggascoigne/prettier-plugin-import-sort
... src/index.ts 6:16 error Parsing error: Stage 2 decorators cannot be used to decorate parameters prettier/prettier ... Before adding prettier-plugin-import-sort and import-sort-style-module, prettier didn't complain about the function argument decorator so I suppose that there is something wrong on this side...
Published   Oct 15, 2019
Author   bbenoist
🌐
GitHub
github.com › prettier › prettier › issues › 5045
Support new decorators proposal · Issue #5045 · prettier/prettier
January 25, 2018 - Expected behavior: Using the export keyword between a decorator and a class is not allowed. Please use export @dec class instead. prettier/prettier-vscode#572 · 👍React with 👍1vikr01 · No one assigned ·
Published   Sep 03, 2018
🌐
Prettier
prettier.io › blog › 2020 › 03 › 21 › 2.0.0.html
Prettier 2.0 “2020” · Prettier
March 21, 2020 - Therefore, the function composition logic introduced in #6033 has been changed to exclude decorator calls.
🌐
Prettier
prettier.io › blog › 2023 › 07 › 05 › 3.0.0.html
Prettier 3.0: Hello, ECMAScript Modules! · Prettier
July 5, 2023 - Another important change in this release is the significant overhaul of the plugin interface. Prettier now supports plugins written using ECMAScript Modules and async parsers. If you're a plugin developer, please exercise caution while updating. You can find the migration guide here.