diff --git a/src/babel/transformation/file.js b/src/babel/transformation/file.js index 9d675fa126..b22d7eee4b 100644 --- a/src/babel/transformation/file.js +++ b/src/babel/transformation/file.js @@ -388,7 +388,7 @@ export default class File { var opts = this.opts; opts.allowImportExportEverywhere = this.isLoose("es6.modules"); - opts.strictMode = this.transformers.useStrict.canRun(); + opts.strictMode = this.transformers.strict.canRun(); return parse(opts, code, (tree) => { this.transform(tree); diff --git a/src/babel/transformation/helpers/use-strict.js b/src/babel/transformation/helpers/strict.js similarity index 100% rename from src/babel/transformation/helpers/use-strict.js rename to src/babel/transformation/helpers/strict.js diff --git a/src/babel/transformation/transformers/deprecated.json b/src/babel/transformation/transformers/deprecated.json index 71dea271a6..8c0cb981eb 100644 --- a/src/babel/transformation/transformers/deprecated.json +++ b/src/babel/transformation/transformers/deprecated.json @@ -1,4 +1,5 @@ { + "useStrict": "strict", "selfContained": "runtime", "unicode-regex": "regex.unicode", diff --git a/src/babel/transformation/transformers/index.js b/src/babel/transformation/transformers/index.js index a52a4401c0..66e2f396b4 100644 --- a/src/babel/transformation/transformers/index.js +++ b/src/babel/transformation/transformers/index.js @@ -1,5 +1,5 @@ export default { - useStrict: require("./other/use-strict"), + strict: require("./other/strict"), "validation.undeclaredVariableCheck": require("./validation/undeclared-variable-check"), "validation.noForInOfAssignment": require("./validation/no-for-in-of-assignment"), @@ -97,7 +97,7 @@ export default { "spec.typeofSymbol": require("./spec/typeof-symbol"), "spec.undefinedToVoid": require("./spec/undefined-to-void"), - _useStrict: require("./internal/use-strict"), + _strict: require("./internal/strict"), _moduleFormatter: require("./internal/module-formatter"), "es3.propertyLiterals": require("./es3/property-literals"), diff --git a/src/babel/transformation/transformers/internal/declarations.js b/src/babel/transformation/transformers/internal/declarations.js index 26668aeeef..1f574cb17e 100644 --- a/src/babel/transformation/transformers/internal/declarations.js +++ b/src/babel/transformation/transformers/internal/declarations.js @@ -1,4 +1,4 @@ -import * as useStrict from "../../helpers/use-strict"; +import * as strict from "../../helpers/use-strict"; import t from "../../../types"; export var secondPass = true; @@ -6,7 +6,7 @@ export var secondPass = true; export function BlockStatement(node, parent, scope, file) { if (!node._declarations) return; - useStrict.wrap(node, function () { + strict.wrap(node, function () { var kinds = {}; var kind; diff --git a/src/babel/transformation/transformers/internal/module-formatter.js b/src/babel/transformation/transformers/internal/module-formatter.js index 40f236402b..a601ff4230 100644 --- a/src/babel/transformation/transformers/internal/module-formatter.js +++ b/src/babel/transformation/transformers/internal/module-formatter.js @@ -1,9 +1,9 @@ -import * as useStrict from "../../helpers/use-strict"; +import * as strict from "../../helpers/strict"; export function Program(program, parent, scope, file) { if (!file.transformers["es6.modules"].canRun()) return; - useStrict.wrap(program, function () { + strict.wrap(program, function () { program.body = file.dynamicImports.concat(program.body); }); diff --git a/src/babel/transformation/transformers/internal/use-strict.js b/src/babel/transformation/transformers/internal/strict.js similarity index 78% rename from src/babel/transformation/transformers/internal/use-strict.js rename to src/babel/transformation/transformers/internal/strict.js index 65ea3edfcc..c4e0bfa695 100644 --- a/src/babel/transformation/transformers/internal/use-strict.js +++ b/src/babel/transformation/transformers/internal/strict.js @@ -1,7 +1,7 @@ import t from "../../../types"; export function Program(program, parent, scope, file) { - if (file.transformers.useStrict.canRun()) { + if (file.transformers.strict.canRun()) { program.body.unshift(t.expressionStatement(t.literal("use strict"))); } } diff --git a/src/babel/transformation/transformers/other/use-strict.js b/src/babel/transformation/transformers/other/strict.js similarity index 100% rename from src/babel/transformation/transformers/other/use-strict.js rename to src/babel/transformation/transformers/other/strict.js diff --git a/test/fixtures/transformation/use-strict/undefined-this-arrow-function/actual.js b/test/fixtures/transformation/strict/undefined-this-arrow-function/actual.js similarity index 100% rename from test/fixtures/transformation/use-strict/undefined-this-arrow-function/actual.js rename to test/fixtures/transformation/strict/undefined-this-arrow-function/actual.js diff --git a/test/fixtures/transformation/use-strict/undefined-this-arrow-function/expected.js b/test/fixtures/transformation/strict/undefined-this-arrow-function/expected.js similarity index 100% rename from test/fixtures/transformation/use-strict/undefined-this-arrow-function/expected.js rename to test/fixtures/transformation/strict/undefined-this-arrow-function/expected.js diff --git a/test/fixtures/transformation/use-strict/undefined-this-root-call/actual.js b/test/fixtures/transformation/strict/undefined-this-root-call/actual.js similarity index 100% rename from test/fixtures/transformation/use-strict/undefined-this-root-call/actual.js rename to test/fixtures/transformation/strict/undefined-this-root-call/actual.js diff --git a/test/fixtures/transformation/use-strict/undefined-this-root-call/expected.js b/test/fixtures/transformation/strict/undefined-this-root-call/expected.js similarity index 100% rename from test/fixtures/transformation/use-strict/undefined-this-root-call/expected.js rename to test/fixtures/transformation/strict/undefined-this-root-call/expected.js diff --git a/test/fixtures/transformation/use-strict/undefined-this-root-declaration/actual.js b/test/fixtures/transformation/strict/undefined-this-root-declaration/actual.js similarity index 100% rename from test/fixtures/transformation/use-strict/undefined-this-root-declaration/actual.js rename to test/fixtures/transformation/strict/undefined-this-root-declaration/actual.js diff --git a/test/fixtures/transformation/use-strict/undefined-this-root-declaration/expected.js b/test/fixtures/transformation/strict/undefined-this-root-declaration/expected.js similarity index 100% rename from test/fixtures/transformation/use-strict/undefined-this-root-declaration/expected.js rename to test/fixtures/transformation/strict/undefined-this-root-declaration/expected.js diff --git a/test/fixtures/transformation/use-strict/undefined-this-root-reference/actual.js b/test/fixtures/transformation/strict/undefined-this-root-reference/actual.js similarity index 100% rename from test/fixtures/transformation/use-strict/undefined-this-root-reference/actual.js rename to test/fixtures/transformation/strict/undefined-this-root-reference/actual.js diff --git a/test/fixtures/transformation/use-strict/undefined-this-root-reference/expected.js b/test/fixtures/transformation/strict/undefined-this-root-reference/expected.js similarity index 100% rename from test/fixtures/transformation/use-strict/undefined-this-root-reference/expected.js rename to test/fixtures/transformation/strict/undefined-this-root-reference/expected.js diff --git a/test/fixtures/transformation/use-strict/use-strict-add/actual.js b/test/fixtures/transformation/strict/use-strict-add/actual.js similarity index 100% rename from test/fixtures/transformation/use-strict/use-strict-add/actual.js rename to test/fixtures/transformation/strict/use-strict-add/actual.js diff --git a/test/fixtures/transformation/use-strict/use-strict-add/expected.js b/test/fixtures/transformation/strict/use-strict-add/expected.js similarity index 100% rename from test/fixtures/transformation/use-strict/use-strict-add/expected.js rename to test/fixtures/transformation/strict/use-strict-add/expected.js diff --git a/test/fixtures/transformation/use-strict/use-strict-exists/actual.js b/test/fixtures/transformation/strict/use-strict-exists/actual.js similarity index 100% rename from test/fixtures/transformation/use-strict/use-strict-exists/actual.js rename to test/fixtures/transformation/strict/use-strict-exists/actual.js diff --git a/test/fixtures/transformation/use-strict/use-strict-exists/expected.js b/test/fixtures/transformation/strict/use-strict-exists/expected.js similarity index 100% rename from test/fixtures/transformation/use-strict/use-strict-exists/expected.js rename to test/fixtures/transformation/strict/use-strict-exists/expected.js