npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@octaviaflow/accessibility-checker

v1.1.2

Published

Accessibility checker for OctaviaFlow Design System - A custom implementation

Downloads

21

Readme

@octaviaflow/accessibility-checker

Enterprise-grade accessibility checker for OctaviaFlow Design System

A comprehensive TypeScript-based accessibility testing tool that combines heuristic analysis with axe-core integration to provide detailed accessibility reports in multiple formats.

🚀 Features

  • 🔍 Dual Analysis Engine: Combines custom heuristics with axe-core for comprehensive accessibility testing
  • 📊 Multiple Output Formats: JSON, HTML, CSV, and Excel reports
  • 🎨 Beautiful HTML Reports: Responsive, styled reports with issue categorization
  • ⚡ High Performance: Built with TypeScript and optimized for speed
  • 🛠️ CLI & Programmatic API: Use as command-line tool or integrate into your workflow
  • 📈 WCAG Compliance: Maps issues to WCAG guidelines with help URLs
  • 🔧 Extensible Architecture: Easy to add custom rules and checks

📦 Installation

NPM/Yarn

npm install @octaviaflow/accessibility-checker
# or
yarn add @octaviaflow/accessibility-checker

Bun

bun add @octaviaflow/accessibility-checker

Global Installation

npm install -g @octaviaflow/accessibility-checker

🎯 Quick Start

CLI Usage

# Analyze an HTML file
octaviaflow-achecker --input index.html

# Generate HTML report
octaviaflow-achecker --input page.html --format html --verbose

# Test with sample HTML
octaviaflow-achecker --sample --format excel

# Custom output location
octaviaflow-achecker --input app.html --output reports/accessibility.json

Programmatic Usage

import { analyze } from '@octaviaflow/accessibility-checker';
import { saveReport } from '@octaviaflow/accessibility-checker/storage';

// Analyze HTML content
const html = '<html><body><img src="logo.png"><h1>Welcome</h1></body></html>';
const result = await analyze(html);

// Save results in different formats
await saveReport(result, './report.json', 'json');
await saveReport(result, './report.html', 'html');
await saveReport(result, './report.xlsx', 'excel');

console.log(`Found ${result.summary.totalIssues} accessibility issues`);

📋 CLI Options

| Option | Alias | Description | Default | |--------|-------|-------------|---------| | --input <file> | -i | HTML file to analyze | - | | --output <file> | -o | Output file path | ./data/results.json | | --format <type> | - | Output format: json, html, csv, excel | json | | --sample | - | Run with sample HTML for testing | false | | --verbose | -v | Verbose output with detailed logging | false | | --help | -h | Show help message | - |

📊 Output Formats

JSON Format

{
  "summary": {
    "totalIssues": 3,
    "byType": {
      "image-missing-alt": 1,
      "link-empty": 1,
      "axe:color-contrast": 1
    },
    "axeViolations": 1
  },
  "issues": [
    {
      "type": "image-missing-alt",
      "message": "Image tag missing alt attribute",
      "snippet": "<img src=\"logo.png\">",
      "source": "heuristic"
    }
  ],
  "axe": { /* Full axe-core results */ },
  "meta": {
    "timestamp": "2025-11-13T10:52:00.000Z",
    "source": "index.html",
    "version": "1.1.1"
  }
}

HTML Report

  • Responsive design with modern styling
  • Color-coded issues by severity and type
  • Interactive elements with expandable details
  • Summary dashboard with metrics
  • WCAG compliance mapping

Excel Report

  • Summary sheet with overview metrics
  • Issues sheet with detailed findings
  • Formatted tables with proper styling
  • Multiple worksheets for organization

🔧 Development

Prerequisites

  • Node.js ≥ 22.0.0
  • Bun ≥ 1.3.2 (recommended)
  • TypeScript ≥ 5.8.3

Setup

# Clone the repository
git clone https://github.com/OctaviaFlow/OctaviaFlow-Design-System.git
cd OctaviaFlow-Design-System/packages/accessibility-checker

# Install dependencies
bun install

# Build the project
bun run build

# Run tests
bun run test

# Run linting
bun run lint

# Development mode
bun run dev

Scripts

| Script | Description | |--------|-------------| | bun run build | Build CommonJS, ESM, and TypeScript declarations | | bun run test | Run tests once and exit | | bun run test:watch | Run tests in watch mode | | bun run lint | Run ESLint | | bun run lint:fix | Fix ESLint issues | | bun run format | Format code with Prettier | | bun run ci-check | Full CI pipeline (build + test + lint) | | bun run dev | Build and run sample |

🏗️ Architecture

Core Components

src/
├── checker/
│   └── index.ts          # Main analysis engine
├── storage/
│   └── reportWriter.ts   # Multi-format report generation
├── utils/
│   └── wcag-rules.ts     # WCAG compliance mapping
└── index.ts              # CLI interface

Analysis Engine

The accessibility checker uses a dual-engine approach:

  1. Heuristic Analysis: Fast, lightweight checks for common issues

    • Missing alt attributes on images
    • Empty links and headings
    • Basic structural problems
  2. Axe-Core Integration: Comprehensive WCAG compliance testing

    • Color contrast analysis
    • Keyboard navigation
    • ARIA compliance
    • Semantic structure validation

Type Definitions

interface Issue {
  type: string;
  message: string;
  snippet?: string;
  helpUrl?: string;
  source?: string;
}

interface Result {
  summary: {
    totalIssues: number;
    byType: Record<string, number>;
    axeViolations?: number;
  };
  issues: Issue[];
  axe?: AxeResults | { error: string };
  meta?: ResultMeta;
}

🎨 Examples

Basic HTML Analysis

import { analyze } from '@octaviaflow/accessibility-checker';

const html = `
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Test Page</title>
</head>
<body>
  <h1>Welcome</h1>
  <img src="hero.jpg">
  <a href="/about"></a>
  <button style="color: #ccc; background: #ddd;">Click me</button>
</body>
</html>
`;

const result = await analyze(html);
console.log(`Found ${result.summary.totalIssues} issues:`);
result.issues.forEach(issue => {
  console.log(`- ${issue.type}: ${issue.message}`);
});

CI/CD Integration

# GitHub Actions example
- name: Accessibility Check
  run: |
    octaviaflow-achecker --input dist/index.html --format json --output accessibility-report.json
    
- name: Upload Report
  uses: actions/upload-artifact@v3
  with:
    name: accessibility-report
    path: accessibility-report.json

Custom Report Generation

import { analyze, saveReport } from '@octaviaflow/accessibility-checker';

async function generateAccessibilityReport(htmlFiles: string[]) {
  const results = [];
  
  for (const file of htmlFiles) {
    const html = await fs.readFile(file, 'utf8');
    const result = await analyze(html);
    result.meta = { ...result.meta, source: file };
    results.push(result);
  }
  
  // Generate combined report
  const combinedResult = {
    summary: {
      totalIssues: results.reduce((sum, r) => sum + r.summary.totalIssues, 0),
      byType: results.reduce((acc, r) => {
        Object.entries(r.summary.byType).forEach(([type, count]) => {
          acc[type] = (acc[type] || 0) + count;
        });
        return acc;
      }, {})
    },
    issues: results.flatMap(r => r.issues),
    meta: {
      timestamp: new Date().toISOString(),
      source: 'batch-analysis',
      fileCount: htmlFiles.length
    }
  };
  
  await saveReport(combinedResult, './batch-report.html', 'html');
}

Integration with Testing Frameworks

// Jest/Vitest example
import { analyze } from '@octaviaflow/accessibility-checker';

describe('Accessibility Tests', () => {
  test('homepage should be accessible', async () => {
    const html = await getRenderedHTML('/');
    const result = await analyze(html);
    
    expect(result.summary.totalIssues).toBe(0);
  });
  
  test('should have no critical axe violations', async () => {
    const html = await getRenderedHTML('/dashboard');
    const result = await analyze(html);
    
    if (result.axe && 'violations' in result.axe) {
      const criticalViolations = result.axe.violations.filter(
        v => v.impact === 'critical'
      );
      expect(criticalViolations).toHaveLength(0);
    }
  });
});

🔧 Configuration

ESLint Integration

The package uses ESLint v9 with flat config:

// eslint.config.js
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import js from '@eslint/js';

export default [
  js.configs.recommended,
  {
    files: ['**/*.ts'],
    languageOptions: {
      parser: tsParser,
      parserOptions: {
        ecmaVersion: 2022,
        sourceType: 'module'
      }
    },
    plugins: {
      '@typescript-eslint': typescriptEslint
    },
    rules: {
      '@typescript-eslint/no-explicit-any': 'warn',
      'no-console': 'off'
    }
  }
];

TypeScript Configuration

Uses unified OctaviaFlow TypeScript configs:

{
  "extends": "typescript-config-octaviaflow/base",
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "dist"
  }
}

🚀 Performance

  • Fast Analysis: Optimized for large HTML files
  • Memory Efficient: Streaming analysis for large documents
  • Concurrent Processing: Parallel heuristic and axe-core analysis
  • Minimal Dependencies: Lightweight package with essential dependencies only

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • TypeScript: All code must be properly typed
  • Testing: Maintain 100% test coverage for new features
  • Linting: Follow ESLint configuration
  • Documentation: Update README for new features

📄 License

Licensed under the Apache-2.0 License. See LICENSE file for details.

🔗 Related Packages

📞 Support


Made with ❤️ by the OctaviaFlow Team