Skip to main content

doom lint

Lint documentation files using ESLint with built-in rules for Markdown, MDX, and spell checking.

Usage

doom lint [root] [options]

Arguments

root
string
Root directory of the documentation. Defaults to current working directory.

Options

-g, --glob
string | string[]
default:"**/*.{js,jsx,ts,tsx,md,mdx}"
Glob patterns of source directories or files to lintExample:
doom lint --glob "**/*.md" "**/*.mdx"
--no-cspell
boolean
Disable spell checkingExample:
doom lint --no-cspell
--debug
boolean
default:"false"
Show debug logsExample:
doom lint --debug
-i, --ignore
boolean
default:"false"
Ignore internal routes defined in configExample:
doom lint --ignore
See Global Options for additional options.

Features

Built-in Rules

Doom includes ESLint rules for:
  • Markdown/MDX - Formatting and structure
  • Spell Checking - Via cspell (optional)
  • Links - Broken link detection
  • Code Blocks - Syntax validation
  • Frontmatter - Required fields and format

Spell Checking

By default, cspell is enabled and checks:
  • Document content
  • Code comments
  • Using configurable dictionaries
Disable with --no-cspell flag.

Internal Routes

When --ignore flag is used, files matching internalRoutes config patterns are excluded from linting.

Examples

Lint all documentation

doom lint

Lint specific files

doom lint --glob "guides/**/*.md"

Lint without spell checking

doom lint --no-cspell

Lint ignoring internal routes

doom lint --ignore

Lint with debug output

doom lint --debug

Lint specific directory

doom lint ./my-docs

Lint multiple patterns

doom lint --glob "**/*.md" "**/*.mdx" "!**/node_modules/**"

Configuration

cspell Options

Customize spell checking in doom.config.yaml:
lint:
  cspellOptions:
    words:
      - Kubernetes
      - Rspress
      - Alauda
    ignoreWords:
      - kubectl
      - namespace
    dictionaries:
      - technical-terms
      - company-names

Internal Routes

Exclude internal/draft content:
internalRoutes:
  - drafts/**
  - internal/**
  - wip/**
Use --ignore flag to skip these during linting.

Output

Successful lint

start Linting `docs`...
info  Linting completed with 0 errors and 0 warnings

With errors

start Linting `docs`...

docs/guide.md
  12:5  error  Misspelled word: 'Kuberntes'  cspell
  25:1  error  Missing required frontmatter field: title  frontmatter

docs/api.md
  8:15  warning  Link may be broken: /non-existent  link-checker

info  Linting completed with 2 errors and 1 warnings

Exit Code

  • 0 - No errors (warnings are ok)
  • 1 - Errors found

Common Issues

Misspelled Words

Error:
5:10  error  Unknown word: "Kubernetes"  cspell
Solutions:
  1. Add to cspell config:
    lint:
      cspellOptions:
        words:
          - Kubernetes
    
  2. Add inline comment:
    <!-- cspell:ignore Kubernetes -->
    
  3. Disable for block:
    <!-- cspell:disable -->
    Technical terms: Kubernetes, kubectl
    <!-- cspell:enable -->
    

Missing Frontmatter

Error:
1:1  error  Missing required frontmatter field: title
Solution:
---
title: Page Title
description: Page description
---
Error:
10:5  warning  Link may be broken: /invalid-path
Solution:
  • Fix the link path
  • Ensure target file exists
  • Check for typos

Ignore Patterns

Inline Ignore

<!-- eslint-disable -->
Content to ignore
<!-- eslint-enable -->

File-level Ignore

<!-- eslint-disable -->

# Content
Everything in this file is ignored

Specific Rules

<!-- eslint-disable cspell -->
Misspelled words are ok here
<!-- eslint-enable cspell -->

CI/CD Integration

GitHub Actions

name: Lint

on: [push, pull_request]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
      - run: npm install
      - run: npm run lint

GitLab CI

lint:
  stage: test
  script:
    - npm install
    - npm run lint
  only:
    - merge_requests
    - main

Pre-commit Hook

#!/bin/sh
# .git/hooks/pre-commit
doom lint --glob "$(git diff --cached --name-only --diff-filter=ACM | grep '\.mdx\?$' | xargs)"

Best Practices

  1. Lint Often - Run before commits
  2. Fix Errors - Don’t commit with errors
  3. Review Warnings - Address warnings when possible
  4. Custom Dictionary - Maintain project-specific terms
  5. CI Integration - Automate linting in CI/CD

Performance

Slow Linting

If linting is slow:
  1. Narrow glob patterns:
    doom lint --glob "guides/**" "api/**"
    
  2. Disable cspell for faster linting:
    doom lint --no-cspell
    
  3. Ignore node_modules (automatically handled)
  4. Use —ignore to skip internal routes:
    doom lint --ignore
    

Build docs developers (and LLMs) love