From c68cb5e74815e1e841263140d7ee3e35e70883eb Mon Sep 17 00:00:00 2001 From: atomiks Date: Thu, 28 Dec 2017 17:59:47 +1100 Subject: [PATCH] Use prettier in the cmd --- scripts/lint-script.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/scripts/lint-script.js b/scripts/lint-script.js index a42cd29a3..1840654b5 100644 --- a/scripts/lint-script.js +++ b/scripts/lint-script.js @@ -7,7 +7,6 @@ const fs = require('fs-extra'); const cp = require('child_process'); const path = require('path'); const chalk = require('chalk'); -const prettier = require('prettier'); const SNIPPETS_PATH = './snippets'; const TEMP_PATH = './temp'; @@ -46,7 +45,10 @@ try { }); } - cp.exec(`semistandard "${TEMP_PATH}" --fix`, {}, (err, stdout, stderr) => { + const cmd = `semistandard "${TEMP_PATH}" --fix & ` + + `prettier "${TEMP_PATH}/*.js" --single-quote --print-width=100 --write` + + cp.exec(cmd, {}, (err, stdout, stderr) => { // Loop through each snippet now that semistandard has done its job, // run prettier and write to the files for (const snippet of snippets) { @@ -54,16 +56,7 @@ try { const lintedCode = []; for (const tempName of snippet.tempNames) { - let data = fs.readFileSync(`${TEMP_PATH}/${tempName}.js`, 'utf8'); - // prettier sometimes throws an error.. - try { - data = prettier.format(data, { - printWidth: 100, - singleQuote: true - }); - } catch (e) {} - - lintedCode.push(data); + lintedCode.push(fs.readFileSync(`${TEMP_PATH}/${tempName}.js`, 'utf8')); fs.unlink(`${TEMP_PATH}/${tempName}.js`); }