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
Let's use "undefined" in favour of "void 0" #7492
Comments
|
Hey @revelt! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
I'm 99% sure that
ESLint is configurable 😛
Well, there are many things waaay more difficult to understand than |
|
@nicolo-ribaudo Thanks for quick response and sharing your view on this issue! |
That is not quite a correct characterization. The In the context of scope lookups, I think the bigger issue for me is that while a global in their own module. That means that when Babel needs a reference to an
Running random linting rules on third-party files is never going to come up green. It does not seem like focusing on this specific case adds much weight when there are likely to be many other failures.
It's certainly slightly more work, but it's very straightforward to learn. There's also tons about the code Babel outputs that makes it hard to read. Optimizing for that case isn't generally something Babel aims to achieve. |
I noticed that using
envpreset Babel turns all instances ofundefinedintovoid 0.Arguments in favour of
void 0are mainly void (pun intended):undefinedfrom reassigning. This is not relevant now since ES5 spec was released a decade ago which prohibits that. Since then, you can't reassignundefinedprimitive.undefined. Three characters less. But minifying is not the purpose of Babel, is it?Arguments against
void 0:voidis operator,undefinedis primitive type. By definition, primitive type is more efficient to process than operator whose result is the same primitive type. The difference might be negligible but I haven't seenvoid 0vsundefinedperf tests proving that.void 0as a code bug, which means if you review Babel CommonJS build file (coming from Rollup typically), you'll see linting errors everywhere where you previously usedundefinedvoid 0is an unnecessary burden to learn and obfuscated Babel builds make it more difficult to understand what Babel does.I know, this is not a bug per se or a feature per se, but nonetheless it's an important, fundamental issue that needs to be looked at. I see no reason why we should transpile down to ES3 JS spec (because, technically, that's what we're doing at the moment).
Thank you.
The text was updated successfully, but these errors were encountered: