GithubHelp home page GithubHelp logo

Support for presets? about markdownlint HOT 8 CLOSED

davidanson avatar davidanson commented on August 19, 2024
Support for presets?

from markdownlint.

Comments (8)

DavidAnson avatar DavidAnson commented on August 19, 2024

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?

from markdownlint.

DavidAnson avatar DavidAnson commented on August 19, 2024

If that works for you, I'll close this issue in a day or two.

from markdownlint.

brendo avatar brendo commented on August 19, 2024

Yes sorry, that solution is definitely workable, not pretty, but it'll work!

from markdownlint.

DavidAnson avatar DavidAnson commented on August 19, 2024

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?

from markdownlint.

brendo avatar brendo commented on August 19, 2024

ESLint supports specifying the package as simply a name, not a relative path, so you could do something like this:

{
  "extends": "markdownlint-config-example",
  "default": true
}

ESLint does a nice thing where example is also possible, as it'd automatically prepend eslint-config- when resolving the config.

If I understand the solution suggested, markdownlint would instead require:

{
  "extends": "./node_modules/markdownlint-config-example",
  "default": true
}

Very minor difference 😃

from markdownlint.

DavidAnson avatar DavidAnson commented on August 19, 2024

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:

var config = {
    extends: require("my-config-module")
}

Or even:

{
    extends: require("my-config-module").mySpecialConfig
}

All of which works today. :)

from markdownlint.

brendo avatar brendo commented on August 19, 2024

Excellent, I missed that, thanks for showing an example! Looks like I've got some configs to consolidate now 😄

from markdownlint.

DavidAnson avatar DavidAnson commented on August 19, 2024

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. :)

from markdownlint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.