mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
Enable custom rules to use the micromark parser, export micromark helpers for reuse.
This commit is contained in:
parent
264da24dae
commit
5cc40c54b7
16 changed files with 4109 additions and 113 deletions
1
helpers/.npmignore
Normal file
1
helpers/.npmignore
Normal file
|
@ -0,0 +1 @@
|
|||
test.js
|
|
@ -3,7 +3,10 @@
|
|||
"version": "0.26.0",
|
||||
"description": "A collection of markdownlint helper functions for custom rules",
|
||||
"main": "./helpers.js",
|
||||
"exports": "./helpers.js",
|
||||
"exports": {
|
||||
".": "./helpers.js",
|
||||
"./micromark": "./micromark-helpers.cjs"
|
||||
},
|
||||
"author": "David Anson (https://dlaa.me/)",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/DavidAnson/markdownlint",
|
||||
|
|
28
helpers/test.cjs
Normal file
28
helpers/test.cjs
Normal file
|
@ -0,0 +1,28 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
// eslint-disable-next-line n/no-extraneous-require
|
||||
const test = require("ava").default;
|
||||
const { "exports": packageExports, name } = require("../helpers/package.json");
|
||||
|
||||
const exportMappings = new Map([
|
||||
[ ".", "../helpers/helpers.js" ],
|
||||
[ "./micromark", "../helpers/micromark-helpers.cjs" ]
|
||||
]);
|
||||
|
||||
test("exportMappings", (t) => {
|
||||
t.deepEqual(
|
||||
Object.keys(packageExports),
|
||||
[ ...exportMappings.keys() ]
|
||||
);
|
||||
});
|
||||
|
||||
for (const [ exportName, exportPath ] of exportMappings) {
|
||||
test(exportName, (t) => {
|
||||
t.is(
|
||||
require(exportName.replace(/^\./u, name)),
|
||||
require(exportPath)
|
||||
);
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue