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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Some issue in @babel/parser version 7.20.0 #15085
Comments
Hey @doronaz! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite. |
Can you post the input example? We are looking for a decorated export declarations (e.g.
It seems to me this error is thrown from |
Hi, Yes, old version of For now we could by-pass the problem by adding Thanks, |
I can totally understand you, but unfortunately we don't have a good idea either. |
Can you share the file? The SyntaxError in the original issue is definitely a bug. |
Maybe this is enough to reproduce the regression: parser.parse("@dec export class A {}", {
plugins: ["decorators-legacy", "estree"]
}) I'm not at home right now, but later I'll verify it. |
This comment was marked as outdated.
This comment was marked as outdated.
This example is throwing because @tamirbenCA Please provide a reproducible example. |
馃憢 I tried to put together a minimal repro -- https://github.com/max-mathieu/babel-7.20-issue Validation fails with 7.20 but passes with latest from 7.19 due to Hope this helps, happy to help further (though I have no idea where to start for the fix) |
The export default @decorator class {} @max-mathieu Thanks for the reproduction repo. This helps a lot. The error is thrown because the ESLint Of course this is not correct in the case The ESLint's goal is to support standarized JavaScript and not crashing on any stage 3 syntax, e.g. the latest decorators proposal. However, since I will talk with team to decide Babel's action item on this issue. |
Thanks @JLHwung -- glad it helped! I understand it's legacy, but then At least, the error is very hard to understand as such, I'd rather have a Anyways, I guess we'll switch up the order (and be future proof), as I prefer this over pegging some versions in package.json |
@max-mathieu The legacy decorator is still valid and supported in Babel 7. But it will be gradually phased out after decorators proposal becomes stage 4. |
馃捇
How are you using Babel?
@babel/cli
Input code
After we moved from version 7.19.6 to 7.20.0 we got those new errors:
SyntaxError: A decorated export must export a class declaration.
at instantiate /node_modules/@babel/parser/src/parse-error/credentials.ts:62:21
TypeError: Cannot read property 'before' of undefined
at checkSpacingBefore
Can you check and fix it, please?
Configuration file name
package.json
Configuration
.....
"devDependencies": {
"@babel/cli": "7.12.10",
"@babel/core": "7.12.10",
"@babel/plugin-proposal-class-properties": "7.12.1",
"@babel/plugin-proposal-decorators": "7.12.12",
"@babel/plugin-proposal-export-default-from": "7.12.1",
"@babel/plugin-proposal-export-namespace-from": "7.12.1",
"@babel/plugin-proposal-function-bind": "7.12.1",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.12.1",
"@babel/plugin-proposal-optional-chaining": "7.12.7",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-transform-runtime": "7.12.10",
"@babel/preset-env": "7.12.11",
"@babel/preset-react": "7.12.10",
"@babel/register": "7.18.9",
"babel-eslint": "10.0.3",
"babel-plugin-istanbul": "5.2.0",
"babel-plugin-module-resolver": "3.2.0",
"@babel/runtime": "7.12.5",
.....
},
......
Current and expected behavior
Current: @babel/parser version 7.20.0 not working.
Expected: @babel/parser version 7.20.0 should work as version 7.19.6 worked properly.
Environment
Possible solution
To revert some latest changes.
Additional context
No response
The text was updated successfully, but these errors were encountered: