style: Run prettier on the source code

master
Andrey Okonetchnikov 2017-01-10 21:45:04 +01:00
parent 1a77d072cc
commit 85dc8eb118
1 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@ const argv = minimist(process.argv.slice(2), {
}); });
const filenames = argv["_"]; const filenames = argv["_"];
const write = argv['write']; const write = argv["write"];
if (!filenames.length) { if (!filenames.length) {
console.log( console.log(
@ -40,16 +40,16 @@ filenames.forEach(filename => {
} }
const output = jscodefmt.format(input, { const output = jscodefmt.format(input, {
printWidth: argv['print-width'], printWidth: argv["print-width"],
tabWidth: argv['tab-width'], tabWidth: argv["tab-width"],
bracketSpacing: argv['bracket-spacing'], bracketSpacing: argv["bracket-spacing"],
useFlowParser: argv['flow-parser'], useFlowParser: argv["flow-parser"],
singleQuote: argv["single-quote"], singleQuote: argv["single-quote"],
trailingComma: argv["trailing-comma"] trailingComma: argv["trailing-comma"]
}); });
if (write) { if (write) {
fs.writeFile(filename, output, "utf8", (err) => { fs.writeFile(filename, output, "utf8", err => {
if (err) { if (err) {
console.error("Unable to write file: " + filename + "\n" + err); console.error("Unable to write file: " + filename + "\n" + err);
// Don't exit the process if one file failed // Don't exit the process if one file failed
@ -59,5 +59,5 @@ filenames.forEach(filename => {
} else { } else {
console.log(output); console.log(output);
} }
}) });
}) });