mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
fix(ci): collection lookups typed as partial, card formatting, two unused exports, and the format check says when Prettier gave up
This commit is contained in:
@@ -31,11 +31,16 @@ export async function isFormatted(path) {
|
||||
if (!options) throw new RatchetError(`no Prettier config applies to ${path}`);
|
||||
try {
|
||||
return await prettier.check(readText(path), { ...options, filepath: path });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
stopped.set(path, String(err instanceof Error ? err.message : err).split('
|
||||
')[0]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Why Prettier gave up on a file, by its path, so the failure line can say it was not about style. */
|
||||
const stopped = new Map();
|
||||
|
||||
/** The files under root that Prettier would rewrite, keyed by their path from root. */
|
||||
export async function unformatted(root) {
|
||||
const found = [];
|
||||
@@ -74,6 +79,8 @@ export async function check({
|
||||
if (list) for (const key of found) log(`${allowed.has(key) ? 'listed' : 'new '} ${key}`);
|
||||
for (const key of fresh) {
|
||||
error(`FAIL ${key} is not formatted. Run: npx prettier --write ${key}`);
|
||||
const why = stopped.get(join(root, key));
|
||||
if (why) error(` Prettier could not format it: ${why}`);
|
||||
}
|
||||
for (const key of stale) {
|
||||
error(`FAIL ${key} is listed in scripts/format-baseline.json but is formatted now or gone.`);
|
||||
|
||||
Reference in New Issue
Block a user