Skip to content
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

support settings to ignore rules for glob files #666

Open
tjx666 opened this issue Dec 5, 2022 · 8 comments
Open

support settings to ignore rules for glob files #666

tjx666 opened this issue Dec 5, 2022 · 8 comments

Comments

@tjx666
Copy link

tjx666 commented Dec 5, 2022

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.

@DavidAnson
Copy link
Owner

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.

@DavidAnson
Copy link
Owner

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

@tjx666
Copy link
Author

tjx666 commented 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,
        }
    }
}

@nschonni
Copy link
Contributor

nschonni commented Dec 5, 2022

@DavidAnson
Copy link
Owner

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.

@stern-shawn
Copy link

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,
    }
  }
}

@DavidAnson
Copy link
Owner

@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.

@stern-shawn
Copy link

@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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants