[GH-ISSUE #666] support settings to ignore rules for glob files #497

Open
opened 2026-03-03 01:27:26 +03:00 by kerem · 8 comments
Owner

Originally created by @tjx666 on GitHub (Dec 5, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/666

In my large monorepo projects, there are many changelog file, I want to disable MD041 for all changelog file. For now, I can't find a simple way to achieve this.

Originally created by @tjx666 on GitHub (Dec 5, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/666 In my large monorepo projects, there are many changelog file, I want to disable MD041 for all changelog file. For now, I can't find a simple way to achieve this.
Author
Owner

@DavidAnson commented on GitHub (Dec 5, 2022):

Assuming you can identify changelog when invoking the linter, what about running two passes for linting? One pass with that rule disabled and only looking at changelogs, the other pass scanning everything else.

<!-- gh-comment-id:1337738238 --> @DavidAnson commented on GitHub (Dec 5, 2022): Assuming you can identify changelog when invoking the linter, what about running two passes for linting? One pass with that rule disabled and only looking at changelogs, the other pass scanning everything else.
Author
Owner

@DavidAnson commented on GitHub (Dec 5, 2022):

(This library doesn't do anything with globs, it just scans the list of files you give it.)

<!-- gh-comment-id:1337743089 --> @DavidAnson commented on GitHub (Dec 5, 2022): (This library doesn't do anything with globs, it just scans the list of files you give it.)
Author
Owner

@tjx666 commented on GitHub (Dec 5, 2022):

I config the markdownlint using .markdownlint.json, any way to satisfy my need only modify the config?

My suggestion is to support something like eslint overrides option.

{
    "overrides" {
        "files": ["CHANGELOG.md"],
        "rules": {
            "MD001": false,
        }
    }
}

<!-- gh-comment-id:1337777983 --> @tjx666 commented on GitHub (Dec 5, 2022): I config the markdownlint using `.markdownlint.json`, any way to satisfy my need only modify the config? My suggestion is to support something like eslint overrides option. ```json { "overrides" { "files": ["CHANGELOG.md"], "rules": { "MD001": false, } } } ```
Author
Owner
<!-- gh-comment-id:1338122609 --> @nschonni commented on GitHub (Dec 5, 2022): Think it's similar to https://github.com/DavidAnson/markdownlint-cli2/issues/50 and is looking for the support that other libraries like ESLint https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns or Prettier https://prettier.io/docs/en/configuration.html#configuration-overrides
Author
Owner

@DavidAnson commented on GitHub (Dec 5, 2022):

OK, thanks. I will leave this issue here as a reminder to myself, but this may end up making the most sense in CLI or CLI2.

<!-- gh-comment-id:1338155269 --> @DavidAnson commented on GitHub (Dec 5, 2022): OK, thanks. I will leave this issue here as a reminder to myself, but this may end up making the most sense in CLI or CLI2.
Author
Owner

@stern-shawn commented on GitHub (Jul 6, 2023):

OK, thanks. I will leave this issue here as a reminder to myself, but this may end up making the most sense in CLI or CLI2.

Hi @DavidAnson , is this still on the radar? I've run into a scenario where we have .mdx and .snippet.mdx files in a project, and would like to disable some rules such as MD041 only for the reusable snippet files, but otherwise apply the remaining rules to both types. Something such as the overrides syntax would be wonderful for this, as opposed to doing two separate runs with different configs.

Ex.

{
  "overrides" {
    "files": ["**/*.snippet.mdx"],
    "rules": {
      "MD041": false,
    }
  }
}
<!-- gh-comment-id:1622756152 --> @stern-shawn commented on GitHub (Jul 6, 2023): > OK, thanks. I will leave this issue here as a reminder to myself, but this may end up making the most sense in CLI or CLI2. Hi @DavidAnson , is this still on the radar? I've run into a scenario where we have `.mdx` and `.snippet.mdx` files in a project, and would like to disable _some_ rules such as [MD041](https://github.com/DavidAnson/markdownlint/blob/main/doc/md041.md) only for the reusable snippet files, but otherwise apply the remaining rules to both types. Something such as the `overrides` syntax would be wonderful for this, as opposed to doing two separate runs with different configs. Ex. ```json { "overrides" { "files": ["**/*.snippet.mdx"], "rules": { "MD041": false, } } } ```
Author
Owner

@DavidAnson commented on GitHub (Jul 6, 2023):

@stern-shawn, when using this library directly, you can pass it whatever set of files you want and should filter out any you don't. When using markdownlint-cli or -cli2, you may be able to use the ignore argument or option to filter out unwanted files. That may not work for all scenarios, but it's hard to say in the abstract.

<!-- gh-comment-id:1622872198 --> @DavidAnson commented on GitHub (Jul 6, 2023): @stern-shawn, when using this library directly, you can pass it whatever set of files you want and should filter out any you don't. When using markdownlint-cli or -cli2, you may be able to use the ignore argument or option to filter out unwanted files. That may not work for all scenarios, but it's hard to say in the abstract.
Author
Owner

@stern-shawn commented on GitHub (Jul 6, 2023):

@DavidAnson I see, and my apologies (I found this via google search and didn't confirm that it was part of the markdownlint-cli2 issues 🤦 ). I will look at running -cli2 with one pass for snippet files and another for all other mdx 🙇

<!-- gh-comment-id:1624051428 --> @stern-shawn commented on GitHub (Jul 6, 2023): @DavidAnson I see, and my apologies (I found this via google search and didn't confirm that it was part of the markdownlint-cli2 issues 🤦 ). I will look at running -cli2 with one pass for snippet files and another for all other mdx 🙇
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#497
No description provided.