mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #59] Support for presets? #1899
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#1899
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @brendo on GitHub (May 25, 2017).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/59
With the latest changes in 0.5.0 that introduce
extends, I'm wondering what your thoughts are about supporting a concept of presets? This is similar to what ESLint offers and I think it'd be a useful addition this tool.For some background, we currently maintain several projects that have
.markdownlint.jsonfiles. For us, it'd be great to centrally define these rules, and then just pull that dependency into each project. We could then better communicate to our team what has changed and why :)@DavidAnson commented on GitHub (May 25, 2017):
Here's how I think you would do that today: Create desired rules in JSON file, put in npm package, publish, reference that package from each of your projects, "extend" it from each of those .markdownlint.json files (by relative path into node_modules). Would this work for you? If not, what's missing?
@DavidAnson commented on GitHub (Jun 4, 2017):
If that works for you, I'll close this issue in a day or two.
@brendo commented on GitHub (Jun 6, 2017):
Yes sorry, that solution is definitely workable, not pretty, but it'll work!
@DavidAnson commented on GitHub (Jun 6, 2017):
How is it any uglier than what ESLint does? If you want, you can do the require/exports thing here as well. Only difference I see is the need for a require statement, but that seems trivial. Am I missing something?
@brendo commented on GitHub (Jun 6, 2017):
ESLint supports specifying the package as simply a name, not a relative path, so you could do something like this:
ESLint does a nice thing where
exampleis also possible, as it'd automatically prependeslint-config-when resolving the config.If I understand the solution suggested, markdownlint would instead require:
Very minor difference 😃
@DavidAnson commented on GitHub (Jun 6, 2017):
Yes, that was my original suggestion!
If you're willing to do this in code, you can create a package that exports whatever config you want and then do something like:
Or even:
All of which works today. :)
@brendo commented on GitHub (Jun 6, 2017):
Excellent, I missed that, thanks for showing an example! Looks like I've got some configs to consolidate now 😄
@DavidAnson commented on GitHub (Jun 6, 2017):
Great! If you feel like starting a library of configs that other people could reuse in their own projects, I'll link to it from the README. No pressure, just an idea I had. :)