-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to use different configs for different folders? #96
Comments
BTW, I was wondering if the CLI could behave like a VSCode extension, which respects the closest config files. Maybe behind some flag to maintain backwards compatibility, for example:
I realize there might be performance implications of this. |
Agreed, the two tools should be consistent. Something like what you propose may be a good approach. For now, running two passes is probably what you want to do. (As you suggest, the scenario is a little different here versus the extension; in the extension it pretty much only ever needs to worry about one file at a time and so spending a bit of effort to find files up the tree isn’t a problem. The CLI does everything at once, so this is more problematic. Specifically, it could turn one call to the library into tens or hundreds and that may create other issues.) |
It's worth noting that in the context of lint-staged, At this point, I have to do this: // .lingstagedrc.js
module.exports = {
"{!(folder-4)/**/,}*.md": ["markdownlint"],
"folder-4/**/*.md": ["markdownlint -c folder-4/.markdownlint.json"],
}; With the proposed behavior, this could be simplified to: module.exports = {
"**/*.md": ["markdownlint --use-closest-config-file"]
}; |
@borekb: Per my comments at #45 (comment) you should be able to use |
Looks very good, thanks! I won't be able to test this soon but will keep that in mind for future updates of our dev infra. |
@DavidAnson cli2 works beautifully for this! Does VSCode extension already do this as well? |
@borekb Yes, the VS Code |
I have a project that looks like this:
.markdownlintrc
(root config, should apply to folders 1..3 below)folder-1
folder-2
folder-3
folder-4
.markdownlintrc
(special config for folder 4)The nested
folder-4/.markdownlintrc
looks like this:Is there a way to run
markdownlint
CLI once and have it check all folders in my project – folder 1..3 with the root config and folder 4 with its own?As a fallback, I plan to run markdownlint twice but wanted to ask first if there's a way to achieve that in one go.
The text was updated successfully, but these errors were encountered: