Skip to content

[markdownlint] trunk init markdownlint config incompatible with VSCode markdownlint extension (extends resolved as path) #1118

@AndrewDongminYoo

Description

@AndrewDongminYoo

Summary

trunk init generates .trunk/configs/.markdownlint.yaml with:

extends: markdownlint/style/prettier

This works in trunk check because Trunk's markdownlint wrapper sets NODE_PATH to Trunk-managed node_modules, but it fails when the same config is used by VSCode extension DavidAnson.vscode-markdownlint via "markdownlint.configFile".

This makes the generated config non-portable and confusing, especially compared to the older Trunk-generated config that disabled formatting rules directly (no extends).

Repro steps

  1. In a repo containing any Markdown files, run:

    • trunk init
    • When prompted to install markdownlint (with others), answer Y.
  2. Confirm generated file .trunk/configs/.markdownlint.yaml contains:

    extends: markdownlint/style/prettier
  3. In VSCode, add to .vscode/settings.json:

    {
      "markdownlint.configFile": ".trunk/configs/.markdownlint.yaml"
    }
  4. Open any .md file.

Actual result (VSCode output)

VSCode shows repeated errors like:

Error: Unable to use configuration file '~/Development/01_personal/apr-app-assignment/.trunk/configs/.markdownlint.yaml'; Error: ENOENT: no such file or directory, open '~/Development/01_personal/apr-app-assignment/.trunk/configs/markdownlint/style/prettier'
stack:
 at xc (~/.vscode/extensions/davidanson.vscode-markdownlint-0.61.1/bundle.js:39:39268)
 at ~/.vscode/extensions/davidanson.vscode-markdownlint-0.61.1/bundle.js:39:47281
 at async Ic (~/.vscode/extensions/davidanson.vscode-markdownlint-0.61.1/bundle.js:39:46482)
cause:
 EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '~/Development/01_personal/apr-app-assignment/.trunk/configs/markdownlint/style/prettier'
 stack:
  at Lr.e (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:18080)
  at Object.readFile (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:16601)

Expected result

The Trunk-generated markdownlint config should be usable by standard markdownlint tooling, including VSCode extension, without requiring repo-specific path rewrites.

Why it happens

vscode-markdownlint / markdownlint-cli2 resolves extends as a path relative to the config file location. So extends: markdownlint/style/prettier is interpreted as:
.trunk/configs/markdownlint/style/prettier
which does not exist.

Meanwhile, Trunk’s wrapper sets:

  • NODE_PATH=~/.cache/trunk/tools/markdownlint/.../node_modules
    so Trunk CLI runs succeed, masking the portability issue.

Wrapper snippet for reference (.trunk/tools/markdownlint):

export NODE_PATH=".../node_modules"
exec markdownlint "$@"

Regression / historical behavior

Older trunk init versions used a self-contained config like:

default: true
blank_lines: false
bullet: false
html: false
indentation: false
line_length: false
spaces: false
url: false
whitespace: false

This worked everywhere without relying on extends resolution.

Suggested fixes

One of:

  1. Revert to generating a self-contained config (disable formatting rules directly).
  2. Vendor/emit the preset file under .trunk/configs/... and use a relative extends: ./markdownlint/style/prettier.
  3. Document prominently that the generated config is Trunk-runtime-specific and provide a VSCode-compatible variant.

Environment

  • OS: macOS (Apple Silicon)
  • VSCode: Version: 1.109.4
  • Extension: DavidAnson.vscode-markdownlint 0.61.1
  • Trunk: 1.25.0
  • Tool versions (from Trunk cache): markdownlint 0.47.0, node 22.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions