Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Nov 24, 2024
1 parent e815e1a commit 0a043bb
Show file tree
Hide file tree
Showing 35 changed files with 114 additions and 2,226 deletions.
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
coverage
demo/markdown-it.min.js
demo/markdownlint-browser.min.js
demo/micromark-browser.js
demo/micromark-html-browser.js
micromark/micromark.cjs
micromark/micromark.dev.cjs
micromark/micromark-browser.js
micromark/micromark-browser.dev.js
micromark/micromark-html-browser.js
micromark/micromark-html-browser.dev.js
demo/markdownlint-browser.min.cjs
node_modules
!test/node_modules
npm-debug.log
Expand Down
4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
.vscode
coverage
demo/*
!demo/markdownlint-browser.js
!demo/markdownlint-browser.cjs
doc-build
eslint.config.mjs
example
micromark
npm-debug.log
schema/*.js
schema/*.mjs
scripts
test
test-repos
File renamed without changes.
4 changes: 2 additions & 2 deletions demo/default.htm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<script src="markdown-it.min.js"></script>
<script src="micromark-browser.js"></script>
<script src="micromark-html-browser.js"></script>
<script src="markdownlint-browser.min.js"></script>
<script src="default.js"></script>
<script src="markdownlint-browser.min.cjs"></script>
<script src="default.cjs"></script>
</body>
</html>
8 changes: 3 additions & 5 deletions demo/webpack.config.js → demo/webpack.config.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// @ts-check

"use strict";

const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
import webpack from "webpack";
import TerserPlugin from "terser-webpack-plugin";
const nodeModulePrefixRe = /^node:/u;

function config(options) {
Expand Down Expand Up @@ -84,7 +82,7 @@ const entryLibrary = {
// "entry": "../helpers/helpers.js",
// "packageJson": require("../helpers/package.json")
// };
module.exports = [
export default [
config({
...entryLibrary,
...modeDevelopment,
Expand Down
2 changes: 1 addition & 1 deletion helpers/.npmignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
test.js
test.cjs
File renamed without changes.
4 changes: 2 additions & 2 deletions helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "markdownlint-rule-helpers",
"version": "0.27.0",
"description": "A collection of markdownlint helper functions for custom rules",
"main": "./helpers.js",
"main": "./helpers.cjs",
"exports": {
".": "./helpers.js",
".": "./helpers.cjs",
"./micromark": "./micromark-helpers.cjs"
},
"author": "David Anson (https://dlaa.me/)",
Expand Down
File renamed without changes.
18 changes: 5 additions & 13 deletions lib/cache.js → lib/cache.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// @ts-check

"use strict";

const helpers = require("../helpers");
const { filterByTypes } = require("../helpers/micromark-helpers.cjs");
import helpers from "../helpers/helpers.cjs";

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 22)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 23.1)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 23.1)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 18)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

Module '"D:/a/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 23.1)

Module '"D:/a/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

Module '"D:/a/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 20)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 3 in lib/cache.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 22)

Module '"D:/a/markdownlint/markdownlint/helpers/helpers"' has no default export.
import { filterByTypes } from "../helpers/micromark-helpers.cjs";

/** @type {Map<string, object>} */
const map = new Map();
Expand All @@ -15,7 +13,7 @@ let params = undefined;
* @param {import("./markdownlint").RuleParams} [p] Rule parameters object.
* @returns {void}
*/
function initialize(p) {
export function initialize(p) {
map.clear();
params = p;
}
Expand Down Expand Up @@ -43,7 +41,7 @@ function getCached(name, getValue) {
* @param {boolean} [htmlFlow] Whether to include htmlFlow content.
* @returns {import("./markdownlint").MicromarkToken[]} Filtered tokens.
*/
function filterByTypesCached(types, htmlFlow) {
export function filterByTypesCached(types, htmlFlow) {
return getCached(
// eslint-disable-next-line prefer-rest-params
JSON.stringify(arguments),
Expand All @@ -56,15 +54,9 @@ function filterByTypesCached(types, htmlFlow) {
*
* @returns {Object} Reference link and image data object.
*/
function getReferenceLinkImageData() {
export function getReferenceLinkImageData() {
return getCached(
getReferenceLinkImageData.name,
() => helpers.getReferenceLinkImageData(params.parsers.micromark.tokens)
);
}

module.exports = {
initialize,
filterByTypesCached,
getReferenceLinkImageData
};
10 changes: 4 additions & 6 deletions lib/constants.js → lib/constants.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// @ts-check

"use strict";

module.exports.deprecatedRuleNames = [];
module.exports.fixableRuleNames = [
export const deprecatedRuleNames = [];
export const fixableRuleNames = [
"MD004", "MD005", "MD007", "MD009", "MD010", "MD011",
"MD012", "MD014", "MD018", "MD019", "MD020", "MD021",
"MD022", "MD023", "MD026", "MD027", "MD030", "MD031",
"MD032", "MD034", "MD037", "MD038", "MD039", "MD044",
"MD047", "MD049", "MD050", "MD051", "MD053", "MD054",
"MD058"
];
module.exports.homepage = "https://github.com/DavidAnson/markdownlint";
module.exports.version = "0.36.1";
export const homepage = "https://github.com/DavidAnson/markdownlint";
export const version = "0.36.1";
29 changes: 12 additions & 17 deletions lib/markdownlint.js → lib/markdownlint.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
// @ts-check

"use strict";

const path = require("node:path");
const { promisify } = require("node:util");
const micromark = require("../helpers/micromark-parse.cjs");
const { version } = require("./constants");
const rules = require("./rules");
const helpers = require("../helpers");
const cache = require("./cache");

// @ts-ignore
// eslint-disable-next-line camelcase, no-inline-comments, no-undef
const dynamicRequire = (typeof __non_webpack_require__ === "undefined") ? require : /* c8 ignore next */ __non_webpack_require__;
// Capture native require implementation for dynamic loading of modules
import { createRequire } from "node:module";
const dynamicRequire = createRequire(import.meta.url);

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 22)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 23.1)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 23.1)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 18)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 23.1)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 20)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

Check failure on line 4 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 22)

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
import path from "node:path";

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 22)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 23.1)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 23.1)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 18)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 23.1)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 20)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 22)

Module '"node:path"' can only be default-imported using the 'esModuleInterop' flag
import { promisify } from "node:util";
import micromark from "../helpers/micromark-parse.cjs";

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 22)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 23.1)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 23.1)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 18)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

Module '"D:/a/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 23.1)

Module '"D:/a/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

Module '"D:/a/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 20)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.

Check failure on line 7 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 22)

Module '"D:/a/markdownlint/markdownlint/helpers/micromark-parse"' has no default export.
import { version } from "./constants.mjs";
import rules from "./rules.mjs";
import helpers from "../helpers/helpers.cjs";

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 22)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 23.1)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 23.1)

Module '"/home/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 18)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

Module '"D:/a/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 23.1)

Module '"D:/a/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

Module '"D:/a/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (macos-latest, 20)

Module '"/Users/runner/work/markdownlint/markdownlint/helpers/helpers"' has no default export.

Check failure on line 10 in lib/markdownlint.mjs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 22)

Module '"D:/a/markdownlint/markdownlint/helpers/helpers"' has no default export.
import { initialize as cacheInitialize } from "./cache.mjs";

/**
* Validate the list of rules for structure and reuse.
Expand Down Expand Up @@ -533,7 +528,7 @@ function lintContent(
"lines": Object.freeze(lines),
"frontMatterLines": Object.freeze(frontMatterLines)
};
cache.initialize({
cacheInitialize({
...paramsBase,
"parsers": parsersMicromark,
"config": null
Expand Down Expand Up @@ -751,7 +746,7 @@ function lintContent(
} catch (error) {
callbackError(error);
} finally {
cache.initialize();
cacheInitialize();
}
}

Expand Down Expand Up @@ -1342,7 +1337,7 @@ markdownlint.promises = {
};
markdownlint.applyFix = applyFix;
markdownlint.applyFixes = applyFixes;
module.exports = markdownlint;
export default markdownlint;

// Type declarations

Expand Down
10 changes: 4 additions & 6 deletions lib/md001.js → lib/md001.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// @ts-check

"use strict";

const { addErrorDetailIf } = require("../helpers");
const { getHeadingLevel } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { getHeadingLevel } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";

// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
export default {
"names": [ "MD001", "heading-increment" ],
"description": "Heading levels should only increment by one level at a time",
"tags": [ "headings" ],
Expand Down
10 changes: 4 additions & 6 deletions lib/md003.js → lib/md003.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// @ts-check

"use strict";

const { addErrorDetailIf } = require("../helpers");
const { getHeadingLevel, getHeadingStyle } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { getHeadingLevel, getHeadingStyle } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";

// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
export default {
"names": [ "MD003", "heading-style" ],
"description": "Heading style",
"tags": [ "headings" ],
Expand Down
10 changes: 4 additions & 6 deletions lib/md004.js → lib/md004.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// @ts-check

"use strict";

const { addErrorDetailIf } = require("../helpers");
const { getDescendantsByType, getParentOfType } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorDetailIf } from "../helpers";
import { getDescendantsByType, getParentOfType } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";

const markerToStyle = {
"-": "dash",
Expand All @@ -31,7 +29,7 @@ const validStyles = new Set([

// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
export default {
"names": [ "MD004", "ul-style" ],
"description": "Unordered list style",
"tags": [ "bullet", "ul" ],
Expand Down
8 changes: 3 additions & 5 deletions lib/md005.js → lib/md005.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// @ts-check

"use strict";

const { addError, addErrorDetailIf } = require("../helpers");
const { filterByTypesCached } = require("./cache");
import { addError, addErrorDetailIf } from "../helpers/helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";

// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
export default {
"names": [ "MD005", "list-indent" ],
"description": "Inconsistent indentation for list items at the same level",
"tags": [ "bullet", "ul", "indentation" ],
Expand Down
10 changes: 4 additions & 6 deletions lib/md019-md021.js → lib/md019-md021.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// @ts-check

"use strict";

const { addErrorContext } = require("../helpers/helpers");
const { getHeadingStyle } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorContext } from "../helpers/helpers.cjs";
import { getHeadingStyle } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";

/**
* Validate heading sequence and whitespace length at start or end.
Expand Down Expand Up @@ -49,7 +47,7 @@ function validateHeadingSpaces(onError, heading, delta) {

// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule[] */
module.exports = [
export default [
{
"names": [ "MD019", "no-multiple-space-atx" ],
"description": "Multiple spaces after hash on atx style heading",
Expand Down
8 changes: 3 additions & 5 deletions lib/md049-md050.js → lib/md049-md050.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// @ts-check

"use strict";

const { addError } = require("../helpers");
const { filterByPredicate, getDescendantsByType } = require("../helpers/micromark-helpers.cjs");
import { addError } from "../helpers/helpers.cjs";
import { filterByPredicate, getDescendantsByType } from "../helpers/micromark-helpers.cjs";

const intrawordRe = /^\w$/;

Expand Down Expand Up @@ -80,7 +78,7 @@ const impl =

// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule[] */
module.exports = [
export default [
{
"names": [ "MD049", "emphasis-style" ],
"description": "Emphasis style",
Expand Down
32 changes: 16 additions & 16 deletions lib/rules.js → lib/rules.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// @ts-check

"use strict";
import { homepage, version } from "./constants.mjs";

const { homepage, version } = require("./constants");

// @ts-ignore
const [ md019, md021 ] = require("./md019-md021");
// @ts-ignore
const [ md049, md050 ] = require("./md049-md050");
import md001 from "./md001.mjs";
import md003 from "./md003.mjs";
import md004 from "./md004.mjs";
import md005 from "./md005.mjs";
import md019md021 from "./md019-md021.mjs";
import md049md050 from "./md049-md050.mjs";

const rules = [
require("./md001"),
md001,
// md002: Deprecated and removed
require("./md003"),
require("./md004"),
require("./md005"),
md003,
md004,
md005,
// md006: Deprecated and removed
require("./md007"),
require("./md009"),
Expand All @@ -24,9 +24,9 @@ const rules = [
require("./md013"),
require("./md014"),
require("./md018"),
md019,
md019md021[0],
require("./md020"),
md021,
md019md021[1],
require("./md022"),
require("./md023"),
require("./md024"),
Expand Down Expand Up @@ -54,8 +54,8 @@ const rules = [
require("./md046"),
require("./md047"),
require("./md048"),
md049,
md050,
md049md050[0],
md049md050[1],
require("./md051"),
require("./md052"),
require("./md053"),
Expand All @@ -71,4 +71,4 @@ for (const rule of rules) {
rule["information"] =
new URL(`${homepage}/blob/v${version}/doc/${name}.md`);
}
module.exports = rules;
export default rules;
6 changes: 0 additions & 6 deletions micromark/.npmignore

This file was deleted.

2 changes: 0 additions & 2 deletions micromark/.npmrc

This file was deleted.

Loading

0 comments on commit 0a043bb

Please sign in to comment.