[GH-ISSUE #254] Specify per-rule severity (warning vs. error) #2067

Closed
opened 2026-03-07 20:04:13 +03:00 by kerem · 6 comments
Owner

Originally created by @t-rad679 on GitHub (Feb 13, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/254

Hello!

I can't seem to find a way to specify severity for rules, or even the entire config as a whole. I'd like to make it so only certain rules produce a non-zero exit code if they fail. Is there a way to do this presently, and, if not, can we add one?

Originally created by @t-rad679 on GitHub (Feb 13, 2020). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/254 Hello! I can't seem to find a way to specify severity for rules, or even the entire config as a whole. I'd like to make it so only certain rules produce a non-zero exit code if they fail. Is there a way to do this presently, and, if not, can we add one?
kerem 2026-03-07 20:04:13 +03:00
Author
Owner

@DavidAnson commented on GitHub (Feb 13, 2020):

This is an issue for the CLI repository: https://github.com/igorshubovych/markdownlint-cli

Unfortunately, I cannot transfer it, so please open this there instead.

There is not currently a notion of “warnings“ in the tool. General best practice around development tools is to set “warnings as errors“, so I’m not sure this is something I want to add. What is the scenario?

<!-- gh-comment-id:585904432 --> @DavidAnson commented on GitHub (Feb 13, 2020): This is an issue for the CLI repository: https://github.com/igorshubovych/markdownlint-cli Unfortunately, I cannot transfer it, so please open this there instead. There is not currently a notion of “warnings“ in the tool. General best practice around development tools is to set “warnings as errors“, so I’m not sure this is something I want to add. What is the scenario?
Author
Owner

@t-rad679 commented on GitHub (Feb 13, 2020):

I have one rule for markdownlint I'd like for engineers to be aware of, but I don't want our pre-merge lint checks to fail and prevent submission...Specifically the inline html rule. The other rules I'd like to fail (return non-zero exit status). In general, I think this is a pretty useful feature that most linters have and I was just a little surprised it didn't exist here.

I could see how providing this option for the ruleset as a whole could be solved in the CLI, but it doesn't seem optimal to solve it per-rule there. You could do it with command line options, but I feel like it would be cleaner to include a configuration option for it on every rule, and possibly the ability to set a global default that can be overridden per rule. I can also file a ticket with the CLI project, but that does seem less practical to me.

<!-- gh-comment-id:585955681 --> @t-rad679 commented on GitHub (Feb 13, 2020): I have one rule for markdownlint I'd like for engineers to be aware of, but I don't want our pre-merge lint checks to fail and prevent submission...Specifically the inline html rule. The other rules I'd like to fail (return non-zero exit status). In general, I think this is a pretty useful feature that most linters have and I was just a little surprised it didn't exist here. I could see how providing this option for the ruleset as a whole could be solved in the CLI, but it doesn't seem optimal to solve it per-rule there. You could do it with command line options, but I feel like it would be cleaner to include a configuration option for it on every rule, and possibly the ability to set a global default that can be overridden per rule. I can also file a ticket with the CLI project, but that does seem less practical to me.
Author
Owner

@DavidAnson commented on GitHub (Feb 14, 2020):

Could you run two passes? The first has the rules you care to enforce and will fail the build. The second has rules you expect people to ignore and doesn’t fail the build.

<!-- gh-comment-id:586052544 --> @DavidAnson commented on GitHub (Feb 14, 2020): Could you run two passes? The first has the rules you care to enforce and will fail the build. The second has rules you expect people to ignore and doesn’t fail the build.
Author
Owner

@t-rad679 commented on GitHub (Feb 14, 2020):

That works. It seems kind of like a hack, but I'm sure you have a lot going on and need to prioritize. I get that some less important requests, more time-consuming requests, or requests that have workarounds, might not realistically be gotten to.

I do think the feature this issue is requesting is pretty standard and useful for linting tools, though. With the exception of Prettier (which is very opinionated and ONLY performs fixes; it does not just do checks under any circumstances. We mostly use it for JSON config files.), all of our other linters (ESLint, Stylelint, Checkstyle, the Eclipse formatter used with Spotless, and remark.js) have a concept of warn vs error for each rule.

Thank you for your help!

<!-- gh-comment-id:586308005 --> @t-rad679 commented on GitHub (Feb 14, 2020): That works. It seems kind of like a hack, but I'm sure you have a lot going on and need to prioritize. I get that some less important requests, more time-consuming requests, or requests that have workarounds, might not realistically be gotten to. I do think the feature this issue is requesting is pretty standard and useful for linting tools, though. With the exception of Prettier (which is very opinionated and ONLY performs fixes; it does not just do checks under any circumstances. We mostly use it for JSON config files.), all of our other linters (ESLint, Stylelint, Checkstyle, the Eclipse formatter used with Spotless, and remark.js) have a concept of ```warn``` vs ```error``` for each rule. Thank you for your help!
Author
Owner

@lishaduck commented on GitHub (Feb 14, 2025):

I'd like to note that in some ecosystems, supporting this is anti-pattern: How disable comments make static analysis tools worse § Warnings. I think two passes makes a lot more sense than adding in support directly.

(The article is from Elm, while in Dart we have severities but pretty much always pass --fatal-infos so that they're pretty much just for the IDE)

<!-- gh-comment-id:2660244440 --> @lishaduck commented on GitHub (Feb 14, 2025): I'd like to note that in some ecosystems, supporting this is anti-pattern: [How disable comments make static analysis tools worse § Warnings](https://jfmengels.net/disable-comments/#warnings). I think two passes makes a lot more sense than adding in support directly. (The article is from Elm, while in Dart we have severities but pretty much always pass `--fatal-infos` so that they're pretty much just for the IDE)
Author
Owner

@jarpoole commented on GitHub (Jun 29, 2025):

One argument for warnings (or as https://jfmengels.net/disable-comments/#distinguishing-between-temporarily-ignored-and-permanently-ignored mentions, a different dedicated feature) is incremental adoption. I am investigating enabling markdownlint on a large repo and requiring two passes is pretty clumsy.

<!-- gh-comment-id:3017074746 --> @jarpoole commented on GitHub (Jun 29, 2025): One argument for warnings (or as https://jfmengels.net/disable-comments/#distinguishing-between-temporarily-ignored-and-permanently-ignored mentions, a different dedicated feature) is incremental adoption. I am investigating enabling markdownlint on a large repo and requiring two passes is pretty clumsy.
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#2067
No description provided.