Skip to content
Latchkey

markdownlint-cli2 config not found or not applied in CI

markdownlint-cli2 discovers config by filename (.markdownlint-cli2.jsonc, .markdownlint.json, and variants) relative to the files it lints. If the file is misnamed or outside the search path, CI applies defaults and reports rules you thought you had disabled.

What this error means

CI fails on rules that pass locally, or markdownlint-cli2 prints "Finding: ..." with no config loaded, so default rules apply instead of your project settings.

markdownlint-cli2
markdownlint-cli2 v0.13.0 (markdownlint v0.34.0)
Finding: **/*.md
Linting: 42 file(s)
README.md:14 MD013/line-length Line length [Expected: 80; Actual: 120]

Common causes

The config filename is not one cli2 discovers

markdownlint-cli2 reads .markdownlint-cli2.jsonc/.yaml/.cjs or .markdownlint.json/.yaml. A differently named file is ignored, so defaults apply.

Config lives outside the linted directory tree

cli2 searches from each linted file upward. A config in a subfolder or a monorepo package will not apply to files elsewhere.

How to fix it

Use a discovered config filename at the repo root

  1. Name the file .markdownlint-cli2.jsonc (or .markdownlint.json).
  2. Place it at the root above every Markdown file you lint.
  3. Run cli2 from the repo root so discovery starts there.
.markdownlint-cli2.jsonc
{
  "config": { "MD013": { "line_length": 120 } },
  "globs": ["**/*.md"],
  "ignores": ["node_modules", "CHANGELOG.md"]
}

Pin the action and point it at your config

Use the official action and pass an explicit config so CI uses the same rules as local.

.github/workflows/docs.yml
- uses: DavidAnson/markdownlint-cli2-action@v16
  with:
    config: '.markdownlint-cli2.jsonc'
    globs: '**/*.md'

How to prevent it

  • Keep the config at the repo root with a name cli2 discovers.
  • Pin the markdownlint-cli2 action version so rule sets do not drift.
  • Run cli2 locally from the repo root to match CI discovery.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →