-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running with mobx decorator got error #109
Comments
The problem was introduced here (v3.0.0). Why |
Hmm, if you read through #88 it seems this was an intentional change, these plugins are not activated by default. You can use the option
I guess it should be mentioned in the migration guide though? |
But why were they deleted from plugin default list? Now I must create a |
You might need to wait for the authors to reply, but from what I can tell, it's because those are either deprecated features or experimental ES proposals. At least decorators as implemented by TypeScript are based on an outdated proposal. So I guess it makes sense not to include them by default. It's a breaking change though, which is why the version was bumped to 3.x
There's also this comment:
Not sure, but I take that to mean that there are different decorator plugins (from TypeScript and Babel, perhaps?), which are incompatible |
The solution to support both decorator plugins it was to support none by default, but with the new option added ( Now function test(constructor: Function) {}
@test
class A {} But if you install
Adding the plugins to |
Hey @fangwei18 and @juanrgm, sorry that you are facing this issue. As you know, we were adding few babel parser plugins by default in version 2, |
Error messages are as follows:
SyntaxError: This experimental syntax requires enabling one of the following parser plugin(s): 'decorators-legacy, decorators' (20:0) ... at Object._raise (.../node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser/lib/index.js:816:17) at Object.raiseWithData (.../node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser/lib/index.js:809:17) at Object.expectOnePlugin (.../node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser/lib/index.js:9920:18) at Object.parseDecorator (.../node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser/lib/index.js:12727:10) at Object.parseDecorators (.../node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser/lib/index.js:12709:30) at Object.parseStatement (.../node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser/lib/index.js:12542:12) at Object.parseBlockOrModuleBlockBody (.../node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser/lib/index.js:13134:25) at Object.parseBlockBody (.../node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser/lib/index.js:13125:10) at Object.parseProgram (.../node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser/lib/index.js:12468:10)
The text was updated successfully, but these errors were encountered: