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

Make ignores and files to include part of the configuration #45

Open
borekb opened this issue Aug 7, 2018 · 7 comments
Open

Make ignores and files to include part of the configuration #45

borekb opened this issue Aug 7, 2018 · 7 comments

Comments

@borekb
Copy link

borekb commented Aug 7, 2018

The config file (.markdownlint.json), if I understand it correctly, is the options.config object. In the API, options have other keys like files or customRules.

Would it be possible to use this in .markdownlint.json as well? Especially, I'd use it to denote certain directories as ignored. This is probably not supported by the underlying API at this point but I imagine something like this:

// .markdownlint.json
{
  "ignore": [
	"node_modules"
  ],
  "config": {
	"MD026": false
  }
}
@DavidAnson
Copy link
Collaborator

Your understanding is correct: .markdownlint.json is for configuring rules (only). This allows it to be shared by multiple tools (like this CLI and the VS Code extension) even when those tools have different ways of configuring and applying options. What you propose is possible, but needs some thought and coordination to do well.

@jwalker343
Copy link

This would be a nice to have.

There are some other proposals that are similar in #46 but those require adding additional files to our repos which I'd rather not do, we already have a huge number of dot files in the root for different tools and adding another would just further pollute it.

@JimPatterson
Copy link

@DavidAnson Has there been any thought on how some of these thing might be done? I have a need to pass a list of plugins to markdownlint and I currently use the cli to run it. We use a plugin for tables that support different syntax, so without passing the plugin we can't actually use linting for the tables.

If there is an acceptable approach, I could code some or all of the next step.

@DavidAnson
Copy link
Collaborator

I’m part-way through a side project experiment that may help with this scenario. I should be in a position to share something rough in a week or so.

@DavidAnson
Copy link
Collaborator

@borekb @jwalker343: I've just published version 0.0.3 of https://github.com/DavidAnson/markdownlint-cli2

It's a slightly different take on a CLI, please see the README for context. Relevant to this thread, it supports a unique .markdownlint.json in each directory. It also supports customizing the options object for each directory. It handles ignoring files a little differently - you could either pass the right combination of including/excluding globs on the command-line OR use a .markdownlintignore in the root of the project to ignore specific directories.

@JimPatterson: markdown-it plugins aren't supported in that version, but will be in the next one which I expect to publish soon. Custom rules are supported and can be different for each directory - plugins will be handled similarly.

If you try this out, please let me know how it goes - thanks!

@borekb
Copy link
Author

borekb commented Aug 2, 2020

Thanks for the info. Note that a single, root-level ignore file can be a maintenance pain point in larger repos, see e.g. these feature requests for Prettier and ESLint:

But any improvements in this area are welcome (though I won't be able to test the new behavior soon, sorry).

@DavidAnson
Copy link
Collaborator

@JimPatterson, plugins are supported in the latest version and can vary by directory. If you try this out, please let me know how it goes!

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