🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@templatical/quality

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@templatical/quality

Accessibility linter for Templatical email templates

latest
Source
npmnpm
Version
0.10.4
Version published
Weekly downloads
1.8K
23.39%
Maintainers
1
Weekly downloads
 
Created
Source

@templatical/quality

Accessibility linter for Templatical email templates. Runs in the browser or on Node.

npm version License

Deterministic accessibility checks against the JSON TemplateContent block tree — missing alt text, low-contrast text and buttons, vague link / CTA copy, heading-skip, undersized touch targets, and more. Same package validates inside the editor (live sidebar tab + canvas badges) and in headless / CI checks.

MIT-licensed, JSON-only, no Vue, no DOM. Optional peer of @templatical/editor.

Install

npm install @templatical/quality

Usage

Headless

import { lintAccessibility } from "@templatical/quality";
import type { TemplateContent } from "@templatical/types";

const content: TemplateContent = JSON.parse(stored);
const issues = lintAccessibility(content);

for (const issue of issues) {
  console.log(`[${issue.severity}] ${issue.ruleId}: ${issue.message}`);
}

lintAccessibility(content, options?) is synchronous and pure — no DOM, no network, no fetch.

Editor

@templatical/editor lazy-imports this package on demand. Pass accessibility to init() / initCloud():

import { init } from "@templatical/editor";

init({
  container: "#editor",
  locale: "en",
  accessibility: {
    rules: {
      "img-missing-alt": "warning",
      "text-all-caps": "off",
    },
    thresholds: { minFontSize: 16 },
  },
});

The sidebar tab and inline canvas badges appear automatically once this peer is resolved.

Custom rules

Compose your own walkers using the same primitives the package ships:

import { walkBlocks, getContrastRatio } from "@templatical/quality";

walkBlocks(content, (block, ctx) => {
  if (block.type === "title" && block.color) {
    const ratio = getContrastRatio(block.color, ctx.resolvedBackgroundColor);
    if (ratio < 4.5) {
      console.warn(`Heading ${block.id} contrast ${ratio.toFixed(2)}:1`);
    }
  }
});

Docs

Keywords

a11y

FAQs

Package last updated on 15 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts