Skip to content

chore: lint markdown with markdownlint - #1149

Merged
viceice merged 2 commits into
mainfrom
viceice/markdownlint
Dec 1, 2026
Merged

viceice merged 2 commits into
mainfrom
viceice/markdownlint

Conversation

@viceice

@viceice viceice commented Dec 1, 2026

Copy link
Copy Markdown
Member

Changes

  • Lint markdown with markdownlint-cli2, with the config from containerbase/base.
  • Add lint:markdown to pnpm lint and the CI lint job, and fix staged markdown files in the commit hook.

Context

Please select one of the following:

  • This closes an existing Issue, Closes: Add lint #11
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Use of AI in replying to PR comments

Who answers review comments:

  • @viceice will read and reply directly. Name the account.
  • An agent will draft replies and @username will read them before they are posted. Name the account.
  • An agent will draft replies and reply autonomously. This is heavily discouraged, and we prefer that there are humans in the loop
  • Nobody has explicitly committed to replying.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified tests

Drafted by Claude Code (Claude Opus 5.5, low effort) on behalf of @viceice.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <michael.kriese+claude-code@mend.io>
@qodo-code-review

qodo-code-review Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

chore: lint markdown with markdownlint-cli2

✨ Enhancement ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Adds markdownlint-cli2 with a shared containerbase-style config for all Markdown files.
• Wires lint:markdown into pnpm lint and the CI lint job, and adds a lint-fix:markdown script.
• Runs markdownlint --fix on staged *.md files via lint-staged before oxfmt.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 0 capabilities

  • No production behavior changes identified.
Behavioral complexity 🟢 Low 🧩 Assessed behavior

  • No production behavior changes identified.
Potential damage 🟢 Low 🩹 Assessed behavior

  • No production behavior changes identified.
Assessed commit 9020fe7
Diagram

graph TD
  A["package.json lint script"] --> B["lint:markdown"] --> C["markdownlint-cli2"] --> D[".markdownlint-cli2.jsonc"]
  E["CI build.yml lint job"] --> B
  F[".lintstagedrc.json *.md"] --> C
Loading
High-Level Assessment

Keep markdownlint-cli2 with the shared containerbase-style config. It is a standard Markdown linter with a fixable mode, and reusing the upstream containerbase config keeps rules consistent across repositories. The main alternative, enabling Markdown rules through the existing oxfmt/prettier formatter, only formats and cannot enforce structural rules such as heading and list conventions, so it does not replace a linter. Running markdownlint only in CI, without the pre-commit fix, would be simpler but would push fixes into review rather than the author's commit.

Files changed (5) +754 / -2

Other (5) +754 / -2
build.ymlAdd markdown lint step to CI lint job +2/-0

Add markdown lint step to CI lint job

• Adds a 'pnpm lint:markdown' step to the lint job after the oxfmt check, so Markdown lint failures fail CI.

.github/workflows/build.yml

.lintstagedrc.jsonRoute staged markdown through markdownlint before oxfmt +2/-1

Route staged markdown through markdownlint before oxfmt

• Adds a '*.md' entry that runs 'markdownlint-cli2 --fix' followed by oxfmt. The catch-all oxfmt rule is changed to '!*.md' so Markdown is not formatted twice.

.lintstagedrc.json

.markdownlint-cli2.jsoncAdd markdownlint-cli2 config with containerbase base rules +30/-0

Add markdownlint-cli2 config with containerbase base rules

• New config extends markdownlint's prettier style preset, sets 2-space unordered list indentation, and disables line-length, first-line-heading, single-h1, no-inline-html and several heading rules. It ignores '.claude/**' and honours '.gitignore'. The 'no-emphasis-as-header' key looks like a typo of 'no-emphasis-as-heading', and it is set to false in both places, so it may have no effect.

.markdownlint-cli2.jsonc

package.jsonAdd lint:markdown and lint-fix:markdown scripts and dependency +4/-1

Add lint:markdown and lint-fix:markdown scripts and dependency

• Adds 'markdownlint-cli2' 0.24.2 as a devDependency. Adds 'lint:markdown' (check) and 'lint-fix:markdown' (fix) scripts over '**/*.md', and includes 'lint:markdown' in the top-level 'lint' script.

package.json

pnpm-lock.yamlLock markdownlint-cli2 and its transitive dependencies +716/-0

Lock markdownlint-cli2 and its transitive dependencies

• Adds 716 lines of resolved entries for markdownlint-cli2 and its transitive packages. No existing entries are changed.

pnpm-lock.yaml

@qodo-code-review

qodo-code-review Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2)

Grey Divider


Remediation recommended

1. markdownlint is pulled in with an unpinned floating range 🐞 Bug ⭐ New
Description
The new peerDependencies entry "markdownlint": "*" in package.json is resolved by pnpm into a
root importer dependencies entry with specifier '*' (pnpm-lock.yaml lines 187-190), so the
lockfile now records a runtime dependency that accepts any markdownlint version. Any lockfile
regeneration, pnpm update, or install run without a frozen lockfile can silently move the linter
to a new major, which changes the rule set and the markdownlint/style/prettier config that
.markdownlint-cli2.jsonc extends, and that breaks lint:markdown in pnpm lint, the CI lint job
and the lint-staged hook.
Code

package.json[R22-24]

+  "peerDependencies": {
+    "markdownlint": "*"
+  },
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
package.json declares `markdownlint` as a peer dependency with the range `*`. pnpm promotes this to a root `dependencies` entry with specifier `'*'` in pnpm-lock.yaml (lines 187-190), so the linter's version is unpinned and can change on any lockfile regeneration. This also makes a private root package carry a peer declaration that is not needed for its own tooling.

## Fix Focus Areas
- package.json[22-24]
- pnpm-lock.yaml[187-190]

## Recommended Fix
Remove the `peerDependencies` block from package.json. Add `"markdownlint": "0.42.2"` (the version currently locked) to `devDependencies` next to `markdownlint-cli2`, matching the exact-pin style used for the other devDependencies. Then run `pnpm install` to regenerate the importer entry so it is recorded under devDependencies with a pinned specifier. Verify that `pnpm lint:markdown` still loads the `markdownlint/style/prettier` extends from a clean `node_modules`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗



View low (1)
Informational
2. A misspelled rule override is silently ignored 🐞 Bug
Description
The no-emphasis-as-header key in .markdownlint-cli2.jsonc is not a markdownlint rule name; the
real rule is no-emphasis-as-heading, which the same block already disables. Unknown keys are
ignored, so the entry has no effect and misleads future maintainers into thinking an extra rule is
disabled.
Code

.markdownlint-cli2.jsonc[16]

+    "no-emphasis-as-header": false,
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`.markdownlint-cli2.jsonc` contains `no-emphasis-as-header`, which is not a markdownlint rule name. The correct rule `no-emphasis-as-heading` is already disabled on the line above, so the extra key does nothing.

## Fix Focus Areas
- .markdownlint-cli2.jsonc[13-16]

## Recommended Fix
Delete the `"no-emphasis-as-header": false,` line and keep `no-emphasis-as-heading`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Resolved findings
1. Markdown lint config may fail to load outside Trunk ✓ Resolved Medium Bug

Resolving commit: 9020fe7

Resolution reason
Declares markdownlint as a direct root dependency (lockfile importer entry for '.' with specifier
'*', version 0.42.2) and adds a peerDependency entry in package.json, so the bare
'markdownlint/style/prettier' extends resolves from the project root.
Description
The extends value markdownlint/style/prettier in .markdownlint-cli2.jsonc is a bare package
specifier, but markdownlint is not a direct dependency: the PR adds only markdownlint-cli2 to
package.json, and markdownlint@0.42.2 appears in the lockfile only as a transitive dependency.
Under pnpm's non-hoisted layout the root node_modules may not expose markdownlint, and tools
that resolve extends as a path relative to the config file (as the VSCode markdownlint extension
does) fail with ENOENT, so lint:markdown in pnpm lint, the CI lint job and the lint-staged hook
could break on every run.

Grey Divider

Tip of the day
💡 Did you know, you can pick a display mode instead of tweaking every Display option by hand

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Co-Authored-By: Claude Opus 5.5 <michael.kriese+claude-code@mend.io>
@viceice
viceice enabled auto-merge (squash) December 1, 2026 10:22
@viceice
viceice merged commit f37c0cc into main Dec 1, 2026
7 checks passed
@viceice
viceice deleted the viceice/markdownlint branch December 1, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add lint

1 participant