feat: add support for markdownlint v0.38.0

This commit is contained in:
Théo LUDWIG 2025-05-11 16:45:14 +02:00
parent 70bdb7013e
commit 876384344c
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
8 changed files with 1851 additions and 795 deletions

View File

@ -1,4 +1,4 @@
import relativeLinksRule from "./src/index.js"
import relativeLinksRule, { markdownIt } from "./src/index.js"
const config = {
config: {
@ -10,6 +10,9 @@ const config = {
globs: ["**/*.md"],
ignores: ["**/node_modules", "**/test/fixtures/**"],
customRules: [relativeLinksRule],
markdownItFactory: () => {
return markdownIt
},
}
export default config

View File

@ -83,7 +83,7 @@ We recommend configuring [markdownlint-cli2](https://github.com/DavidAnson/markd
`.markdownlint-cli2.mjs`
```js
import relativeLinksRule from "markdownlint-rule-relative-links"
import relativeLinksRule, { markdownIt } from "markdownlint-rule-relative-links"
const config = {
config: {
@ -93,6 +93,9 @@ const config = {
globs: ["**/*.md"],
ignores: ["**/node_modules"],
customRules: [relativeLinksRule],
markdownItFactory: () => {
return markdownIt
},
}
export default config

2596
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -44,19 +44,19 @@
},
"devDependencies": {
"@types/markdown-it": "14.1.2",
"@types/node": "22.10.2",
"editorconfig-checker": "6.0.0",
"eslint": "9.17.0",
"eslint-config-conventions": "18.0.0",
"@types/node": "22.15.17",
"editorconfig-checker": "6.0.1",
"eslint": "9.26.0",
"eslint-config-conventions": "19.2.0",
"eslint-plugin-promise": "7.2.1",
"eslint-plugin-unicorn": "56.0.1",
"eslint-plugin-import-x": "4.6.1",
"globals": "15.14.0",
"markdownlint": "0.37.2",
"markdownlint-cli2": "0.17.0",
"prettier": "3.4.2",
"semantic-release": "24.2.0",
"typescript-eslint": "8.18.2",
"typescript": "5.7.2"
"eslint-plugin-unicorn": "59.0.1",
"eslint-plugin-import-x": "4.11.1",
"globals": "16.1.0",
"markdownlint": "0.38.0",
"markdownlint-cli2": "0.18.0",
"prettier": "3.5.3",
"semantic-release": "24.2.3",
"typescript-eslint": "8.32.0",
"typescript": "5.8.3"
}
}

5
src/index.d.ts vendored
View File

@ -1,5 +1,8 @@
import type MarkdownIt from "markdown-it"
import type { Rule } from "markdownlint"
declare const relativeLinksRule: Rule
export default relativeLinksRule
declare const markdownIt: MarkdownIt
export { markdownIt }

View File

@ -12,6 +12,8 @@ import {
lineFragmentRe,
} from "./utils.js"
export { markdownIt } from "./utils.js"
/** @typedef {import('markdownlint').Rule} MarkdownLintRule */
/**

View File

@ -2,7 +2,7 @@ import MarkdownIt from "markdown-it"
import { getHtmlAttributeRe } from "./markdownlint-rule-helpers/helpers.js"
const markdownIt = new MarkdownIt({ html: true })
export const markdownIt = new MarkdownIt({ html: true })
export const lineFragmentRe = /^#(?:L\d+(?:C\d+)?-L\d+(?:C\d+)?|L\d+)$/

View File

@ -3,7 +3,7 @@ import assert from "node:assert/strict"
import * as markdownlint from "markdownlint/promise"
import relativeLinksRule from "../src/index.js"
import relativeLinksRule, { markdownIt } from "../src/index.js"
/**
*
@ -18,6 +18,9 @@ const validateMarkdownLint = async (fixtureFile) => {
"relative-links": true,
},
customRules: [relativeLinksRule],
markdownItFactory: () => {
return markdownIt
},
})
return lintResults[fixtureFile]
}