Skip to content

Commit

Permalink
feat: Fail on fix (prettier#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
josejulio committed Dec 12, 2018
1 parent 157d4b1 commit 4f0a9b9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/pretty-quick.js
Expand Up @@ -7,7 +7,12 @@ const mri = require('mri');

const prettyQuick = require('..').default;

const args = mri(process.argv.slice(2));
const args = mri(process.argv.slice(2), {
boolean: ['fail-on-fix'],
default: { 'fail-on-fix': false },
});

const failOnFix = args['fail-on-fix'];

let success = true;
prettyQuick(
Expand Down Expand Up @@ -36,6 +41,9 @@ prettyQuick(

onWriteFile: file => {
console.log(`✍️ Fixing up ${chalk.bold(file)}.`);
if (failOnFix) {
success = false;
}
},

onExamineFile: file => {
Expand Down

0 comments on commit 4f0a9b9

Please sign in to comment.