Add Prettier and ESLint tooling (Refs #77)
This commit is contained in:
@@ -12,15 +12,21 @@ async function visit(directory) {
|
||||
const source = await readFile(file, 'utf8');
|
||||
for (const match of source.matchAll(/font-size\s*:\s*[\d.]+px\b/g)) {
|
||||
const line = source.slice(0, match.index).split('\n').length;
|
||||
failures.push(`${path.relative(process.cwd(), file)}:${line}: use a shared type token (12 px minimum): ${match[0]}`);
|
||||
failures.push(
|
||||
`${path.relative(process.cwd(), file)}:${line}: use a shared type token (12 px minimum): ${match[0]}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await visit(root);
|
||||
const tokens = await readFile(path.join(root, 'lib/ui/styles/tokens.css'), 'utf8');
|
||||
for (const match of tokens.matchAll(/--text-(?:xs|sm|base|md|lg|xl|2xl|3xl|input):\s*([\d.]+)px/g)) {
|
||||
for (const match of tokens.matchAll(
|
||||
/--text-(?:xs|sm|base|md|lg|xl|2xl|3xl|input):\s*([\d.]+)px/g
|
||||
)) {
|
||||
if (Number(match[1]) < 12) failures.push(`Type tokens must be at least 12 px: ${match[0]}`);
|
||||
}
|
||||
if (failures.length) { console.error(failures.join('\n')); process.exitCode = 1; }
|
||||
else console.log('UI styles: shared font sizes and 12 px minimum verified.');
|
||||
if (failures.length) {
|
||||
console.error(failures.join('\n'));
|
||||
process.exitCode = 1;
|
||||
} else console.log('UI styles: shared font sizes and 12 px minimum verified.');
|
||||
|
||||
Reference in New Issue
Block a user