Commit 152059fe by Ryan McKinley Committed by GitHub

Toolkit: fix prettier error reporting (#21599)

parent d2b08c83
...@@ -87,22 +87,23 @@ export const prettierCheckPlugin = useSpinner<Fixable>('Prettier check', async ( ...@@ -87,22 +87,23 @@ export const prettierCheckPlugin = useSpinner<Fixable>('Prettier check', async (
} }
}) })
.then(newContents => { .then(newContents => {
if (fix && newContents && newContents.length > 10) { if (newContents === undefined) {
return writeFile(path, newContents) return true; // Nothing to fix
.then(() => {
console.log(`Fixed: ${path}`);
return true;
})
.catch(error => {
console.log(`Error fixing ${path}`, error);
return false;
});
} else if (fix) { } else if (fix) {
if (newContents.length > 10) {
return writeFile(path, newContents)
.then(() => {
console.log(`Fixed: ${path}`);
return true;
})
.catch(error => {
console.log(`Error fixing ${path}`, error);
return false;
});
}
console.log(`No automatic fix for: ${path}`); console.log(`No automatic fix for: ${path}`);
return false;
} else {
return false;
} }
return false;
}) })
.then(success => ({ path, success })) .then(success => ({ path, success }))
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment