diff --git a/lib/6to5/transformation/transform.js b/lib/6to5/transformation/transform.js index 123f52b6fb..6663a61697 100644 --- a/lib/6to5/transformation/transform.js +++ b/lib/6to5/transformation/transform.js @@ -3,6 +3,7 @@ module.exports = transform; var Transformer = require("./transformer"); +var object = require("../helpers/object"); var File = require("../file"); var util = require("../util"); var _ = require("lodash"); @@ -24,7 +25,7 @@ transform.fromAst = function (ast, code, opts) { transform._ensureTransformerNames = function (type, keys) { for (var i = 0; i < keys.length; i++) { var key = keys[i]; - if (!_.has(transform.transformers, key)) { + if (!transform.transformers[key]) { throw new ReferenceError( "Unknown transformer " + key + " specified in " + type + " - " + "transformer key names have been changed in 3.0.0 see " + @@ -35,7 +36,7 @@ transform._ensureTransformerNames = function (type, keys) { } }; -transform.transformers = {}; +transform.transformers = object(); transform.moduleFormatters = { common: require("./modules/common"), @@ -46,18 +47,20 @@ transform.moduleFormatters = { }; _.each({ - "spec.noForInOfAssignment": require("./transformers/spec/no-for-in-of-assignment"), - "spec.setters": require("./transformers/spec/setters"), + useStrict: require("./transformers/other/use-strict"), + + "validation.undeclaredVariableCheck": require("./transformers/validation/undeclared-variable-check"), + "validation.noForInOfAssignment": require("./transformers/validation/no-for-in-of-assignment"), + "validation.setters": require("./transformers/validation/setters"), "spec.blockScopedFunctions": require("./transformers/spec/block-scoped-functions"), - "spec.illegalTopLevelThis": require("./transformers/spec/illegal-top-level-this"), "playground.malletOperator": require("./transformers/playground/mallet-operator"), "playground.methodBinding": require("./transformers/playground/method-binding"), "playground.memoizationOperator": require("./transformers/playground/memoization-operator"), "playground.objectGetterMemoization": require("./transformers/playground/object-getter-memoization"), - "optional.asyncToGenerator": require("./transformers/optional/async-to-generator"), - "optional.bluebirdCoroutines": require("./transformers/optional/bluebird-coroutines"), + "misc.asyncToGenerator": require("./transformers/misc/async-to-generator"), + "misc.bluebirdCoroutines": require("./transformers/misc/bluebird-coroutines"), react: require("./transformers/other/react"), @@ -96,9 +99,8 @@ _.each({ "es6.blockScoping": require("./transformers/es6/block-scoping"), // needs to be after `es6.blockScoping` due to needing `letReferences` set on blocks - "optional.blockScopingTDZ": require("./transformers/optional/block-scoping-tdz"), + "es6.blockScopingTDZ": require("./transformers/es6/block-scoping-tdz"), - // needs to before `forOf` because otherwise regenerator wont be able to explode them // needs to be after block scoping since regenerator doesn't support it regenerator: require("./transformers/other/regenerator"), @@ -110,25 +112,22 @@ _.each({ // needs to be after `regenerator` due to needing `regeneratorRuntime` references // needs to be after `es6.forOf` due to needing `Symbol.iterator` references // needs to be before `es6.modules` due to dynamic imports - "optional.selfContained": require("./transformers/optional/self-contained"), + "misc.selfContained": require("./transformers/misc/self-contained"), _blockHoist: require("./transformers/_block-hoist"), - "optional.protoToAssign": require("./transformers/optional/proto-to-assign"), + "spec.protoToAssign": require("./transformers/spec/proto-to-assign"), _declarations: require("./transformers/_declarations"), - useStrict: require("./transformers/other/use-strict"), - _aliasFunctions: require("./transformers/_alias-functions"), _moduleFormatter: require("./transformers/_module-formatter"), - "optional.typeofSymbol": require("./transformers/optional/typeof-symbol"), - "optional.undefinedToVoid": require("./transformers/optional/undefined-to-void"), - "optional.undeclaredVariableCheck": require("./transformers/optional/undeclared-variable-check"), + "spec.typeofSymbol": require("./transformers/spec/typeof-symbol"), + "spec.undefinedToVoid": require("./transformers/spec/undefined-to-void"), - "spec.propertyLiterals": require("./transformers/spec/property-literals"), - "spec.memberExpressionLiterals": require("./transformers/spec/member-expression-literals") + "minification.propertyLiterals": require("./transformers/minification/property-literals"), + "minification.memberExpressionLiterals": require("./transformers/minification/member-expression-literals") }, function (transformer, key) { transform.transformers[key] = new Transformer(key, transformer); }); diff --git a/lib/6to5/transformation/transformers/spec/member-expression-literals.js b/lib/6to5/transformation/transformers/minification/member-expression-literals.js similarity index 86% rename from lib/6to5/transformation/transformers/spec/member-expression-literals.js rename to lib/6to5/transformation/transformers/minification/member-expression-literals.js index 7b97bed4be..c360f560fb 100644 --- a/lib/6to5/transformation/transformers/spec/member-expression-literals.js +++ b/lib/6to5/transformation/transformers/minification/member-expression-literals.js @@ -5,10 +5,11 @@ var t = require("../../../types"); exports.MemberExpression = function (node) { var prop = node.property; if (node.computed && t.isLiteral(prop) && t.isValidIdentifier(prop.value)) { - // computed literal that is a valid identifier + // foo["bar"] => foo.bar node.property = t.identifier(prop.value); node.computed = false; } else if (!node.computed && t.isIdentifier(prop) && !t.isValidIdentifier(prop.name)) { + // foo.default -> foo["default"] node.property = t.literal(prop.name); node.computed = true; } diff --git a/lib/6to5/transformation/transformers/spec/property-literals.js b/lib/6to5/transformation/transformers/minification/property-literals.js similarity index 80% rename from lib/6to5/transformation/transformers/spec/property-literals.js rename to lib/6to5/transformation/transformers/minification/property-literals.js index b83882bac7..862c8eea94 100644 --- a/lib/6to5/transformation/transformers/spec/property-literals.js +++ b/lib/6to5/transformation/transformers/minification/property-literals.js @@ -5,11 +5,11 @@ var t = require("../../../types"); exports.Property = function (node) { var key = node.key; if (t.isLiteral(key) && t.isValidIdentifier(key.value)) { - // property key is a literal but a valid identifier + // "foo": "bar" -> foo: "bar" node.key = t.identifier(key.value); node.computed = false; } else if (!node.computed && t.isIdentifier(key) && !t.isValidIdentifier(key.name)) { - // property key is a keyword + // default: "bar" -> "default": "bar" node.key = t.literal(key.name); } }; diff --git a/lib/6to5/transformation/transformers/optional/async-to-generator.js b/lib/6to5/transformation/transformers/misc/async-to-generator.js similarity index 100% rename from lib/6to5/transformation/transformers/optional/async-to-generator.js rename to lib/6to5/transformation/transformers/misc/async-to-generator.js diff --git a/lib/6to5/transformation/transformers/optional/bluebird-coroutines.js b/lib/6to5/transformation/transformers/misc/bluebird-coroutines.js similarity index 100% rename from lib/6to5/transformation/transformers/optional/bluebird-coroutines.js rename to lib/6to5/transformation/transformers/misc/bluebird-coroutines.js diff --git a/lib/6to5/transformation/transformers/optional/self-contained.js b/lib/6to5/transformation/transformers/misc/self-contained.js similarity index 100% rename from lib/6to5/transformation/transformers/optional/self-contained.js rename to lib/6to5/transformation/transformers/misc/self-contained.js diff --git a/lib/6to5/transformation/transformers/optional/block-scoping-tdz.js b/lib/6to5/transformation/transformers/optional/block-scoping-tdz.js deleted file mode 100644 index b97f49ebb0..0000000000 --- a/lib/6to5/transformation/transformers/optional/block-scoping-tdz.js +++ /dev/null @@ -1,48 +0,0 @@ -var traverse = require("../../../traverse"); -var t = require("../../../types"); - -var visitor = { - enter: function (node, parent, scope, context, state) { - if (!t.isReferencedIdentifier(node, parent)) return; - - var declared = state.letRefs[node.name]; - if (!declared) return; - - // declared node is different in this scope - if (scope.get(node.name, true) !== declared) return; - - var declaredLoc = declared.loc; - var referenceLoc = node.loc; - - if (!declaredLoc || !referenceLoc) return; - - // does this reference appear on a line before the declaration? - var before = referenceLoc.start.line < declaredLoc.start.line; - - if (referenceLoc.start.line === declaredLoc.start.line) { - // this reference appears on the same line - // check it appears before the declaration - before = referenceLoc.start.col < declaredLoc.start.col; - } - - if (before) { - throw state.file.errorWithNode(node, "Temporal dead zone - accessing a variable before it's initialized"); - } - } -}; - -exports.optional = true; - -exports.Loop = -exports.Program = -exports.BlockStatement = function (node, parent, scope, context, file) { - var letRefs = node._letReferences; - if (!letRefs) return; - - var state = { - letRefs: letRefs, - file: file - }; - - traverse(node, visitor, scope, state); -}; diff --git a/lib/6to5/transformation/transformers/other/react.js b/lib/6to5/transformation/transformers/other/react.js index 9482f7e633..4059af0fc7 100644 --- a/lib/6to5/transformation/transformers/other/react.js +++ b/lib/6to5/transformation/transformers/other/react.js @@ -7,7 +7,6 @@ var esutils = require("esutils"); var t = require("../../../types"); -var _ = require("lodash"); exports.JSXIdentifier = function (node) { if (esutils.keyword.isIdentifierName(node.name)) { @@ -148,7 +147,7 @@ exports.JSXElement = { for (var i = 0; i < node.children.length; i++) { var child = node.children[i]; - if (t.isLiteral(child) && _.isString(child.value)) { + if (t.isLiteral(child) && typeof child.value === "string") { cleanJSXElementLiteralChild(child, callExpr.arguments); continue; } else if (t.isJSXEmptyExpression(child)) { diff --git a/lib/6to5/transformation/transformers/other/use-strict.js b/lib/6to5/transformation/transformers/other/use-strict.js index 5a06b90d7a..2b8251a41b 100644 --- a/lib/6to5/transformation/transformers/other/use-strict.js +++ b/lib/6to5/transformation/transformers/other/use-strict.js @@ -10,3 +10,12 @@ exports.ast = { } } }; + +exports.FunctionDeclaration = +exports.FunctionExpression = function (node, parent, scope, context) { + context.skip(); +}; + +exports.ThisExpression = function (node, parent, scope, context, file) { + throw file.errorWithNode(node, "Top level `this` is not allowed", ReferenceError); +}; diff --git a/lib/6to5/transformation/transformers/spec/illegal-top-level-this.js b/lib/6to5/transformation/transformers/spec/illegal-top-level-this.js deleted file mode 100644 index e1edc90c31..0000000000 --- a/lib/6to5/transformation/transformers/spec/illegal-top-level-this.js +++ /dev/null @@ -1,8 +0,0 @@ -exports.FunctionDeclaration = -exports.FunctionExpression = function (node, parent, scope, context) { - context.skip(); -}; - -exports.ThisExpression = function (node, parent, scope, context, file) { - throw file.errorWithNode(node, "Top level `this` is not allowed", ReferenceError); -}; diff --git a/lib/6to5/transformation/transformers/optional/proto-to-assign.js b/lib/6to5/transformation/transformers/spec/proto-to-assign.js similarity index 100% rename from lib/6to5/transformation/transformers/optional/proto-to-assign.js rename to lib/6to5/transformation/transformers/spec/proto-to-assign.js diff --git a/lib/6to5/transformation/transformers/optional/typeof-symbol.js b/lib/6to5/transformation/transformers/spec/typeof-symbol.js similarity index 100% rename from lib/6to5/transformation/transformers/optional/typeof-symbol.js rename to lib/6to5/transformation/transformers/spec/typeof-symbol.js diff --git a/lib/6to5/transformation/transformers/optional/undefined-to-void.js b/lib/6to5/transformation/transformers/spec/undefined-to-void.js similarity index 100% rename from lib/6to5/transformation/transformers/optional/undefined-to-void.js rename to lib/6to5/transformation/transformers/spec/undefined-to-void.js diff --git a/lib/6to5/transformation/transformers/spec/no-for-in-of-assignment.js b/lib/6to5/transformation/transformers/validation/no-for-in-of-assignment.js similarity index 100% rename from lib/6to5/transformation/transformers/spec/no-for-in-of-assignment.js rename to lib/6to5/transformation/transformers/validation/no-for-in-of-assignment.js diff --git a/lib/6to5/transformation/transformers/spec/setters.js b/lib/6to5/transformation/transformers/validation/setters.js similarity index 100% rename from lib/6to5/transformation/transformers/spec/setters.js rename to lib/6to5/transformation/transformers/validation/setters.js diff --git a/lib/6to5/transformation/transformers/optional/undeclared-variable-check.js b/lib/6to5/transformation/transformers/validation/undeclared-variable-check.js similarity index 100% rename from lib/6to5/transformation/transformers/optional/undeclared-variable-check.js rename to lib/6to5/transformation/transformers/validation/undeclared-variable-check.js diff --git a/test/fixtures/transformation/spec/member-expression-literals/actual.js b/test/fixtures/transformation/minification/member-expression-literals/actual.js similarity index 100% rename from test/fixtures/transformation/spec/member-expression-literals/actual.js rename to test/fixtures/transformation/minification/member-expression-literals/actual.js diff --git a/test/fixtures/transformation/spec/member-expression-literals/expected.js b/test/fixtures/transformation/minification/member-expression-literals/expected.js similarity index 100% rename from test/fixtures/transformation/spec/member-expression-literals/expected.js rename to test/fixtures/transformation/minification/member-expression-literals/expected.js diff --git a/test/fixtures/transformation/spec/property-literals/actual.js b/test/fixtures/transformation/minification/property-literals/actual.js similarity index 100% rename from test/fixtures/transformation/spec/property-literals/actual.js rename to test/fixtures/transformation/minification/property-literals/actual.js diff --git a/test/fixtures/transformation/spec/property-literals/expected.js b/test/fixtures/transformation/minification/property-literals/expected.js similarity index 100% rename from test/fixtures/transformation/spec/property-literals/expected.js rename to test/fixtures/transformation/minification/property-literals/expected.js diff --git a/test/fixtures/transformation/optional-async-to-generator/expression/actual.js b/test/fixtures/transformation/misc-async-to-generator/expression/actual.js similarity index 100% rename from test/fixtures/transformation/optional-async-to-generator/expression/actual.js rename to test/fixtures/transformation/misc-async-to-generator/expression/actual.js diff --git a/test/fixtures/transformation/optional-async-to-generator/expression/expected.js b/test/fixtures/transformation/misc-async-to-generator/expression/expected.js similarity index 100% rename from test/fixtures/transformation/optional-async-to-generator/expression/expected.js rename to test/fixtures/transformation/misc-async-to-generator/expression/expected.js diff --git a/test/fixtures/transformation/misc-async-to-generator/options.json b/test/fixtures/transformation/misc-async-to-generator/options.json new file mode 100644 index 0000000000..f5ac3882dd --- /dev/null +++ b/test/fixtures/transformation/misc-async-to-generator/options.json @@ -0,0 +1,4 @@ +{ + "noCheckAst": true, + "optional": ["misc.asyncToGenerator"] +} diff --git a/test/fixtures/transformation/optional-async-to-generator/statement/actual.js b/test/fixtures/transformation/misc-async-to-generator/statement/actual.js similarity index 100% rename from test/fixtures/transformation/optional-async-to-generator/statement/actual.js rename to test/fixtures/transformation/misc-async-to-generator/statement/actual.js diff --git a/test/fixtures/transformation/optional-async-to-generator/statement/expected.js b/test/fixtures/transformation/misc-async-to-generator/statement/expected.js similarity index 100% rename from test/fixtures/transformation/optional-async-to-generator/statement/expected.js rename to test/fixtures/transformation/misc-async-to-generator/statement/expected.js diff --git a/test/fixtures/transformation/optional-bluebird-coroutines/expression/actual.js b/test/fixtures/transformation/misc-bluebird-coroutines/expression/actual.js similarity index 100% rename from test/fixtures/transformation/optional-bluebird-coroutines/expression/actual.js rename to test/fixtures/transformation/misc-bluebird-coroutines/expression/actual.js diff --git a/test/fixtures/transformation/optional-bluebird-coroutines/expression/expected.js b/test/fixtures/transformation/misc-bluebird-coroutines/expression/expected.js similarity index 100% rename from test/fixtures/transformation/optional-bluebird-coroutines/expression/expected.js rename to test/fixtures/transformation/misc-bluebird-coroutines/expression/expected.js diff --git a/test/fixtures/transformation/misc-bluebird-coroutines/options.json b/test/fixtures/transformation/misc-bluebird-coroutines/options.json new file mode 100644 index 0000000000..5a66a3ffe6 --- /dev/null +++ b/test/fixtures/transformation/misc-bluebird-coroutines/options.json @@ -0,0 +1,4 @@ +{ + "optional": ["misc.bluebirdCoroutines"], + "noCheckAst": true +} diff --git a/test/fixtures/transformation/optional-bluebird-coroutines/statement/actual.js b/test/fixtures/transformation/misc-bluebird-coroutines/statement/actual.js similarity index 100% rename from test/fixtures/transformation/optional-bluebird-coroutines/statement/actual.js rename to test/fixtures/transformation/misc-bluebird-coroutines/statement/actual.js diff --git a/test/fixtures/transformation/optional-bluebird-coroutines/statement/expected.js b/test/fixtures/transformation/misc-bluebird-coroutines/statement/expected.js similarity index 100% rename from test/fixtures/transformation/optional-bluebird-coroutines/statement/expected.js rename to test/fixtures/transformation/misc-bluebird-coroutines/statement/expected.js diff --git a/test/fixtures/transformation/optional-self-contained/aliased-constructors/actual.js b/test/fixtures/transformation/misc-self-contained/aliased-constructors/actual.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/aliased-constructors/actual.js rename to test/fixtures/transformation/misc-self-contained/aliased-constructors/actual.js diff --git a/test/fixtures/transformation/optional-self-contained/aliased-constructors/expected.js b/test/fixtures/transformation/misc-self-contained/aliased-constructors/expected.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/aliased-constructors/expected.js rename to test/fixtures/transformation/misc-self-contained/aliased-constructors/expected.js diff --git a/test/fixtures/transformation/optional-self-contained/es6-for-of/actual.js b/test/fixtures/transformation/misc-self-contained/es6-for-of/actual.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/es6-for-of/actual.js rename to test/fixtures/transformation/misc-self-contained/es6-for-of/actual.js diff --git a/test/fixtures/transformation/optional-self-contained/es6-for-of/expected.js b/test/fixtures/transformation/misc-self-contained/es6-for-of/expected.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/es6-for-of/expected.js rename to test/fixtures/transformation/misc-self-contained/es6-for-of/expected.js diff --git a/test/fixtures/transformation/optional-self-contained/es7-array-comprehensions/actual.js b/test/fixtures/transformation/misc-self-contained/es7-array-comprehensions/actual.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/es7-array-comprehensions/actual.js rename to test/fixtures/transformation/misc-self-contained/es7-array-comprehensions/actual.js diff --git a/test/fixtures/transformation/optional-self-contained/es7-array-comprehensions/expected.js b/test/fixtures/transformation/misc-self-contained/es7-array-comprehensions/expected.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/es7-array-comprehensions/expected.js rename to test/fixtures/transformation/misc-self-contained/es7-array-comprehensions/expected.js diff --git a/test/fixtures/transformation/optional-self-contained/full/actual.js b/test/fixtures/transformation/misc-self-contained/full/actual.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/full/actual.js rename to test/fixtures/transformation/misc-self-contained/full/actual.js diff --git a/test/fixtures/transformation/optional-self-contained/full/expected.js b/test/fixtures/transformation/misc-self-contained/full/expected.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/full/expected.js rename to test/fixtures/transformation/misc-self-contained/full/expected.js diff --git a/test/fixtures/transformation/misc-self-contained/options.json b/test/fixtures/transformation/misc-self-contained/options.json new file mode 100644 index 0000000000..a28ebc7a9e --- /dev/null +++ b/test/fixtures/transformation/misc-self-contained/options.json @@ -0,0 +1,4 @@ +{ + "optional": ["misc.selfContained"], + "experimental": true +} diff --git a/test/fixtures/transformation/optional-self-contained/regenerator-runtime/actual.js b/test/fixtures/transformation/misc-self-contained/regenerator-runtime/actual.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/regenerator-runtime/actual.js rename to test/fixtures/transformation/misc-self-contained/regenerator-runtime/actual.js diff --git a/test/fixtures/transformation/optional-self-contained/regenerator-runtime/expected.js b/test/fixtures/transformation/misc-self-contained/regenerator-runtime/expected.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/regenerator-runtime/expected.js rename to test/fixtures/transformation/misc-self-contained/regenerator-runtime/expected.js diff --git a/test/fixtures/transformation/optional-self-contained/runtime-amd/actual.js b/test/fixtures/transformation/misc-self-contained/runtime-amd/actual.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/runtime-amd/actual.js rename to test/fixtures/transformation/misc-self-contained/runtime-amd/actual.js diff --git a/test/fixtures/transformation/optional-self-contained/runtime-amd/expected.js b/test/fixtures/transformation/misc-self-contained/runtime-amd/expected.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/runtime-amd/expected.js rename to test/fixtures/transformation/misc-self-contained/runtime-amd/expected.js diff --git a/test/fixtures/transformation/optional-self-contained/runtime-amd/options.json b/test/fixtures/transformation/misc-self-contained/runtime-amd/options.json similarity index 100% rename from test/fixtures/transformation/optional-self-contained/runtime-amd/options.json rename to test/fixtures/transformation/misc-self-contained/runtime-amd/options.json diff --git a/test/fixtures/transformation/optional-self-contained/runtime-commonjs/actual.js b/test/fixtures/transformation/misc-self-contained/runtime-commonjs/actual.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/runtime-commonjs/actual.js rename to test/fixtures/transformation/misc-self-contained/runtime-commonjs/actual.js diff --git a/test/fixtures/transformation/optional-self-contained/runtime-commonjs/expected.js b/test/fixtures/transformation/misc-self-contained/runtime-commonjs/expected.js similarity index 100% rename from test/fixtures/transformation/optional-self-contained/runtime-commonjs/expected.js rename to test/fixtures/transformation/misc-self-contained/runtime-commonjs/expected.js diff --git a/test/fixtures/transformation/optional-async-to-generator/options.json b/test/fixtures/transformation/optional-async-to-generator/options.json deleted file mode 100644 index 9dbdefeeb0..0000000000 --- a/test/fixtures/transformation/optional-async-to-generator/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "noCheckAst": true, - "optional": ["asyncToGenerator"] -} diff --git a/test/fixtures/transformation/optional-bluebird-coroutines/options.json b/test/fixtures/transformation/optional-bluebird-coroutines/options.json deleted file mode 100644 index beb0408342..0000000000 --- a/test/fixtures/transformation/optional-bluebird-coroutines/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "optional": ["bluebirdCoroutines"], - "noCheckAst": true -} diff --git a/test/fixtures/transformation/optional-proto-to-assign/options.json b/test/fixtures/transformation/optional-proto-to-assign/options.json deleted file mode 100644 index bff9598732..0000000000 --- a/test/fixtures/transformation/optional-proto-to-assign/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "optional": ["protoToAssign"] -} diff --git a/test/fixtures/transformation/optional-self-contained/options.json b/test/fixtures/transformation/optional-self-contained/options.json deleted file mode 100644 index 079cf304ad..0000000000 --- a/test/fixtures/transformation/optional-self-contained/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "optional": ["selfContained"], - "experimental": true -} diff --git a/test/fixtures/transformation/optional-typeof-symbol/options.json b/test/fixtures/transformation/optional-typeof-symbol/options.json deleted file mode 100644 index 6e208aa132..0000000000 --- a/test/fixtures/transformation/optional-typeof-symbol/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "optional": ["typeofSymbol"] -} diff --git a/test/fixtures/transformation/optional-undeclared-variable-check/options.json b/test/fixtures/transformation/optional-undeclared-variable-check/options.json deleted file mode 100644 index 535d39109b..0000000000 --- a/test/fixtures/transformation/optional-undeclared-variable-check/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "optional": ["undeclaredVariableCheck"] -} diff --git a/test/fixtures/transformation/optional-undefined-to-void/options.json b/test/fixtures/transformation/optional-undefined-to-void/options.json deleted file mode 100644 index 951ad97b89..0000000000 --- a/test/fixtures/transformation/optional-undefined-to-void/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "optional": ["undefinedToVoid"] -} diff --git a/test/fixtures/transformation/optional-proto-to-assign/assignment-expression/actual.js b/test/fixtures/transformation/spec-proto-to-assign/assignment-expression/actual.js similarity index 100% rename from test/fixtures/transformation/optional-proto-to-assign/assignment-expression/actual.js rename to test/fixtures/transformation/spec-proto-to-assign/assignment-expression/actual.js diff --git a/test/fixtures/transformation/optional-proto-to-assign/assignment-expression/expected.js b/test/fixtures/transformation/spec-proto-to-assign/assignment-expression/expected.js similarity index 100% rename from test/fixtures/transformation/optional-proto-to-assign/assignment-expression/expected.js rename to test/fixtures/transformation/spec-proto-to-assign/assignment-expression/expected.js diff --git a/test/fixtures/transformation/optional-proto-to-assign/assignment-statement/actual.js b/test/fixtures/transformation/spec-proto-to-assign/assignment-statement/actual.js similarity index 100% rename from test/fixtures/transformation/optional-proto-to-assign/assignment-statement/actual.js rename to test/fixtures/transformation/spec-proto-to-assign/assignment-statement/actual.js diff --git a/test/fixtures/transformation/optional-proto-to-assign/assignment-statement/expected.js b/test/fixtures/transformation/spec-proto-to-assign/assignment-statement/expected.js similarity index 100% rename from test/fixtures/transformation/optional-proto-to-assign/assignment-statement/expected.js rename to test/fixtures/transformation/spec-proto-to-assign/assignment-statement/expected.js diff --git a/test/fixtures/transformation/optional-proto-to-assign/class/actual.js b/test/fixtures/transformation/spec-proto-to-assign/class/actual.js similarity index 100% rename from test/fixtures/transformation/optional-proto-to-assign/class/actual.js rename to test/fixtures/transformation/spec-proto-to-assign/class/actual.js diff --git a/test/fixtures/transformation/optional-proto-to-assign/class/expected.js b/test/fixtures/transformation/spec-proto-to-assign/class/expected.js similarity index 100% rename from test/fixtures/transformation/optional-proto-to-assign/class/expected.js rename to test/fixtures/transformation/spec-proto-to-assign/class/expected.js diff --git a/test/fixtures/transformation/optional-proto-to-assign/object-literal/actual.js b/test/fixtures/transformation/spec-proto-to-assign/object-literal/actual.js similarity index 100% rename from test/fixtures/transformation/optional-proto-to-assign/object-literal/actual.js rename to test/fixtures/transformation/spec-proto-to-assign/object-literal/actual.js diff --git a/test/fixtures/transformation/optional-proto-to-assign/object-literal/expected.js b/test/fixtures/transformation/spec-proto-to-assign/object-literal/expected.js similarity index 100% rename from test/fixtures/transformation/optional-proto-to-assign/object-literal/expected.js rename to test/fixtures/transformation/spec-proto-to-assign/object-literal/expected.js diff --git a/test/fixtures/transformation/spec-proto-to-assign/options.json b/test/fixtures/transformation/spec-proto-to-assign/options.json new file mode 100644 index 0000000000..d9ea3ea443 --- /dev/null +++ b/test/fixtures/transformation/spec-proto-to-assign/options.json @@ -0,0 +1,3 @@ +{ + "optional": ["spec.protoToAssign"] +} diff --git a/test/fixtures/transformation/optional-typeof-symbol/basic/actual.js b/test/fixtures/transformation/spec-typeof-symbol/basic/actual.js similarity index 100% rename from test/fixtures/transformation/optional-typeof-symbol/basic/actual.js rename to test/fixtures/transformation/spec-typeof-symbol/basic/actual.js diff --git a/test/fixtures/transformation/optional-typeof-symbol/basic/exec.js b/test/fixtures/transformation/spec-typeof-symbol/basic/exec.js similarity index 100% rename from test/fixtures/transformation/optional-typeof-symbol/basic/exec.js rename to test/fixtures/transformation/spec-typeof-symbol/basic/exec.js diff --git a/test/fixtures/transformation/optional-typeof-symbol/basic/expected.js b/test/fixtures/transformation/spec-typeof-symbol/basic/expected.js similarity index 100% rename from test/fixtures/transformation/optional-typeof-symbol/basic/expected.js rename to test/fixtures/transformation/spec-typeof-symbol/basic/expected.js diff --git a/test/fixtures/transformation/spec-typeof-symbol/options.json b/test/fixtures/transformation/spec-typeof-symbol/options.json new file mode 100644 index 0000000000..9d920d3af0 --- /dev/null +++ b/test/fixtures/transformation/spec-typeof-symbol/options.json @@ -0,0 +1,3 @@ +{ + "optional": ["spec.typeofSymbol"] +} diff --git a/test/fixtures/transformation/optional-undefined-to-void/basic/actual.js b/test/fixtures/transformation/spec-undefined-to-void/basic/actual.js similarity index 100% rename from test/fixtures/transformation/optional-undefined-to-void/basic/actual.js rename to test/fixtures/transformation/spec-undefined-to-void/basic/actual.js diff --git a/test/fixtures/transformation/optional-undefined-to-void/basic/expected.js b/test/fixtures/transformation/spec-undefined-to-void/basic/expected.js similarity index 100% rename from test/fixtures/transformation/optional-undefined-to-void/basic/expected.js rename to test/fixtures/transformation/spec-undefined-to-void/basic/expected.js diff --git a/test/fixtures/transformation/optional-undefined-to-void/member-expression/actual.js b/test/fixtures/transformation/spec-undefined-to-void/member-expression/actual.js similarity index 100% rename from test/fixtures/transformation/optional-undefined-to-void/member-expression/actual.js rename to test/fixtures/transformation/spec-undefined-to-void/member-expression/actual.js diff --git a/test/fixtures/transformation/optional-undefined-to-void/member-expression/expected.js b/test/fixtures/transformation/spec-undefined-to-void/member-expression/expected.js similarity index 100% rename from test/fixtures/transformation/optional-undefined-to-void/member-expression/expected.js rename to test/fixtures/transformation/spec-undefined-to-void/member-expression/expected.js diff --git a/test/fixtures/transformation/spec-undefined-to-void/options.json b/test/fixtures/transformation/spec-undefined-to-void/options.json new file mode 100644 index 0000000000..d8a082be4c --- /dev/null +++ b/test/fixtures/transformation/spec-undefined-to-void/options.json @@ -0,0 +1,3 @@ +{ + "optional": ["spec.undefinedToVoid"] +} diff --git a/test/fixtures/transformation/spec-illegal-top-level-this/arrow-function/actual.js b/test/fixtures/transformation/use-strict/illegal-this-arrow-function/actual.js similarity index 100% rename from test/fixtures/transformation/spec-illegal-top-level-this/arrow-function/actual.js rename to test/fixtures/transformation/use-strict/illegal-this-arrow-function/actual.js diff --git a/test/fixtures/transformation/spec-illegal-top-level-this/options.json b/test/fixtures/transformation/use-strict/illegal-this-arrow-function/options.json similarity index 100% rename from test/fixtures/transformation/spec-illegal-top-level-this/options.json rename to test/fixtures/transformation/use-strict/illegal-this-arrow-function/options.json diff --git a/test/fixtures/transformation/spec-illegal-top-level-this/root-call/actual.js b/test/fixtures/transformation/use-strict/illegal-this-root-call/actual.js similarity index 100% rename from test/fixtures/transformation/spec-illegal-top-level-this/root-call/actual.js rename to test/fixtures/transformation/use-strict/illegal-this-root-call/actual.js diff --git a/test/fixtures/transformation/use-strict/illegal-this-root-call/options.json b/test/fixtures/transformation/use-strict/illegal-this-root-call/options.json new file mode 100644 index 0000000000..c1e1e00456 --- /dev/null +++ b/test/fixtures/transformation/use-strict/illegal-this-root-call/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Top level `this` is not allowed" +} diff --git a/test/fixtures/transformation/spec-illegal-top-level-this/root-declaration/actual.js b/test/fixtures/transformation/use-strict/illegal-this-root-declaration/actual.js similarity index 100% rename from test/fixtures/transformation/spec-illegal-top-level-this/root-declaration/actual.js rename to test/fixtures/transformation/use-strict/illegal-this-root-declaration/actual.js diff --git a/test/fixtures/transformation/use-strict/illegal-this-root-declaration/options.json b/test/fixtures/transformation/use-strict/illegal-this-root-declaration/options.json new file mode 100644 index 0000000000..c1e1e00456 --- /dev/null +++ b/test/fixtures/transformation/use-strict/illegal-this-root-declaration/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Top level `this` is not allowed" +} diff --git a/test/fixtures/transformation/spec-illegal-top-level-this/root-reference/actual.js b/test/fixtures/transformation/use-strict/illegal-this-root-reference/actual.js similarity index 100% rename from test/fixtures/transformation/spec-illegal-top-level-this/root-reference/actual.js rename to test/fixtures/transformation/use-strict/illegal-this-root-reference/actual.js diff --git a/test/fixtures/transformation/use-strict/illegal-this-root-reference/options.json b/test/fixtures/transformation/use-strict/illegal-this-root-reference/options.json new file mode 100644 index 0000000000..c1e1e00456 --- /dev/null +++ b/test/fixtures/transformation/use-strict/illegal-this-root-reference/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Top level `this` is not allowed" +} diff --git a/test/fixtures/transformation/use-strict/add/actual.js b/test/fixtures/transformation/use-strict/use-strict-add/actual.js similarity index 100% rename from test/fixtures/transformation/use-strict/add/actual.js rename to test/fixtures/transformation/use-strict/use-strict-add/actual.js diff --git a/test/fixtures/transformation/use-strict/add/expected.js b/test/fixtures/transformation/use-strict/use-strict-add/expected.js similarity index 100% rename from test/fixtures/transformation/use-strict/add/expected.js rename to test/fixtures/transformation/use-strict/use-strict-add/expected.js diff --git a/test/fixtures/transformation/use-strict/exists/actual.js b/test/fixtures/transformation/use-strict/use-strict-exists/actual.js similarity index 100% rename from test/fixtures/transformation/use-strict/exists/actual.js rename to test/fixtures/transformation/use-strict/use-strict-exists/actual.js diff --git a/test/fixtures/transformation/use-strict/exists/expected.js b/test/fixtures/transformation/use-strict/use-strict-exists/expected.js similarity index 100% rename from test/fixtures/transformation/use-strict/exists/expected.js rename to test/fixtures/transformation/use-strict/use-strict-exists/expected.js diff --git a/test/fixtures/transformation/spec-setters/class-no-args/actual.js b/test/fixtures/transformation/validation-setters/class-no-args/actual.js similarity index 100% rename from test/fixtures/transformation/spec-setters/class-no-args/actual.js rename to test/fixtures/transformation/validation-setters/class-no-args/actual.js diff --git a/test/fixtures/transformation/spec-setters/class-two-args/actual.js b/test/fixtures/transformation/validation-setters/class-two-args/actual.js similarity index 100% rename from test/fixtures/transformation/spec-setters/class-two-args/actual.js rename to test/fixtures/transformation/validation-setters/class-two-args/actual.js diff --git a/test/fixtures/transformation/spec-setters/object-no-args/actual.js b/test/fixtures/transformation/validation-setters/object-no-args/actual.js similarity index 100% rename from test/fixtures/transformation/spec-setters/object-no-args/actual.js rename to test/fixtures/transformation/validation-setters/object-no-args/actual.js diff --git a/test/fixtures/transformation/spec-setters/object-two-args/actual.js b/test/fixtures/transformation/validation-setters/object-two-args/actual.js similarity index 100% rename from test/fixtures/transformation/spec-setters/object-two-args/actual.js rename to test/fixtures/transformation/validation-setters/object-two-args/actual.js diff --git a/test/fixtures/transformation/spec-setters/options.json b/test/fixtures/transformation/validation-setters/options.json similarity index 100% rename from test/fixtures/transformation/spec-setters/options.json rename to test/fixtures/transformation/validation-setters/options.json diff --git a/test/fixtures/transformation/optional-undeclared-variable-check/declared/exec.js b/test/fixtures/transformation/validation-undeclared-variable-check/declared/exec.js similarity index 100% rename from test/fixtures/transformation/optional-undeclared-variable-check/declared/exec.js rename to test/fixtures/transformation/validation-undeclared-variable-check/declared/exec.js diff --git a/test/fixtures/transformation/validation-undeclared-variable-check/options.json b/test/fixtures/transformation/validation-undeclared-variable-check/options.json new file mode 100644 index 0000000000..577e93ea79 --- /dev/null +++ b/test/fixtures/transformation/validation-undeclared-variable-check/options.json @@ -0,0 +1,3 @@ +{ + "optional": ["validation.undeclaredVariableCheck"] +} diff --git a/test/fixtures/transformation/optional-undeclared-variable-check/undeclared/exec.js b/test/fixtures/transformation/validation-undeclared-variable-check/undeclared/exec.js similarity index 100% rename from test/fixtures/transformation/optional-undeclared-variable-check/undeclared/exec.js rename to test/fixtures/transformation/validation-undeclared-variable-check/undeclared/exec.js diff --git a/test/fixtures/transformation/optional-undeclared-variable-check/undeclared/options.json b/test/fixtures/transformation/validation-undeclared-variable-check/undeclared/options.json similarity index 100% rename from test/fixtures/transformation/optional-undeclared-variable-check/undeclared/options.json rename to test/fixtures/transformation/validation-undeclared-variable-check/undeclared/options.json diff --git a/test/fixtures/transformation/spec/for-in-assignment/actual.js b/test/fixtures/transformation/validation/for-in-assignment/actual.js similarity index 100% rename from test/fixtures/transformation/spec/for-in-assignment/actual.js rename to test/fixtures/transformation/validation/for-in-assignment/actual.js diff --git a/test/fixtures/transformation/spec/for-in-assignment/options.json b/test/fixtures/transformation/validation/for-in-assignment/options.json similarity index 100% rename from test/fixtures/transformation/spec/for-in-assignment/options.json rename to test/fixtures/transformation/validation/for-in-assignment/options.json diff --git a/test/fixtures/transformation/spec/for-of-assignment/actual.js b/test/fixtures/transformation/validation/for-of-assignment/actual.js similarity index 100% rename from test/fixtures/transformation/spec/for-of-assignment/actual.js rename to test/fixtures/transformation/validation/for-of-assignment/actual.js diff --git a/test/fixtures/transformation/spec/for-of-assignment/options.json b/test/fixtures/transformation/validation/for-of-assignment/options.json similarity index 100% rename from test/fixtures/transformation/spec/for-of-assignment/options.json rename to test/fixtures/transformation/validation/for-of-assignment/options.json