Skip to content

thedaviddias/Front-End-Checklist / packages/cli

frontendchecklist

Verified

Review frontend code and live pages against the Front-End Checklist (380+ rules for accessibility, performance, SEO, security, HTML, CSS, JavaScript, images, i18n, privacy, testing) using the `frontendchecklist` CLI. Use when writing, reviewing, or shipping HTML/CSS/JS/JSX/TSX/Vue/Svelte/Astro code, before a commit or PR, or when asked to audit a public URL.

FileKindSize
.gitignoreother6 B
README.mdmarkdown2.4 KB
SKILL.mdskill md2.7 KB
package.jsonmanifest1.5 KB
scripts/build.tsscript1.9 KB
src/args.tsscript5.5 KB
src/commands/audit.tsscript2.8 KB
src/commands/lookup.tsscript5.0 KB
src/commands/review.tsscript3.9 KB
src/content.tsscript1.5 KB
src/index.tsscript2.9 KB
src/output.tsscript3.3 KB
src/spec.tsscript5.1 KB
tests/cli.test.mjsscript4.6 KB
tsconfig.jsonconfig202 B

src/output.ts

View on GitHub
import type { Priority } from '@repo/types'
import type { OutputFormat } from './args'

/** One finding, normalized across `review` (per file) and `audit` (per URL). */
export interface Finding {
  target: string
  rule: string
  title: string
  priority: Priority
  issue: string
  fix?: string
}

/**
 * Write a JSON document to stdout (machine-readable contract).
 *
 * @param value - Serializable value.
 */
export function writeJson(value: unknown): void {
  process.stdout.write(`${JSON.stringify(value, null, 2)}\n`)
}

/**
 * Write plain lines to stdout.
 *
 * @param lines - Lines to print.
 */
export function writeLines(lines: string[]): void {
  process.stdout.write(`${lines.join('\n')}\n`)
}

/**
 * Escape text for HTML output.
 *
 * @param text - Raw text.
 * @returns Escaped text.
 */
function escapeHtml(text: string): string {
  return text
    .replace(/&/g, '&')
    .replace(/</g, '&lt;')
    .replace(/>/g, '&gt;')
    .replace(/"/g, '&quot;')
}

/**
 * Render findings as Markdown.
 *
 * @param title - Report heading.
 * @param findings - Findings to list.
 * @returns Markdown text.
 */
function findingsMarkdown(title: string, findings: Finding[]): string {
  const rows = findings.map(
    f => `| ${f.priority} | \`${f.rule}\` | ${f.target} | ${f.issue.replace(/\|/g, '\\|')} |`
  )
  return [
    `# ${title}`,
    '',
    `${findings.length} issue(s).`,
    '',
    '| Priority | Rule | Target | Issue |',
    '| --- | --- | --- | --- |',
    ...rows
  ].join('\n')
}

/**
 * Render findings as a standalone HTML page.
 *
 * @param title - Report heading.
 * @param findings - Findings to list.
 * @returns HTML document.
 */
function findingsHtml(title: string, findings: Finding[]): string {
  const rows = findings
    .map(
      f =>
        `<tr><td>${escapeHtml(f.priority)}</td><td><code>${escapeHtml(f.rule)}</code></td><td>${escapeHtml(f.target)}</td><td>${escapeHtml(f.issue)}</td></tr>`
    )
    .join('\n')
  return `<!doctype html><html lang="en"><head><meta charset="utf-8"><title>${escapeHtml(title)}</title></head><body><h1>${escapeHtml(title)}</h1><table><thead><tr><th>Priority</th><th>Rule</th><th>Target</th><th>Issue</th></tr></thead><tbody>${rows}</tbody></table></body></html>`
}

/**
 * Render findings for a terminal.
 *
 * @param title - Report heading.
 * @param findings - Findings to list.
 * @returns Lines of text.
 */
function findingsText(title: string, findings: Finding[]): string[] {
  if (findings.length === 0) return [title, '', 'No provable static issues found.']
  return [
    title,
    '',
    ...findings.map(
      f => `[${f.priority.toUpperCase()}] ${f.title} (${f.rule}) — ${f.target}\n  ${f.issue}`
    ),
    '',
    `${findings.length} issue(s). Details: frontendchecklist rule <slug>`
  ]
}

/**
 * Print a findings report in the requested format.
 *
 * @param format - Output format.
 * @param title - Report heading.
 * @param findings - Findings to print.
 * @param payload - Full JSON payload for `json` output.
 */
export function printFindings(
  format: OutputFormat,
  title: string,
  findings: Finding[],
  payload: unknown
): void {
  if (format === 'json') {
    writeJson(payload)
  } else if (format === 'md') {
    writeLines([findingsMarkdown(title, findings)])
  } else if (format === 'html') {
    writeLines([findingsHtml(title, findings)])
  } else {
    writeLines(findingsText(title, findings))
  }
}
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall