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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mazhu/weblinter

v1.0.0

Published

A comprehensive CLI tool for HTML, CSS, JS linting and accessibility checks

Downloads

123

Readme

@mazhu/weblinter

A comprehensive CLI tool for HTML, CSS, JavaScript linting and accessibility checks.

npm version License: MIT

Features

  • 📄 HTML Linting - Using HTMLHint for HTML code quality checks
  • 🎨 CSS Linting - Using Stylelint for CSS code quality checks
  • ⚙️ JavaScript Linting - Using ESLint for JS code quality checks
  • Accessibility Checks - Using axe-core for a11y compliance
  • 🔍 All-in-one Check - Run all linters on a directory
  • 📊 Multiple Output Formats - Text and JSON output formats
  • 🔧 Auto-fix Support - Automatically fix JavaScript issues

Installation

# Install globally
npm install -g @mazhu/weblinter

# Or install as a dev dependency
npm install --save-dev @mazhu/weblinter

Usage

Basic Commands

# Lint HTML file(s)
weblinter html <file>
weblinter html "src/**/*.html"

# Lint CSS file(s)
weblinter css <file>
weblinter css "styles/**/*.css"

# Lint JavaScript file(s)
weblinter js <file>
weblinter js "src/**/*.js"

# Check accessibility issues
weblinter a11y <file>
weblinter a11y "public/**/*.html"

# Run all linters on a directory
weblinter all <directory>
weblinter all ./src

Command Options

HTML Linting

weblinter html <file> [options]

Options:
  -c, --config <path>   Custom HTMLHint config file
  -f, --format <format> Output format (text|json) (default: "text")

CSS Linting

weblinter css <file> [options]

Options:
  -c, --config <path>   Custom Stylelint config file
  -f, --format <format> Output format (text|json) (default: "text")

JavaScript Linting

weblinter js <file> [options]

Options:
  -c, --config <path>   Custom ESLint config file
  -f, --format <format> Output format (text|json) (default: "text")
  --fix                 Automatically fix problems

Accessibility Check

weblinter a11y <file> [options]

Options:
  -r, --rules <rules>   Comma-separated list of rules to run
  -f, --format <format> Output format (text|json) (default: "text")

All-in-one Check

weblinter all <directory> [options]

Options:
  -e, --exclude <patterns>  Comma-separated glob patterns to exclude
  -f, --format <format>     Output format (text|json) (default: "text")
  --fix                     Automatically fix JS problems where possible

Examples

# Check a single HTML file
weblinter html index.html

# Check all HTML files in src directory
weblinter html "src/**/*.html"

# Check CSS with custom config
weblinter css styles.css --config .stylelintrc.json

# Auto-fix JavaScript issues
weblinter js "src/**/*.js" --fix

# Check accessibility with specific rules
weblinter a11y index.html --rules "image-alt,label,color-contrast"

# Run all linters on a project
weblinter all ./src --exclude "**/vendor/**,**/legacy/**"

Default Rules

HTML Rules

  • tagname-lowercase - Tag names must be lowercase
  • attr-lowercase - Attribute names must be lowercase
  • attr-value-double-quotes - Attribute values must be in double quotes
  • doctype-first - DOCTYPE must be first
  • tag-pair - Tags must be paired
  • spec-char-escape - Special characters must be escaped
  • id-unique - ID attributes must be unique
  • src-not-empty - src attributes must not be empty
  • attr-no-duplication - No duplicate attributes
  • title-require - title tag is required
  • alt-require - alt attribute required for images
  • And more...

CSS Rules

  • color-no-invalid-hex - No invalid hex colors
  • font-family-no-duplicate-names - No duplicate font names
  • unit-no-unknown - No unknown units
  • property-no-unknown - No unknown properties
  • And more...

JavaScript Rules

  • no-unused-vars - No unused variables
  • no-undef - No undefined variables
  • no-var - Use let/const instead of var
  • prefer-const - Prefer const for variables that don't change
  • semi - Require semicolons
  • quotes - Enforce single quotes
  • indent - Consistent indentation
  • And more...

Accessibility Rules

  • image-alt - Images must have alt text
  • label - Form elements must have labels
  • color-contrast - Sufficient color contrast
  • html-has-lang - HTML must have lang attribute
  • document-title - Document must have title
  • And more...

Programmatic API

You can also use weblinter programmatically:

const { lintHTML, lintCSS, lintJS, checkA11y, lintAll } = require('@mazhu/weblinter');

// Lint HTML
const htmlResults = await lintHTML('index.html');

// Lint CSS
const cssResults = await lintCSS('styles.css');

// Lint JS
const jsResults = await lintJS('app.js', { fix: true });

// Check accessibility
const a11yResults = await checkA11y('index.html');

// Run all linters
const allResults = await lintAll('./src');

Configuration

Custom HTMLHint Config

Create .htmlhintrc.json:

{
  "tagname-lowercase": true,
  "attr-lowercase": true,
  "attr-value-double-quotes": true,
  "doctype-first": true,
  "tag-pair": true,
  "spec-char-escape": true,
  "id-unique": true,
  "src-not-empty": true
}

Custom Stylelint Config

Create .stylelintrc.json:

{
  "extends": ["stylelint-config-standard"],
  "rules": {
    "color-no-invalid-hex": true,
    "unit-no-unknown": true
  }
}

Custom ESLint Config

Create .eslintrc.json:

{
  "env": {
    "browser": true,
    "es2021": true
  },
  "rules": {
    "no-unused-vars": "warn",
    "no-undef": "error",
    "semi": ["error", "always"]
  }
}

Output Formats

Text Format (Default)

📄 HTML Linting Results

File: index.html
────────────────────────────────────────────────────────────
  error  line 10, col 5  alt attribute required
    Rule: alt-require

────────────────────────────────────────────────────────────
Summary:
  Errors: 1
  Warnings: 0

JSON Format

{
  "results": [
    {
      "file": "index.html",
      "messages": [
        {
          "line": 10,
          "col": 5,
          "type": "error",
          "message": "alt attribute required",
          "rule": { "id": "alt-require" }
        }
      ]
    }
  ],
  "errors": 1,
  "warnings": 0
}

License

MIT © Mike Wang

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please file an issue on GitHub.