Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Replace "check-es2015-constants" plugin with injected `throw` statements #5728
The "check-es2015-constants" plugin is technically not spec-compliant. Nothing about the spec says that Babel should throw an error at compile-time about assigning to a constant binding.
for instance is perfectly valid code and will run to completion. It's weird and probably won't come up in real code, but I don't see a reason that Babel should be diverging in behavior here.
There are two cases where this plugin currently applies, to my knowledge
In the first case, I'd vote for the block-scoping transform to automatically rewrite every Assignment/UpdateExpression to insert a
This doesn't strictly need to happen for Babel 7.x, I don't think, since if anything it is relaxing restrictions that are currently too strict, but it would certainly be a nice-to-have.
This is also a reasonably self-contained task, so it would be a good first task for someone to tackle.