mirror of
https://github.com/yldio/copilot.git
synced 2024-11-14 07:10:05 +02:00
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:
parent
ea478ca689
commit
c327f9f1ef
@ -31,6 +31,12 @@ const filter = (files = []) =>
|
|||||||
.filter(file => !optOut.some(pkg => file.indexOf(pkg) === 0));
|
.filter(file => !optOut.some(pkg => file.indexOf(pkg) === 0));
|
||||||
|
|
||||||
const run = async (files = []) => {
|
const run = async (files = []) => {
|
||||||
|
const filteredFiles = filter(files);
|
||||||
|
|
||||||
|
if (!filteredFiles.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const cp = execa(
|
const cp = execa(
|
||||||
'prettier',
|
'prettier',
|
||||||
['--write', '--single-quote'].concat(filter(files))
|
['--write', '--single-quote'].concat(filter(files))
|
||||||
|
Loading…
Reference in New Issue
Block a user