fix linting errors
This commit is contained in:
parent
e797be518f
commit
e5ae2f8eaf
@ -6,7 +6,7 @@ var util = require("./util");
|
|||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var _ = require("lodash");
|
var _ = require("lodash");
|
||||||
|
|
||||||
module.exports = function (commander, filenames, opts) {
|
module.exports = function (commander, filenames) {
|
||||||
var results = [];
|
var results = [];
|
||||||
|
|
||||||
var buildResult = function () {
|
var buildResult = function () {
|
||||||
@ -48,7 +48,7 @@ module.exports = function (commander, filenames, opts) {
|
|||||||
return {
|
return {
|
||||||
map: map,
|
map: map,
|
||||||
code: code
|
code: code
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var output = function () {
|
var output = function () {
|
||||||
@ -101,7 +101,7 @@ module.exports = function (commander, filenames, opts) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
_.each(_filenames, function (filename, i) {
|
_.each(_filenames, function (filename, i) {
|
||||||
results.push(util.compile(filename, { _noStrict: i != 0 }));
|
results.push(util.compile(filename, { _noStrict: +i !== 0 }));
|
||||||
});
|
});
|
||||||
|
|
||||||
output();
|
output();
|
||||||
|
|||||||
@ -1,13 +1,8 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
var commander = require("commander");
|
var commander = require("commander");
|
||||||
var sourceMap = require("source-map");
|
|
||||||
var transform = require("../../lib/6to5/transform");
|
var transform = require("../../lib/6to5/transform");
|
||||||
var chokidar = require("chokidar");
|
var util = require("../../lib/6to5/util");
|
||||||
var mkdirp = require("mkdirp");
|
|
||||||
var util2 = require("../../lib/6to5/util");
|
|
||||||
var util = require("./util");
|
|
||||||
var path = require("path");
|
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var _ = require("lodash");
|
var _ = require("lodash");
|
||||||
|
|
||||||
@ -17,8 +12,8 @@ commander.option("-f, --filename [filename]", "Filename to use when reading from
|
|||||||
commander.option("-w, --watch", "Recompile files on changes");
|
commander.option("-w, --watch", "Recompile files on changes");
|
||||||
|
|
||||||
commander.option("-m, --modules [modules]", "Module formatter type to use [common]", "common");
|
commander.option("-m, --modules [modules]", "Module formatter type to use [common]", "common");
|
||||||
commander.option("-w, --whitelist [whitelist]", "Whitelist of transformers to ONLY use", util2.list);
|
commander.option("-w, --whitelist [whitelist]", "Whitelist of transformers to ONLY use", util.list);
|
||||||
commander.option("-b, --blacklist [blacklist]", "Blacklist of transformers to NOT use", util2.list);
|
commander.option("-b, --blacklist [blacklist]", "Blacklist of transformers to NOT use", util.list);
|
||||||
commander.option("-o, --out-file [out]", "Compile all input files into a single file");
|
commander.option("-o, --out-file [out]", "Compile all input files into a single file");
|
||||||
commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory");
|
commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory");
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ CodeGenerator.prototype.generate = function (ast, opts) {
|
|||||||
|
|
||||||
CodeGenerator.prototype.buildPrint = function (parent) {
|
CodeGenerator.prototype.buildPrint = function (parent) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var print = function (node) {
|
var print = function (node) {
|
||||||
return self.print(node, parent);
|
return self.print(node, parent);
|
||||||
};
|
};
|
||||||
@ -138,7 +139,6 @@ CodeGenerator.prototype.ArrowFunctionExpression = function (node, print) {
|
|||||||
|
|
||||||
CodeGenerator.prototype.MethodDefinition = function (node, print) {
|
CodeGenerator.prototype.MethodDefinition = function (node, print) {
|
||||||
throw new Error("MethodDefinition");
|
throw new Error("MethodDefinition");
|
||||||
return;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CodeGenerator.prototype.YieldExpression = function (node, print) {
|
CodeGenerator.prototype.YieldExpression = function (node, print) {
|
||||||
@ -189,7 +189,7 @@ CodeGenerator.prototype.BlockStatement = function (node, print) {
|
|||||||
if (body.length === 0) {
|
if (body.length === 0) {
|
||||||
return "{}";
|
return "{}";
|
||||||
} else {
|
} else {
|
||||||
return "{\n" + this.indent(print.sequence(body)) + "\n}"
|
return "{\n" + this.indent(print.sequence(body)) + "\n}";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -223,7 +223,6 @@ CodeGenerator.prototype.ObjectExpression =
|
|||||||
CodeGenerator.prototype.ObjectPattern = function (node, print) {
|
CodeGenerator.prototype.ObjectPattern = function (node, print) {
|
||||||
var allowBreak = false;
|
var allowBreak = false;
|
||||||
var indent = this.indent;
|
var indent = this.indent;
|
||||||
var print = this.buildPrint(node);
|
|
||||||
var parts = [len > 0 ? "{\n" : "{"];
|
var parts = [len > 0 ? "{\n" : "{"];
|
||||||
var len = node.properties.length;
|
var len = node.properties.length;
|
||||||
|
|
||||||
@ -267,7 +266,6 @@ CodeGenerator.prototype.ArrayExpression =
|
|||||||
CodeGenerator.prototype.ArrayPattern = function (node, print) {
|
CodeGenerator.prototype.ArrayPattern = function (node, print) {
|
||||||
var elems = node.elements;
|
var elems = node.elements;
|
||||||
var parts = ["["];
|
var parts = ["["];
|
||||||
var print = this.buildPrint(node);
|
|
||||||
var len = elems.length;
|
var len = elems.length;
|
||||||
|
|
||||||
_.each(elems, function(elem, i) {
|
_.each(elems, function(elem, i) {
|
||||||
@ -358,7 +356,6 @@ CodeGenerator.prototype.NewExpression = function (node, print) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
CodeGenerator.prototype.VariableDeclaration = function (node, print, parent) {
|
CodeGenerator.prototype.VariableDeclaration = function (node, print, parent) {
|
||||||
var print = print;
|
|
||||||
var code = node.kind + " ";
|
var code = node.kind + " ";
|
||||||
var maxLen = 0;
|
var maxLen = 0;
|
||||||
|
|
||||||
@ -371,6 +368,7 @@ CodeGenerator.prototype.VariableDeclaration = function (node, print, parent) {
|
|||||||
switch (maxLen) {
|
switch (maxLen) {
|
||||||
case 0:
|
case 0:
|
||||||
code += printed[0];
|
code += printed[0];
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
code += printed.join(",\n ");
|
code += printed.join(",\n ");
|
||||||
@ -410,7 +408,7 @@ CodeGenerator.prototype.ForStatement = function (node, print) {
|
|||||||
var code = "for (";
|
var code = "for (";
|
||||||
code += print(node.init) + "; ";
|
code += print(node.init) + "; ";
|
||||||
code += print(node.test) + "; ";
|
code += print(node.test) + "; ";
|
||||||
code += print(node.update)
|
code += print(node.update);
|
||||||
code += ") ";
|
code += ") ";
|
||||||
code += print(node.body);
|
code += print(node.body);
|
||||||
return code;
|
return code;
|
||||||
@ -559,7 +557,7 @@ CodeGenerator.prototype._method = function (kind, key, value, print) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return parts.join("");
|
return parts.join("");
|
||||||
}
|
};
|
||||||
|
|
||||||
CodeGenerator.prototype.MethodDefinition = function (node, print) {
|
CodeGenerator.prototype.MethodDefinition = function (node, print) {
|
||||||
var parts = [];
|
var parts = [];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user