diff --git a/.jshintrc b/.jshintrc index f6a65273be..e61fe4778e 100644 --- a/.jshintrc +++ b/.jshintrc @@ -2,6 +2,7 @@ "esnext": true, "indent": 2, "freeze": true, + "validthis": true, "camelcase": true, "unused": true, "eqnull": true, diff --git a/lib/6to5/transformation/file.js b/lib/6to5/transformation/file.js index e93a3bd07d..8ee4b9d312 100644 --- a/lib/6to5/transformation/file.js +++ b/lib/6to5/transformation/file.js @@ -348,8 +348,6 @@ File.prototype.parse = function (code) { }; File.prototype.transform = function (ast) { - var self = this; - this.debug(); this.ast = ast; diff --git a/lib/6to5/transformation/helpers/remap-async-to-generator.js b/lib/6to5/transformation/helpers/remap-async-to-generator.js index 1161832439..fd5aacac31 100644 --- a/lib/6to5/transformation/helpers/remap-async-to-generator.js +++ b/lib/6to5/transformation/helpers/remap-async-to-generator.js @@ -3,7 +3,7 @@ var t = require("../../types"); var visitor = { - enter: function (node, parent, scope) { + enter: function (node) { if (t.isFunction(node)) this.skip(); if (t.isAwaitExpression(node)) { diff --git a/lib/6to5/transformation/transformer-pass.js b/lib/6to5/transformation/transformer-pass.js index 9b16df92f2..a4a030bfc2 100644 --- a/lib/6to5/transformation/transformer-pass.js +++ b/lib/6to5/transformation/transformer-pass.js @@ -1,6 +1,5 @@ module.exports = TransformerPass; -var util = require("../util"); var contains = require("lodash/collection/contains"); /** diff --git a/lib/6to5/transformation/transformers/minification/dead-code-elimination.js b/lib/6to5/transformation/transformers/minification/dead-code-elimination.js index b5ded93996..eb94292989 100644 --- a/lib/6to5/transformation/transformers/minification/dead-code-elimination.js +++ b/lib/6to5/transformation/transformers/minification/dead-code-elimination.js @@ -2,7 +2,7 @@ var t = require("../../../types"); exports.optional = true; -exports.ExpressionStatement = function (node, parent, scope) { +exports.ExpressionStatement = function (node) { // remove consequenceless expressions such as local variables and literals // // var foo = true; foo; -> var foo = true; @@ -16,7 +16,7 @@ exports.ExpressionStatement = function (node, parent, scope) { }; exports.IfStatement = { - exit: function (node, parent, scope) { + exit: function (node) { // todo: in scenarios where we can just return the consequent or // alternate we should drop the block statement if it contains no // block scoped variables diff --git a/lib/6to5/transformation/transformers/minification/remove-console-calls.js b/lib/6to5/transformation/transformers/minification/remove-console-calls.js index bac1650af9..afdb72f233 100644 --- a/lib/6to5/transformation/transformers/minification/remove-console-calls.js +++ b/lib/6to5/transformation/transformers/minification/remove-console-calls.js @@ -6,7 +6,7 @@ var isConsole = t.buildMatchMemberExpression("console", true); exports.optional = true; -exports.CallExpression = function (node, parent, scope) { +exports.CallExpression = function (node) { if (isConsole(node.callee)) { this.remove(); } diff --git a/lib/6to5/transformation/transformers/minification/remove-debugger.js b/lib/6to5/transformation/transformers/minification/remove-debugger.js index b8950c888a..ae2eca0b0a 100644 --- a/lib/6to5/transformation/transformers/minification/remove-debugger.js +++ b/lib/6to5/transformation/transformers/minification/remove-debugger.js @@ -2,7 +2,7 @@ var t = require("../../../types"); exports.optional = true; -exports.ExpressionStatement = function (node, parent, scope) { +exports.ExpressionStatement = function (node) { if (t.isIdentifier(node.expression, { name: "debugger" })) { this.remove(); } diff --git a/lib/6to5/transformation/transformers/minification/rename-local-variables.js b/lib/6to5/transformation/transformers/minification/rename-local-variables.js index 56a8a43699..946de0c386 100644 --- a/lib/6to5/transformation/transformers/minification/rename-local-variables.js +++ b/lib/6to5/transformation/transformers/minification/rename-local-variables.js @@ -5,6 +5,7 @@ exports.optional = true; exports.Scope = function () { // todo: get all binding identifiers, generate compact names // that wont collide and then call the remap identifier helper + // this transformer **has** to be ran last as it will absolutley // destroy the scope tree }; diff --git a/lib/6to5/transformation/transformers/other/self-contained.js b/lib/6to5/transformation/transformers/other/self-contained.js index 5cfb06f95c..d97b4063ad 100644 --- a/lib/6to5/transformation/transformers/other/self-contained.js +++ b/lib/6to5/transformation/transformers/other/self-contained.js @@ -68,7 +68,7 @@ exports.post = function (file) { file.scope.traverse(file.ast, astVisitor, file); }; -exports.pre = function ( file) { +exports.pre = function (file) { file.setDynamic("runtimeIdentifier", function () { return file.addImport("6to5-runtime/helpers", "to5Helpers"); }); diff --git a/lib/6to5/transformation/transformers/other/use-strict.js b/lib/6to5/transformation/transformers/other/use-strict.js index 3a7db8257e..fa5462911b 100644 --- a/lib/6to5/transformation/transformers/other/use-strict.js +++ b/lib/6to5/transformation/transformers/other/use-strict.js @@ -11,7 +11,7 @@ exports.post = function (file) { }; exports.FunctionDeclaration = -exports.FunctionExpression = function (node, parent, scope) { +exports.FunctionExpression = function () { this.skip(); };