jonbretman / amd-to-as6

Converts AMD modules into ES6 modules
165 stars 37 forks source link

Strip 'use strict' if present #11

Closed SimenB closed 8 years ago

SimenB commented 9 years ago

use strict is default in ES6, so I'm thinking this does not have to be behind a flag. https://babeljs.io/docs/advanced/transformers/other/strict/

No idea if this is the way to do it, and it's also kept if the source is returned early.

This is probably not ready for merge, as I just hacked something together that works for my project, not necessarily the best way to do it

jonbretman commented 9 years ago

I think this might be out of scope for this tool, it's really just intended for converting import module syntax. Also as far as I know the 'use scrict' declaration won't do any harm in ES6 code.

SimenB commented 9 years ago

It doesn't do any harm, no, but it's "dead code", as ES6 modules are implicitly strict by default.

http://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-code

Module code is always strict mode code.

zowers commented 9 years ago

we do sed -i /.use.strict.;/d $file after amdtoes6 call

lukeapage commented 8 years ago

+1 I'll be using the branch that removes use-strict. Its within scope and its completely valid.

jonbretman commented 8 years ago

Convinced, please see #19 which includes this.