[GH-ISSUE #466] Support for global config in home directory? #383

Closed
opened 2026-03-03 01:26:25 +03:00 by kerem · 5 comments
Owner

Originally created by @LandonSchropp on GitHub (Dec 16, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/466

Many linters have adopted the pattern of first checking the working directory for a config file, and then moving up through the parent directories, checking for the presence of config files. As an example, here's how ESLint handles this.

It'd be awesome if markdownlint could support this pattern. This would allow me to pop a general .markdownlint.json file in my home directory, as well as specify other .markdownlint.json files in specific repos.

I realize I could manually specify the path to a shared config file, but this is a bit of a pain, especially with markdownlint tightly integrated into Neovim.

Thanks!

Originally created by @LandonSchropp on GitHub (Dec 16, 2021). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/466 Many linters have adopted the pattern of first checking the working directory for a config file, and then moving up through the parent directories, checking for the presence of config files. As an example, [here's how ESLint handles this](https://eslint.org/docs/user-guide/configuring/configuration-files#cascading-and-hierarchy). It'd be awesome if markdownlint could support this pattern. This would allow me to pop a general `.markdownlint.json` file in my home directory, as well as specify other `.markdownlint.json` files in specific repos. I realize I could manually specify the path to a shared config file, but this is a bit of a pain, especially with markdownlint tightly integrated into Neovim. Thanks!
kerem 2026-03-03 01:26:25 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Dec 16, 2021):

This sounds like a request for one of the CLI's or maybe the VS Code extension? (This library does no traversal itself.)

https://github.com/DavidAnson/markdownlint#related

None of these go up the parent tree indefinitely, but all support hierarchy - with CLI2 more flexible in this regard. ESLint itself warns about the risks of its indefinite parent design here.

I'm not familiar with the behavior of the Neovim plugin, perhaps your feedback is for it?

<!-- gh-comment-id:995352095 --> @DavidAnson commented on GitHub (Dec 16, 2021): This sounds like a request for one of the CLI's or maybe the VS Code extension? (This library does no traversal itself.) https://github.com/DavidAnson/markdownlint#related None of these go up the parent tree indefinitely, but all support hierarchy - with CLI2 more flexible in this regard. ESLint itself warns about the risks of its indefinite parent design here. I'm not familiar with the behavior of the Neovim plugin, perhaps your feedback is for it?
Author
Owner

@DavidAnson commented on GitHub (Dec 16, 2021):

To be clear, the VS Code extension supports both, but will not mix home directory configuration with project directory configuration. That seems like an unpredictable behavior that sets other contributors (with different home directories) up for surprises and frustration.

<!-- gh-comment-id:995354603 --> @DavidAnson commented on GitHub (Dec 16, 2021): To be clear, the VS Code extension supports both, but will not mix home directory configuration with project directory configuration. That seems like an unpredictable behavior that sets other contributors (with different home directories) up for surprises and frustration.
Author
Owner

@LandonSchropp commented on GitHub (Dec 16, 2021):

Ah, I didn't realize markdownlint-cli was a separate project. I'll ask over there. Thanks!

<!-- gh-comment-id:995432927 --> @LandonSchropp commented on GitHub (Dec 16, 2021): Ah, I didn't realize markdownlint-cli was a separate project. I'll ask over there. Thanks!
Author
Owner

@LandonSchropp commented on GitHub (Dec 16, 2021):

Sorry, I missed your other comments. I appreciate the quick and thorough replies! 🙂

The Neovim plugin I'm using is null-ls, which wraps several tools and provides LSP interfaces for them. Since LSP support is baked into Neovim by default, this allows a solid integration. I believe markdownlint-cli is the tool that's being used internally by the plugin.

<!-- gh-comment-id:995435522 --> @LandonSchropp commented on GitHub (Dec 16, 2021): Sorry, I missed your other comments. I appreciate the quick and thorough replies! 🙂 The Neovim plugin I'm using is [null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim), which wraps several tools and provides LSP interfaces for them. Since LSP support is baked into Neovim by default, this allows a solid integration. I believe markdownlint-cli is the tool that's being used internally by the plugin.
Author
Owner

@LandonSchropp commented on GitHub (Dec 16, 2021):

Ah, I just found this in the markdownlint-cli documentation:

The CLI argument --config is not required. If it is not provided, markdownlint-cli looks for the file .markdownlint.json/.markdownlint.yaml/.markdownlint.yml in current folder, or for the file .markdownlintrc in the current or all parent folders.

So it looks like it already supports what I'm looking for. Thanks again for the help!

<!-- gh-comment-id:995437314 --> @LandonSchropp commented on GitHub (Dec 16, 2021): Ah, I just found this in the markdownlint-cli documentation: > The CLI argument --config is not required. If it is not provided, markdownlint-cli looks for the file .markdownlint.json/.markdownlint.yaml/.markdownlint.yml in current folder, or for the file .markdownlintrc in the current or all parent folders. So it looks like it already supports what I'm looking for. Thanks again for the help!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#383
No description provided.