feat: establish tokenized kanban design foundation
This commit is contained in:
parent
d82452b89c
commit
ce2010fd92
18 changed files with 1544 additions and 162 deletions
34
tests/guards/no-inline-style-in-kanban.test.mjs
Normal file
34
tests/guards/no-inline-style-in-kanban.test.mjs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
|
||||
const ROOT = process.cwd();
|
||||
const TARGET_DIRS = ['src/components/kanban', 'src/components/shared'];
|
||||
const INLINE_STYLE_PATTERN = /\bstyle\s*=\s*\{\s*\{/m;
|
||||
|
||||
async function collectTsxFiles(relativeDir) {
|
||||
const absoluteDir = path.join(ROOT, relativeDir);
|
||||
const entries = await fs.readdir(absoluteDir, { withFileTypes: true });
|
||||
return entries
|
||||
.filter((entry) => entry.isFile() && entry.name.endsWith('.tsx'))
|
||||
.map((entry) => path.join(absoluteDir, entry.name));
|
||||
}
|
||||
|
||||
test('kanban and shared components do not use inline style objects', async () => {
|
||||
const files = (await Promise.all(TARGET_DIRS.map(collectTsxFiles))).flat();
|
||||
const offenders = [];
|
||||
|
||||
for (const filePath of files) {
|
||||
const content = await fs.readFile(filePath, 'utf8');
|
||||
if (INLINE_STYLE_PATTERN.test(content)) {
|
||||
offenders.push(path.relative(ROOT, filePath));
|
||||
}
|
||||
}
|
||||
|
||||
assert.deepEqual(
|
||||
offenders,
|
||||
[],
|
||||
`Inline style objects found in: ${offenders.join(', ')}`,
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue