🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@sa11y/common

Package Overview
Dependencies
Maintainers
4
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sa11y/common

Common utilities, constants, error messages for @sa11y

7.2.9
latest
Source
npm
Version published
Weekly downloads
15K
-8.55%
Maintainers
4
Weekly downloads
 
Created
Source

@sa11y/common

Common utilities, constants, error messages, and helper functions for @sa11y packages.

  • Overview
  • Utilities
  • Environment Variables

Overview

This package provides shared functionality used across all @sa11y packages. It includes utilities for environment detection, custom rule management, file processing, and result handling.

Utilities

Environment Detection

import { log, isFakeTimerUsed } from '@sa11y/common';

// Debug logging (only outputs when SA11Y_DEBUG is set)
log('Debug message');

// Check if fake timers are being used
if (isFakeTimerUsed()) {
    // Handle fake timer scenario
}

Custom Rules

import { useCustomRules, registerCustomRules } from '@sa11y/common';

// Load custom rules from environment
const customRules = useCustomRules();

// Register custom axe rules
registerCustomRules(changesData, rulesData, checkData);

File Processing

import { processFiles, writeHtmlFileInPath } from '@sa11y/common';

// Process files in a directory
const results = [];
processFiles('/path/to/directory', results, '.json', JSON.parse);

// Write HTML file for debugging
writeHtmlFileInPath('/output/path', 'test.html', '<html>...</html>');

Result Processing

import { getViolations, getIncomplete } from '@sa11y/common';

// Get violations using a custom checker function
const violations = await getViolations(async () => {
    const results = await axe.run();
    return results.violations;
});

// Get incomplete results
const incomplete = await getIncomplete(async () => {
    const results = await axe.run();
    return results.incomplete;
});

Environment Variables

  • SA11Y_DEBUG: Enable debug logging
  • SA11Y_CUSTOM_RULES: Path to custom rules JSON file
  • SA11Y_AUTO_FILTER_LIST_PACKAGE_NAME: Package name for auto-filter list
  • SA11Y_AUTO_FILTER_LIST_PACKAGE_REQUIREMENT: Package requirement for auto-filter

FAQs

Package last updated on 18 Jun 2025

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