markdownlint-cli icon indicating copy to clipboard operation
markdownlint-cli copied to clipboard

Overrides field

Open cdfa opened this issue 6 years ago • 8 comments

I think it would be great to specify config overrides for certain files (like overrides in eslint and prettier). I don't think this should be implement in the markdownlint library, because it's easier to do this overriding manually when using the API, but it would be nice if the CLI would support it in some way.

cdfa avatar Mar 02 '19 14:03 cdfa

Relevant example: https://eslint.org/docs/user-guide/configuring#disabling-rules-only-for-a-group-of-files

DavidAnson avatar Mar 02 '19 16:03 DavidAnson

@cdfa, in case you are not aware, when using the VS Code extension, it will allow a config file in subdirectories as well as the root of the project. That can be used to customize settings for an entire subdirectory of files. Would that work for your purposes?

DavidAnson avatar Mar 02 '19 16:03 DavidAnson

Sadly not, I need a different configuration for .mdx files (specifically: disabling the forbidden html tag rule)

cdfa avatar Mar 02 '19 17:03 cdfa

Would it work to run the CLI in two separate passes? The first for *.md and the second for *.mdx (with slightly different settings)?

DavidAnson avatar Mar 02 '19 17:03 DavidAnson

Yes, I have a mdx only config and passing that using the --config option, but I can't make it "inherit" the default .md config.

cdfa avatar Mar 02 '19 17:03 cdfa

To inherit rules, have you looked at extends? https://github.com/DavidAnson/markdownlint/blob/master/README.md#optionsconfig

DavidAnson avatar Mar 02 '19 18:03 DavidAnson

Ah, that makes my case possible. I still think it would be convenient to not have to pass the specific config for every extension, but this works. Thank you!

cdfa avatar Mar 02 '19 22:03 cdfa

Cool. I’ll leave this open here for the future, but glad you’re unblocked now!

DavidAnson avatar Mar 02 '19 23:03 DavidAnson