From d66cafa6ee208cd25e9ece208b7b3231d8aba29b Mon Sep 17 00:00:00 2001 From: Guilherme Lima Date: Sun, 10 Dec 2017 08:45:50 -0200 Subject: [PATCH] fix: Stop after linting first file and add prettier config --- src/lib.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/lib.js b/src/lib.js index 8f439b5..9bf95c0 100644 --- a/src/lib.js +++ b/src/lib.js @@ -19,19 +19,21 @@ class PrettierVue { this.modified = {} this.prettierOpts = {} - if (opts._ && opts._.length) { - const path = `${this.baseDir}/${opts._[0]}` + prettier.resolveConfig(this.configPath).then(options => { + this.prettierOpts = options + + if (opts._ && opts._.length) { + const path = `${this.baseDir}/${opts._[0]}` - if (!isVueSFC(path)) { + if (!isVueSFC(path)) { + return + } + + this.format(path) + this.writeModified() return } - this.format(path) - this.writeModified() - } - - prettier.resolveConfig(this.configPath).then(options => { - this.prettierOpts = options this.searchFiles() }) }