Skip to content

Checker

tspub's checker validates your TypeScript package against 70 rules across 6 categories. It catches issues that would break consumers of your package.

Quick Start

bash
# Check your package
tspub check

# Auto-fix issues
tspub check --fix

# JSON output for CI
tspub check --format json

# Type resolution table (like attw)
tspub check --format table

# List all rules
tspub check --list-rules

Output Format

By default, results are grouped by category:

── exports ──
✓ OK exports field is correct and complete

── types ──
✗ ERROR exports["."].types should come BEFORE import/require/default

── files ──
✓ OK no sensitive files found in published package

── metadata ──
⚠ WARNING sideEffects field is not set

── size ──
✓ OK package size: healthy

✓ 3 passed · ✗ 1 error(s) · ⚠ 1 warning(s)

Formats

FormatFlagUse Case
text--format textTerminal output (default)
json--format jsonCI pipelines, scripts
table--format tableType resolution matrix

Profiles

Skip rules that don't apply to your project:

bash
# All rules, warnings become errors
tspub check --profile strict

# Skip size checks (for libraries)
tspub check --profile library

# Skip exports/types rules (for apps not published to npm)
tspub check --profile app

Ignoring Rules

bash
# Skip specific rules
tspub check --ignore-rules "size/package-size,metadata/engines"

# Override severity
tspub check --rule "size/package-size=off" --rule "metadata/engines=warning"

Or in tspub.config.ts:

typescript
export default {
  check: {
    severityOverrides: {
      "size/package-size": "off",
      "metadata/engines": "warning",
    },
  },
};

Auto-Fix

14 rules support auto-fix (9 safe, 5 unsafe):

bash
# Safe fixes only
tspub check --fix

# Include unsafe fixes
tspub check --fix --unsafe

# Preview fixes without applying
tspub check --fix-dry-run

# Interactive mode — confirm each fix
tspub check --fix --interactive

# Only fix specific categories
tspub check --fix --fix-type exports,metadata

Categories

CategoryRulesDescription
exports28Package exports field validation
imports6Import map validation
types14TypeScript config and type resolution
files10File inclusion and format checks
metadata11Package metadata validation
size1Package size analysis

Released under the MIT License.