Adds strictMode option to strict-mode transform#3562
Conversation
Current coverage is 87.91%@@ master #3562 diff @@
==========================================
Files 194 194
Lines 9640 9640
Methods 1101 1101
Messages 0 0
Branches 2204 2204
==========================================
Hits 8475 8475
Misses 1165 1165
Partials 0 0
|
|
Looks good. |
|
What's the use case for this? What does "turn |
|
@jmm The issue is we have this plugin used inside |
|
Thanks @loganfsmyth. Sorry, what I meant is, what is the use case for disabling Use Strict when transforming modules at all? When is it a good idea? I was also wondering what's the purpose of the undocumented It's still not clear to me what the docs mean by:
|
|
It's not a good idea, but we supported it in Babel 5 and James was transitioning a project from Babel 5 to Babel 6 and was hitting this as an issue because he couldn't toggle one flag without the other. The other |
|
Thanks Logan. I'm guessing that was discussed on Slack...in any case, in general, if things are discussed on Slack it would be super helpful if people could record the background information and reasoning for decisions from there in PRs / issues.
We should make that clear in the README. I was helping a module author on the forum who used a preset that disables the Use Strict directive in the module transform to accommodate a user who wanted to concatenate their module with other code. Well, actually that user's package contains a script not a module, so omitting the module transform would be the appropriate solution there -- but it just goes to show that there's a lot of misunderstanding around strict mode and modules and we shouldn't make it sound like a good idea.
Thanks for that info. It does affect output of Use Strict directive though. You can get three different versions of output:
We should document or deprecate it. The preset that I mentioned above that came up on the discussion forum is using it for the purpose of omitting the Use Strict directive. |
This allows you to disable
"use strict";when using thecommonjsmodule transform.