From c327f9f1efae6ab16422a4ac2bb3c548b5ca6536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Fri, 26 May 2017 12:02:19 +0100 Subject: [PATCH] chore: handle empty files array in format-staged if format-staged is run and after filtering by opt-out no files are left, it tries to format everything --- scripts/format | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/format b/scripts/format index 8c8113e6..f2edb54a 100755 --- a/scripts/format +++ b/scripts/format @@ -31,6 +31,12 @@ const filter = (files = []) => .filter(file => !optOut.some(pkg => file.indexOf(pkg) === 0)); const run = async (files = []) => { + const filteredFiles = filter(files); + + if (!filteredFiles.length) { + return; + } + const cp = execa( 'prettier', ['--write', '--single-quote'].concat(filter(files))