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
This commit is contained in:
Sérgio Ramos 2017-05-26 12:02:19 +01:00
parent ea478ca689
commit c327f9f1ef
1 changed files with 6 additions and 0 deletions

View File

@ -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))