4 Commits

25 changed files with 442 additions and 295 deletions

View File

@ -26,3 +26,4 @@ jobs:
- run: "npm run lint:markdown" - run: "npm run lint:markdown"
- run: "npm run lint:eslint" - run: "npm run lint:eslint"
- run: "npm run lint:prettier" - run: "npm run lint:prettier"
- run: "npm run lint:javascript"

View File

@ -2,4 +2,5 @@
. "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/_/husky.sh"
npm run lint:staged npm run lint:staged
npm run lint:javascript
npm run test npm run test

View File

@ -6,6 +6,6 @@
"MD033": false "MD033": false
}, },
"globs": ["**/*.{md,mdx}"], "globs": ["**/*.{md,mdx}"],
"ignores": ["**/node_modules", "**/test/fixtures"], "ignores": ["**/node_modules", "**/test/fixtures/**"],
"customRules": ["./src/index.js"] "customRules": ["./src/index.js"]
} }

View File

@ -43,9 +43,22 @@ With `awesome.md` content:
Running [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) with `markdownlint-rule-relative-links` will output: Running [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) with `markdownlint-rule-relative-links` will output:
```sh ```sh
awesome.md:3 relative-links Relative links should be valid [Link "./invalid.txt" should exist in the file system] awesome.md:3 relative-links Relative links should be valid ["./invalid.txt" should exist in the file system]
``` ```
### Additional features
- Support images (e.g: `![Image](./image.png)`).
- Support anchors (heading fragment links) (e.g: `[Link](./awesome.md#existing-heading)`).
- Ignore external links and absolute paths as it only checks relative links (e.g: `https://example.com/` or `/absolute/path.png`).
### Limitations
- Only images and links defined using markdown syntax are supported, html syntax is not supported (e.g: `<a href="./link.txt" />` or `<img src="./image.png" />`).
- Anchors checking is limited to headings, other elements are not supported (e.g: with a "id", `<div id="anchor" />`).
Contributions are welcome to improve the rule, and to alleviate these limitations. See [CONTRIBUTING.md](./CONTRIBUTING.md) for more information.
### Related links ### Related links
- [DavidAnson/markdownlint#253](https://github.com/DavidAnson/markdownlint/issues/253) - [DavidAnson/markdownlint#253](https://github.com/DavidAnson/markdownlint/issues/253)

24
jsconfig.json Normal file
View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "Node",
"checkJs": true,
"allowJs": true,
"noEmit": true,
"rootDir": ".",
"baseUrl": ".",
"strict": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"forceConsistentCasingInFileNames": true
}
}

365
package-lock.json generated
View File

@ -13,9 +13,10 @@
"markdown-it": "14.0.0" "markdown-it": "14.0.0"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "18.4.3", "@commitlint/cli": "18.4.4",
"@commitlint/config-conventional": "18.4.3", "@commitlint/config-conventional": "18.4.4",
"@types/node": "20.10.5", "@types/markdown-it": "13.0.7",
"@types/node": "20.10.8",
"editorconfig-checker": "5.1.2", "editorconfig-checker": "5.1.2",
"eslint": "8.56.0", "eslint": "8.56.0",
"eslint-config-conventions": "13.1.0", "eslint-config-conventions": "13.1.0",
@ -26,11 +27,12 @@
"eslint-plugin-unicorn": "50.0.1", "eslint-plugin-unicorn": "50.0.1",
"husky": "8.0.3", "husky": "8.0.3",
"lint-staged": "15.2.0", "lint-staged": "15.2.0",
"markdownlint": "0.32.1", "markdownlint": "0.33.0",
"markdownlint-cli2": "0.11.0", "markdownlint-cli2": "0.11.0",
"pinst": "3.0.0", "pinst": "3.0.0",
"prettier": "3.1.1", "prettier": "3.1.1",
"semantic-release": "22.0.12" "semantic-release": "22.0.12",
"typescript": "5.3.3"
}, },
"engines": { "engines": {
"node": ">=16.0.0", "node": ">=16.0.0",
@ -235,16 +237,16 @@
} }
}, },
"node_modules/@commitlint/cli": { "node_modules/@commitlint/cli": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-18.4.4.tgz",
"integrity": "sha512-zop98yfB3A6NveYAZ3P1Mb6bIXuCeWgnUfVNkH4yhIMQpQfzFwseadazOuSn0OOfTt0lWuFauehpm9GcqM5lww==", "integrity": "sha512-Ro3wIo//fV3XiV1EkdpHog6huaEyNcUAVrSmtgKqYM5g982wOWmP4FXvEDFwRMVgz878CNBvvCc33dMZ5AQJ/g==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/format": "^18.4.3", "@commitlint/format": "^18.4.4",
"@commitlint/lint": "^18.4.3", "@commitlint/lint": "^18.4.4",
"@commitlint/load": "^18.4.3", "@commitlint/load": "^18.4.4",
"@commitlint/read": "^18.4.3", "@commitlint/read": "^18.4.4",
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"execa": "^5.0.0", "execa": "^5.0.0",
"lodash.isfunction": "^3.0.9", "lodash.isfunction": "^3.0.9",
"resolve-from": "5.0.0", "resolve-from": "5.0.0",
@ -259,9 +261,9 @@
} }
}, },
"node_modules/@commitlint/config-conventional": { "node_modules/@commitlint/config-conventional": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-18.4.4.tgz",
"integrity": "sha512-729eRRaNta7JZF07qf6SAGSghoDEp9mH7yHU0m7ff0q89W97wDrWCyZ3yoV3mcQJwbhlmVmZPTkPcm7qiAu8WA==", "integrity": "sha512-Bz3sPQSboBN+Et/KyZrR+OJ3z9PrHDw7Bls0/hv94PmuHBtMq1dCGxS9XzTGzxeMNlytCC4kxF083tbhPljl3Q==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"conventional-changelog-conventionalcommits": "^7.0.2" "conventional-changelog-conventionalcommits": "^7.0.2"
@ -271,12 +273,12 @@
} }
}, },
"node_modules/@commitlint/config-validator": { "node_modules/@commitlint/config-validator": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-18.4.4.tgz",
"integrity": "sha512-FPZZmTJBARPCyef9ohRC9EANiQEKSWIdatx5OlgeHKu878dWwpyeFauVkhzuBRJFcCA4Uvz/FDtlDKs008IHcA==", "integrity": "sha512-/QI8KIg/h7O0Eus36fPcEcO3QPBcdXuGfZeCF5m15k0EB2bcU8s6pHNTNEa6xz9PrAefHCL+yzRJj7w20T6Mow==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"ajv": "^8.11.0" "ajv": "^8.11.0"
}, },
"engines": { "engines": {
@ -284,12 +286,12 @@
} }
}, },
"node_modules/@commitlint/ensure": { "node_modules/@commitlint/ensure": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-18.4.4.tgz",
"integrity": "sha512-MI4fwD9TWDVn4plF5+7JUyLLbkOdzIRBmVeNlk4dcGlkrVA+/l5GLcpN66q9LkFsFv6G2X31y89ApA3hqnqIFg==", "integrity": "sha512-KjD19p6julB5WrQL+Cd8p+AePwpl1XzGAjB0jnuFMKWtji9L7ucCZUKDstGjlkBZGGzH/nvdB8K+bh5K27EVUg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"lodash.camelcase": "^4.3.0", "lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1", "lodash.kebabcase": "^4.1.1",
"lodash.snakecase": "^4.1.1", "lodash.snakecase": "^4.1.1",
@ -301,21 +303,21 @@
} }
}, },
"node_modules/@commitlint/execute-rule": { "node_modules/@commitlint/execute-rule": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-18.4.4.tgz",
"integrity": "sha512-t7FM4c+BdX9WWZCPrrbV5+0SWLgT3kCq7e7/GhHCreYifg3V8qyvO127HF796vyFql75n4TFF+5v1asOOWkV1Q==", "integrity": "sha512-a37Nd3bDQydtg9PCLLWM9ZC+GO7X5i4zJvrggJv5jBhaHsXeQ9ZWdO6ODYR+f0LxBXXNYK3geYXJrCWUCP8JEg==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=v18" "node": ">=v18"
} }
}, },
"node_modules/@commitlint/format": { "node_modules/@commitlint/format": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/format/-/format-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-18.4.4.tgz",
"integrity": "sha512-8b+ItXYHxAhRAXFfYki5PpbuMMOmXYuzLxib65z2XTqki59YDQJGpJ/wB1kEE5MQDgSTQWtKUrA8n9zS/1uIDQ==", "integrity": "sha512-2v3V5hVlv0R3pe7p66IX5F7cjeVvGM5JqITRIbBCFvGHPJ/CG74rjTkAu0RBEiIhlk3eOaLjVGq3d5falPkLBA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"chalk": "^4.1.0" "chalk": "^4.1.0"
}, },
"engines": { "engines": {
@ -323,12 +325,12 @@
} }
}, },
"node_modules/@commitlint/is-ignored": { "node_modules/@commitlint/is-ignored": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-18.4.4.tgz",
"integrity": "sha512-ZseOY9UfuAI32h9w342Km4AIaTieeFskm2ZKdrG7r31+c6zGBzuny9KQhwI9puc0J3GkUquEgKJblCl7pMnjwg==", "integrity": "sha512-rXWes9owKBTjfTr6Od7YlflRg4N+ngkOH+dUZhk0qL/XQb26mHz0EgVgdixMVBac1OsohRwJaLmVHX+5F6vfmg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"semver": "7.5.4" "semver": "7.5.4"
}, },
"engines": { "engines": {
@ -336,31 +338,30 @@
} }
}, },
"node_modules/@commitlint/lint": { "node_modules/@commitlint/lint": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-18.4.4.tgz",
"integrity": "sha512-18u3MRgEXNbnYkMOWoncvq6QB8/90m9TbERKgdPqVvS+zQ/MsuRhdvHYCIXGXZxUb0YI4DV2PC4bPneBV/fYuA==", "integrity": "sha512-SoyQstVxMY5Z4GnFRtRzy+NWYb+yVseXgir+7BxnpB59oH05C9XztRrhDw6OnkNeXhjINTpi1HLnuY7So+CaAQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/is-ignored": "^18.4.3", "@commitlint/is-ignored": "^18.4.4",
"@commitlint/parse": "^18.4.3", "@commitlint/parse": "^18.4.4",
"@commitlint/rules": "^18.4.3", "@commitlint/rules": "^18.4.4",
"@commitlint/types": "^18.4.3" "@commitlint/types": "^18.4.4"
}, },
"engines": { "engines": {
"node": ">=v18" "node": ">=v18"
} }
}, },
"node_modules/@commitlint/load": { "node_modules/@commitlint/load": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/load/-/load-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-18.4.4.tgz",
"integrity": "sha512-v6j2WhvRQJrcJaj5D+EyES2WKTxPpxENmNpNG3Ww8MZGik3jWRXtph0QTzia5ZJyPh2ib5aC/6BIDymkUUM58Q==", "integrity": "sha512-RaDIa9qwOw2xRJ3Jr2DBXd14rmnHJIX2XdZF4kmoF1rgsg/+7cvrExLSUNAkQUNimyjCn1b/bKX2Omm+GdY0XQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/config-validator": "^18.4.3", "@commitlint/config-validator": "^18.4.4",
"@commitlint/execute-rule": "^18.4.3", "@commitlint/execute-rule": "^18.4.4",
"@commitlint/resolve-extends": "^18.4.3", "@commitlint/resolve-extends": "^18.4.4",
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"@types/node": "^18.11.9",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"cosmiconfig": "^8.3.6", "cosmiconfig": "^8.3.6",
"cosmiconfig-typescript-loader": "^5.0.0", "cosmiconfig-typescript-loader": "^5.0.0",
@ -373,31 +374,22 @@
"node": ">=v18" "node": ">=v18"
} }
}, },
"node_modules/@commitlint/load/node_modules/@types/node": {
"version": "18.19.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.3.tgz",
"integrity": "sha512-k5fggr14DwAytoA/t8rPrIz++lXK7/DqckthCmoZOKNsEbJkId4Z//BqgApXBUGrGddrigYa1oqheo/7YmW4rg==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
}
},
"node_modules/@commitlint/message": { "node_modules/@commitlint/message": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/message/-/message-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-18.4.4.tgz",
"integrity": "sha512-ddJ7AztWUIoEMAXoewx45lKEYEOeOlBVWjk8hDMUGpprkuvWULpaXczqdjwVtjrKT3JhhN+gMs8pm5G3vB2how==", "integrity": "sha512-lHF95mMDYgAI1LBXveJUyg4eLaMXyOqJccCK3v55ZOEUsMPrDi8upqDjd/NmzWmESYihaOMBTAnxm+6oD1WoDQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=v18" "node": ">=v18"
} }
}, },
"node_modules/@commitlint/parse": { "node_modules/@commitlint/parse": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-18.4.4.tgz",
"integrity": "sha512-eoH7CXM9L+/Me96KVcfJ27EIIbA5P9sqw3DqjJhRYuhaULIsPHFs5S5GBDCqT0vKZQDx0DgxhMpW6AQbnKrFtA==", "integrity": "sha512-99G7dyn/OoyNWXJni0Ki0K3aJd01pEb/Im/Id6y4X7PN+kGOahjz2z/cXYYHn7xDdooqFVdiVrVLeChfgpWZ2g==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"conventional-changelog-angular": "^7.0.0", "conventional-changelog-angular": "^7.0.0",
"conventional-commits-parser": "^5.0.0" "conventional-commits-parser": "^5.0.0"
}, },
@ -406,14 +398,13 @@
} }
}, },
"node_modules/@commitlint/read": { "node_modules/@commitlint/read": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/read/-/read-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-18.4.4.tgz",
"integrity": "sha512-H4HGxaYA6OBCimZAtghL+B+SWu8ep4X7BwgmedmqWZRHxRLcX2q0bWBtUm5FsMbluxbOfrJwOs/Z0ah4roP/GQ==", "integrity": "sha512-r58JbWky4gAFPea/CZmvlqP9Ehbs+8gSEUqhIJOojKzTc3xlxFnZUDVPcEnnaqzQEEoV6C69VW7xuzdcBlu/FQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/top-level": "^18.4.3", "@commitlint/top-level": "^18.4.4",
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"fs-extra": "^11.0.0",
"git-raw-commits": "^2.0.11", "git-raw-commits": "^2.0.11",
"minimist": "^1.2.6" "minimist": "^1.2.6"
}, },
@ -422,13 +413,13 @@
} }
}, },
"node_modules/@commitlint/resolve-extends": { "node_modules/@commitlint/resolve-extends": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-18.4.4.tgz",
"integrity": "sha512-30sk04LZWf8+SDgJrbJCjM90gTg2LxsD9cykCFeFu+JFHvBFq5ugzp2eO/DJGylAdVaqxej3c7eTSE64hR/lnw==", "integrity": "sha512-RRpIHSbRnFvmGifVk21Gqazf1QF/yeP+Kkg/e3PlkegcOKd/FGOXp/Kx9cvSO2K7ucSn4GD/oBvgasFoy+NCAw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/config-validator": "^18.4.3", "@commitlint/config-validator": "^18.4.4",
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"import-fresh": "^3.0.0", "import-fresh": "^3.0.0",
"lodash.mergewith": "^4.6.2", "lodash.mergewith": "^4.6.2",
"resolve-from": "^5.0.0", "resolve-from": "^5.0.0",
@ -439,15 +430,15 @@
} }
}, },
"node_modules/@commitlint/rules": { "node_modules/@commitlint/rules": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-18.4.4.tgz",
"integrity": "sha512-8KIeukDf45BiY+Lul1T0imSNXF0sMrlLG6JpLLKolkmYVQ6PxxoNOriwyZ3UTFFpaVbPy0rcITaV7U9JCAfDTA==", "integrity": "sha512-6Uzlsnl/GljEI+80NWjf4ThOfR8NIsbm18IfXYuCEchlwMHSxiuYG4rHSK5DNmG/+MIo8eR5VdQ0gQyt7kWzAA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@commitlint/ensure": "^18.4.3", "@commitlint/ensure": "^18.4.4",
"@commitlint/message": "^18.4.3", "@commitlint/message": "^18.4.4",
"@commitlint/to-lines": "^18.4.3", "@commitlint/to-lines": "^18.4.4",
"@commitlint/types": "^18.4.3", "@commitlint/types": "^18.4.4",
"execa": "^5.0.0" "execa": "^5.0.0"
}, },
"engines": { "engines": {
@ -455,18 +446,18 @@
} }
}, },
"node_modules/@commitlint/to-lines": { "node_modules/@commitlint/to-lines": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-18.4.4.tgz",
"integrity": "sha512-fy1TAleik4Zfru1RJ8ZU6cOSvgSVhUellxd3WZV1D5RwHZETt1sZdcA4mQN2y3VcIZsUNKkW0Mq8CM9/L9harQ==", "integrity": "sha512-mwe2Roa59NCz/krniAdCygFabg7+fQCkIhXqBHw00XQ8Y7lw4poZLLxeGI3p3bLpcEOXdqIDrEGLwHmG5lBdwQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=v18" "node": ">=v18"
} }
}, },
"node_modules/@commitlint/top-level": { "node_modules/@commitlint/top-level": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-18.4.4.tgz",
"integrity": "sha512-E6fJPBLPFL5R8+XUNSYkj4HekIOuGMyJo3mIx2PkYc3clel+pcWQ7TConqXxNWW4x1ugigiIY2RGot55qUq1hw==", "integrity": "sha512-PBwW1drgeavl9CadB7IPRUk6rkUP/O8jEkxjlC+ofuh3pw0bzJdAT+Kw7M1Yc9KtTb9xTaqUB8uvRtaybHa/tQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"find-up": "^5.0.0" "find-up": "^5.0.0"
@ -476,9 +467,9 @@
} }
}, },
"node_modules/@commitlint/types": { "node_modules/@commitlint/types": {
"version": "18.4.3", "version": "18.4.4",
"resolved": "https://registry.npmjs.org/@commitlint/types/-/types-18.4.3.tgz", "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-18.4.4.tgz",
"integrity": "sha512-cvzx+vtY/I2hVBZHCLrpoh+sA0hfuzHwDc+BAFPimYLjJkpHnghQM+z8W/KyLGkygJh3BtI3xXXq+dKjnSWEmA==", "integrity": "sha512-/FykLtodD8gKs3+VNkAUwofu4LBHankclj+I8fB2jTRvG6PV7k/OUt4P+VbM7ip853qS4F0g7Z6hLNa6JeMcAQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"chalk": "^4.1.0" "chalk": "^4.1.0"
@ -1126,9 +1117,9 @@
} }
}, },
"node_modules/@semantic-release/npm/node_modules/type-fest": { "node_modules/@semantic-release/npm/node_modules/type-fest": {
"version": "4.8.3", "version": "4.9.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.8.3.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.9.0.tgz",
"integrity": "sha512-//BaTm14Q/gHBn09xlnKNqfI8t6bmdzx2DXYfPBNofN0WUybCEUDcbCWcTa0oF09lzLjZgPphXAsvRiMK0V6Bw==", "integrity": "sha512-KS/6lh/ynPGiHD/LnAobrEFq3Ad4pBzOlJ1wAnJx9N4EYoqFhMfLIBjUT2UEx4wg5ZE+cC1ob6DCSpppVo+rtg==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=16" "node": ">=16"
@ -1264,9 +1255,9 @@
} }
}, },
"node_modules/@semantic-release/release-notes-generator/node_modules/type-fest": { "node_modules/@semantic-release/release-notes-generator/node_modules/type-fest": {
"version": "4.8.3", "version": "4.9.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.8.3.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.9.0.tgz",
"integrity": "sha512-//BaTm14Q/gHBn09xlnKNqfI8t6bmdzx2DXYfPBNofN0WUybCEUDcbCWcTa0oF09lzLjZgPphXAsvRiMK0V6Bw==", "integrity": "sha512-KS/6lh/ynPGiHD/LnAobrEFq3Ad4pBzOlJ1wAnJx9N4EYoqFhMfLIBjUT2UEx4wg5ZE+cC1ob6DCSpppVo+rtg==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=16" "node": ">=16"
@ -1305,6 +1296,28 @@
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true "dev": true
}, },
"node_modules/@types/linkify-it": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.5.tgz",
"integrity": "sha512-yg6E+u0/+Zjva+buc3EIb+29XEg4wltq7cSmd4Uc2EE/1nUVmxyzpX6gUXD0V8jIrG0r7YeOGVIbYRkxeooCtw==",
"dev": true
},
"node_modules/@types/markdown-it": {
"version": "13.0.7",
"resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-13.0.7.tgz",
"integrity": "sha512-U/CBi2YUUcTHBt5tjO2r5QV/x0Po6nsYwQU4Y04fBS6vfoImaiZ6f8bi3CjTCxBPQSO1LMyUqkByzi8AidyxfA==",
"dev": true,
"dependencies": {
"@types/linkify-it": "*",
"@types/mdurl": "*"
}
},
"node_modules/@types/mdurl": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.5.tgz",
"integrity": "sha512-6L6VymKTzYSrEf4Nev4Xa1LCHKrlTlYCBMTlQKFuddo1CvQcE52I0mwfOJayueUC7MJuXOeHTcIU683lzd0cUA==",
"dev": true
},
"node_modules/@types/minimist": { "node_modules/@types/minimist": {
"version": "1.2.5", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz",
@ -1312,9 +1325,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.10.5", "version": "20.10.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.8.tgz",
"integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", "integrity": "sha512-f8nQs3cLxbAFc00vEU59yf9UyGUftkPaLGfvbVOIDdx2i1b8epBqj2aNGyP19fiyXWvlmZ7qC1XLjAzw/OKIeA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"undici-types": "~5.26.4" "undici-types": "~5.26.4"
@ -1333,9 +1346,9 @@
"dev": true "dev": true
}, },
"node_modules/acorn": { "node_modules/acorn": {
"version": "8.11.2", "version": "8.11.3",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
"integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
"dev": true, "dev": true,
"bin": { "bin": {
"acorn": "bin/acorn" "acorn": "bin/acorn"
@ -1746,9 +1759,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001571", "version": "1.0.30001576",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001571.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz",
"integrity": "sha512-tYq/6MoXhdezDLFZuCO/TKboTzuQ/xR5cFdgXPfDtM7/kchBO3b4VWghE/OAi/DV7tTdhmLjZiZBZi1fA/GheQ==", "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -2132,9 +2145,9 @@
} }
}, },
"node_modules/core-js-compat": { "node_modules/core-js-compat": {
"version": "3.34.0", "version": "3.35.0",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.34.0.tgz", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.35.0.tgz",
"integrity": "sha512-4ZIyeNbW/Cn1wkMMDy+mvrRUxrwFNjKwbhCfQpDd+eLgYipDqp8oGFGtLmhh18EDPKA0g3VUBYOxQGGwvWLVpA==", "integrity": "sha512-5blwFAddknKeNgsjBzilkdQ0+YK8L1PfqPYq40NOYMYFSS38qj+hpTcLLWwpIwA2A5bje/x5jmVn2tzUMg9IVw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"browserslist": "^4.22.2" "browserslist": "^4.22.2"
@ -2409,9 +2422,9 @@
} }
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.616", "version": "1.4.625",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.616.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.625.tgz",
"integrity": "sha512-1n7zWYh8eS0L9Uy+GskE0lkBUNK83cXTVJI0pU3mGprFsbfSdAc15VTFbo+A+Bq4pwstmL30AVcEU3Fo463lNg==", "integrity": "sha512-DENMhh3MFgaPDoXWrVIqSPInQoLImywfCwrSmVl3cf9QHzoZSiutHwGaB/Ql3VkqcQV30rzgdM+BjKqBAJxo5Q==",
"dev": true "dev": true
}, },
"node_modules/emoji-regex": { "node_modules/emoji-regex": {
@ -5014,13 +5027,13 @@
} }
}, },
"node_modules/markdownlint": { "node_modules/markdownlint": {
"version": "0.32.1", "version": "0.33.0",
"resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.32.1.tgz", "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.33.0.tgz",
"integrity": "sha512-3sx9xpi4xlHlokGyHO9k0g3gJbNY4DI6oNEeEYq5gQ4W7UkiJ90VDAnuDl2U+yyXOUa6BX+0gf69ZlTUGIBp6A==", "integrity": "sha512-4lbtT14A3m0LPX1WS/3d1m7Blg+ZwiLq36WvjQqFGsX3Gik99NV+VXp/PW3n+Q62xyPdbvGOCfjPqjW+/SKMig==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"markdown-it": "13.0.2", "markdown-it": "14.0.0",
"markdownlint-micromark": "0.1.7" "markdownlint-micromark": "0.1.8"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
@ -5063,28 +5076,7 @@
"markdownlint-cli2": ">=0.0.4" "markdownlint-cli2": ">=0.0.4"
} }
}, },
"node_modules/markdownlint-cli2/node_modules/strip-json-comments": { "node_modules/markdownlint-cli2/node_modules/entities": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.1.tgz",
"integrity": "sha512-0fk9zBqO67Nq5M/m45qHCJxylV/DhBlIOVExqgOMiCCrzrhU6tCibRXNqE3jwJLftzE9SNuZtYbpzcO+i9FiKw==",
"dev": true,
"engines": {
"node": ">=14.16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/markdownlint-micromark": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.7.tgz",
"integrity": "sha512-BbRPTC72fl5vlSKv37v/xIENSRDYL/7X/XoFzZ740FGEbs9vZerLrIkFRY0rv7slQKxDczToYuMmqQFN61fi4Q==",
"dev": true,
"engines": {
"node": ">=16"
}
},
"node_modules/markdownlint/node_modules/entities": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==",
@ -5096,7 +5088,7 @@
"url": "https://github.com/fb55/entities?sponsor=1" "url": "https://github.com/fb55/entities?sponsor=1"
} }
}, },
"node_modules/markdownlint/node_modules/linkify-it": { "node_modules/markdownlint-cli2/node_modules/linkify-it": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", "integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
@ -5105,7 +5097,7 @@
"uc.micro": "^1.0.1" "uc.micro": "^1.0.1"
} }
}, },
"node_modules/markdownlint/node_modules/markdown-it": { "node_modules/markdownlint-cli2/node_modules/markdown-it": {
"version": "13.0.2", "version": "13.0.2",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.2.tgz", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.2.tgz",
"integrity": "sha512-FtwnEuuK+2yVU7goGn/MJ0WBZMM9ZPgU9spqlFs7/A/pDIUNSOQZhUgOqYCficIuR2QaFnrt8LHqBWsbTAoI5w==", "integrity": "sha512-FtwnEuuK+2yVU7goGn/MJ0WBZMM9ZPgU9spqlFs7/A/pDIUNSOQZhUgOqYCficIuR2QaFnrt8LHqBWsbTAoI5w==",
@ -5121,18 +5113,67 @@
"markdown-it": "bin/markdown-it.js" "markdown-it": "bin/markdown-it.js"
} }
}, },
"node_modules/markdownlint/node_modules/mdurl": { "node_modules/markdownlint-cli2/node_modules/markdownlint": {
"version": "0.32.1",
"resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.32.1.tgz",
"integrity": "sha512-3sx9xpi4xlHlokGyHO9k0g3gJbNY4DI6oNEeEYq5gQ4W7UkiJ90VDAnuDl2U+yyXOUa6BX+0gf69ZlTUGIBp6A==",
"dev": true,
"dependencies": {
"markdown-it": "13.0.2",
"markdownlint-micromark": "0.1.7"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/DavidAnson"
}
},
"node_modules/markdownlint-cli2/node_modules/markdownlint-micromark": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.7.tgz",
"integrity": "sha512-BbRPTC72fl5vlSKv37v/xIENSRDYL/7X/XoFzZ740FGEbs9vZerLrIkFRY0rv7slQKxDczToYuMmqQFN61fi4Q==",
"dev": true,
"engines": {
"node": ">=16"
}
},
"node_modules/markdownlint-cli2/node_modules/mdurl": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==",
"dev": true "dev": true
}, },
"node_modules/markdownlint/node_modules/uc.micro": { "node_modules/markdownlint-cli2/node_modules/strip-json-comments": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.1.tgz",
"integrity": "sha512-0fk9zBqO67Nq5M/m45qHCJxylV/DhBlIOVExqgOMiCCrzrhU6tCibRXNqE3jwJLftzE9SNuZtYbpzcO+i9FiKw==",
"dev": true,
"engines": {
"node": ">=14.16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/markdownlint-cli2/node_modules/uc.micro": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
"dev": true "dev": true
}, },
"node_modules/markdownlint-micromark": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.8.tgz",
"integrity": "sha512-1ouYkMRo9/6gou9gObuMDnvZM8jC/ly3QCFQyoSPCS2XV1ZClU0xpKbL1Ar3bWWRT1RnBZkWUEiNKrI2CwiBQA==",
"dev": true,
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/DavidAnson"
}
},
"node_modules/marked": { "node_modules/marked": {
"version": "9.1.6", "version": "9.1.6",
"resolved": "https://registry.npmjs.org/marked/-/marked-9.1.6.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.6.tgz",
@ -8483,12 +8524,12 @@
} }
}, },
"node_modules/p-filter": { "node_modules/p-filter": {
"version": "4.0.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/p-filter/-/p-filter-4.0.0.tgz", "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-4.1.0.tgz",
"integrity": "sha512-3gxOrNadcyxj+YKFyRmRIEuCMGayNNJoXL7Zf1dqfdfoDsVB190bHfFfhqfcNEDFLfQP1q2uir2cBgIqnIT+cQ==", "integrity": "sha512-37/tPdZ3oJwHaS3gNJdenCDB3Tz26i9sjhnguBtvN0vYlRIiDNnvTWkuh+0hETV9rLPdJ3rlL3yVOYPIAnM8rw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"p-map": "^7.0.0" "p-map": "^7.0.1"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
@ -8537,9 +8578,9 @@
} }
}, },
"node_modules/p-map": { "node_modules/p-map": {
"version": "7.0.0", "version": "7.0.1",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.0.tgz", "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.1.tgz",
"integrity": "sha512-EZl03dLKv3RypkrjlevZoNwQMSy4bAblWcR18zhonktnN4fUs3asFQKSe0awn982omGxamvbejqQKQYDJYHCEg==", "integrity": "sha512-2wnaR0XL/FDOj+TgpDuRb2KTjLnu3Fma6b1ZUwGY7LcqenMcvP/YFpjpbPKY6WVGsbuJZRuoUz8iPrt8ORnAFw==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=18" "node": ">=18"
@ -9255,15 +9296,18 @@
"dev": true "dev": true
}, },
"node_modules/safe-regex-test": { "node_modules/safe-regex-test": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.1.tgz",
"integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", "integrity": "sha512-Y5NejJTTliTyY4H7sipGqY+RX5P87i3F7c4Rcepy72nq+mNLhIsD0W4c7kEmduMDQCSqtPsXPlSTsFhh2LQv+g==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"call-bind": "^1.0.2", "call-bind": "^1.0.5",
"get-intrinsic": "^1.1.3", "get-intrinsic": "^1.2.2",
"is-regex": "^1.1.4" "is-regex": "^1.1.4"
}, },
"engines": {
"node": ">= 0.4"
},
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
@ -9536,9 +9580,9 @@
} }
}, },
"node_modules/semantic-release/node_modules/type-fest": { "node_modules/semantic-release/node_modules/type-fest": {
"version": "4.8.3", "version": "4.9.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.8.3.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.9.0.tgz",
"integrity": "sha512-//BaTm14Q/gHBn09xlnKNqfI8t6bmdzx2DXYfPBNofN0WUybCEUDcbCWcTa0oF09lzLjZgPphXAsvRiMK0V6Bw==", "integrity": "sha512-KS/6lh/ynPGiHD/LnAobrEFq3Ad4pBzOlJ1wAnJx9N4EYoqFhMfLIBjUT2UEx4wg5ZE+cC1ob6DCSpppVo+rtg==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=16" "node": ">=16"
@ -10331,7 +10375,6 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true, "dev": true,
"peer": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"

View File

@ -35,8 +35,9 @@
"lint:markdown": "markdownlint-cli2", "lint:markdown": "markdownlint-cli2",
"lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives --ignore-path .gitignore", "lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives --ignore-path .gitignore",
"lint:prettier": "prettier . --check --ignore-path .gitignore", "lint:prettier": "prettier . --check --ignore-path .gitignore",
"lint:javascript": "tsc --project jsconfig.json --noEmit",
"lint:staged": "lint-staged", "lint:staged": "lint-staged",
"test": "node --test ./test", "test": "node --test --experimental-test-coverage ./test",
"release": "semantic-release", "release": "semantic-release",
"postinstall": "husky install", "postinstall": "husky install",
"prepublishOnly": "pinst --disable", "prepublishOnly": "pinst --disable",
@ -46,9 +47,10 @@
"markdown-it": "14.0.0" "markdown-it": "14.0.0"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "18.4.3", "@commitlint/cli": "18.4.4",
"@commitlint/config-conventional": "18.4.3", "@commitlint/config-conventional": "18.4.4",
"@types/node": "20.10.5", "@types/markdown-it": "13.0.7",
"@types/node": "20.10.8",
"editorconfig-checker": "5.1.2", "editorconfig-checker": "5.1.2",
"eslint": "8.56.0", "eslint": "8.56.0",
"eslint-config-conventions": "13.1.0", "eslint-config-conventions": "13.1.0",
@ -59,10 +61,11 @@
"eslint-plugin-unicorn": "50.0.1", "eslint-plugin-unicorn": "50.0.1",
"husky": "8.0.3", "husky": "8.0.3",
"lint-staged": "15.2.0", "lint-staged": "15.2.0",
"markdownlint": "0.32.1", "markdownlint": "0.33.0",
"markdownlint-cli2": "0.11.0", "markdownlint-cli2": "0.11.0",
"pinst": "3.0.0", "pinst": "3.0.0",
"prettier": "3.1.1", "prettier": "3.1.1",
"semantic-release": "22.0.12" "semantic-release": "22.0.12",
"typescript": "5.3.3"
} }
} }

View File

@ -5,22 +5,27 @@ const fs = require("node:fs")
const { const {
filterTokens, filterTokens,
addError,
convertHeadingToHTMLFragment, convertHeadingToHTMLFragment,
getMarkdownHeadings, getMarkdownHeadings,
} = require("./utils.js") } = require("./utils.js")
/** @typedef {import('markdownlint').Rule} MarkdownLintRule */
/**
* @type {MarkdownLintRule}
*/
const customRule = { const customRule = {
names: ["relative-links"], names: ["relative-links"],
description: "Relative links should be valid", description: "Relative links should be valid",
tags: ["links"], tags: ["links"],
function: (params, onError) => { function: (params, onError) => {
filterTokens(params, "inline", (token) => { filterTokens(params, "inline", (token) => {
for (const child of token.children) { const children = token.children ?? []
const { lineNumber, type, attrs } = child for (const child of children) {
const { type, attrs, lineNumber } = child
/** @type {string | null} */ /** @type {string | undefined} */
let hrefSrc = null let hrefSrc
if (type === "link_open") { if (type === "link_open") {
for (const attr of attrs) { for (const attr of attrs) {
@ -45,14 +50,13 @@ const customRule = {
const isRelative = const isRelative =
url.protocol === "file:" && !hrefSrc.startsWith("/") url.protocol === "file:" && !hrefSrc.startsWith("/")
if (isRelative) { if (isRelative) {
const detail = `Link "${hrefSrc}"` const detail = `"${hrefSrc}"`
if (!fs.existsSync(url)) { if (!fs.existsSync(url)) {
addError( onError({
onError,
lineNumber, lineNumber,
`${detail} should exist in the file system`, detail: `${detail} should exist in the file system`,
) })
continue continue
} }
@ -74,11 +78,10 @@ const customRule = {
}) })
if (!headingsHTMLFragments.includes(url.hash)) { if (!headingsHTMLFragments.includes(url.hash)) {
addError( onError({
onError,
lineNumber, lineNumber,
`${detail} should have a valid fragment`, detail: `${detail} should have a valid fragment identifier`,
) })
} }
} }
} }

View File

@ -1,11 +1,14 @@
const MarkdownIt = require("markdown-it") const MarkdownIt = require("markdown-it")
/** @typedef {import('markdownlint').RuleParams} MarkdownLintRuleParams */
/** @typedef {import('markdownlint').MarkdownItToken} MarkdownItToken */
/** /**
* Calls the provided function for each matching token. * Calls the provided function for each matching token.
* *
* @param {object} params RuleParams instance. * @param {MarkdownLintRuleParams} params RuleParams instance.
* @param {string} type Token type identifier. * @param {string} type Token type identifier.
* @param {Function} handler Callback function. * @param {(token: MarkdownItToken) => void} handler Callback function.
* @returns {void} * @returns {void}
*/ */
const filterTokens = (params, type, handler) => { const filterTokens = (params, type, handler) => {
@ -16,27 +19,6 @@ const filterTokens = (params, type, handler) => {
} }
} }
/**
* Adds a generic error object via the onError callback.
*
* @param {object} onError RuleOnError instance.
* @param {number} lineNumber Line number.
* @param {string} [detail] Error details.
* @param {string} [context] Error context.
* @param {number[]} [range] Column and length of error.
* @param {object} [fixInfo] RuleOnErrorFixInfo instance.
* @returns {void}
*/
const addError = (onError, lineNumber, detail, context, range, fixInfo) => {
onError({
lineNumber,
detail,
context,
range,
fixInfo,
})
}
/** /**
* Converts a Markdown heading into an HTML fragment according to the rules * Converts a Markdown heading into an HTML fragment according to the rules
* used by GitHub. * used by GitHub.
@ -98,8 +80,10 @@ const getMarkdownHeadings = (content) => {
continue continue
} }
const children = token.children ?? []
headings.push( headings.push(
`${token.children `${children
.map((token) => { .map((token) => {
return token.content return token.content
}) })
@ -112,7 +96,6 @@ const getMarkdownHeadings = (content) => {
module.exports = { module.exports = {
filterTokens, filterTokens,
addError,
convertHeadingToHTMLFragment, convertHeadingToHTMLFragment,
getMarkdownHeadings, getMarkdownHeadings,
} }

View File

@ -1,46 +0,0 @@
const test = require("node:test")
const assert = require("node:assert/strict")
const { markdownlint } = require("markdownlint").promises
const relativeLinks = require("../src/index.js")
test("ensure the rule validate correctly", async () => {
const lintResults = await markdownlint({
files: ["test/fixtures/Valid.md", "test/fixtures/Invalid.md"],
config: {
default: false,
"relative-links": true,
},
customRules: [relativeLinks],
})
assert.equal(lintResults["test/fixtures/Valid.md"].length, 0)
assert.equal(lintResults["test/fixtures/Invalid.md"].length, 3)
assert.equal(
lintResults["test/fixtures/Invalid.md"][0]?.ruleDescription,
"Relative links should be valid",
)
assert.equal(
lintResults["test/fixtures/Invalid.md"][0]?.errorDetail,
'Link "./basic.test.js" should exist in the file system',
)
assert.equal(
lintResults["test/fixtures/Invalid.md"][1]?.ruleDescription,
"Relative links should be valid",
)
assert.equal(
lintResults["test/fixtures/Invalid.md"][1]?.errorDetail,
'Link "../image.png" should exist in the file system',
)
assert.equal(
lintResults["test/fixtures/Invalid.md"][2]?.ruleDescription,
"Relative links should be valid",
)
assert.equal(
lintResults["test/fixtures/Invalid.md"][2]?.errorDetail,
'Link "./Valid.md#not-existing-heading" should have a valid fragment',
)
})

View File

@ -1,19 +0,0 @@
# Invalid
[basic.js](./basic.test.js)
![Image](../image.png)
[Link fragment](./Valid.md#not-existing-heading)
## Existing Heading
### Repeated Heading
Text
### Repeated Heading
Text
### Repeated Heading

View File

@ -1,21 +0,0 @@
# Valid
[basic.js](../basic.test.js)
![Image](./image.png)
![Absolute Path](/absolute/path.png)
[External https link](https://example.com/)
[External https link 2](https:./external.https)
[External ftp link](ftp:./external.ftp)
[Link fragment](./Invalid.md#existing-heading)
[Link fragment Repeated 0](./Invalid.md#repeated-heading)
[Link fragment Repeated 1](./Invalid.md#repeated-heading-1)
[Link fragment Repeated 2](./Invalid.md#repeated-heading-2)

View File

@ -0,0 +1,3 @@
# Invalid
[File](./index.test.js)

View File

@ -0,0 +1,3 @@
# Valid
## Existing Heading

View File

@ -0,0 +1,3 @@
# Invalid
[Link fragment](./awesome.md#non-existing-heading)

View File

@ -0,0 +1,3 @@
# Invalid
![Image](./image.png)

3
test/fixtures/valid/existing-file.md vendored Normal file
View File

@ -0,0 +1,3 @@
# Valid
[File](../../index.test.js)

View File

@ -0,0 +1,13 @@
# Valid
## Existing Heading
### Repeated Heading
Text
### Repeated Heading
Text
### Repeated Heading

View File

@ -0,0 +1,9 @@
# Valid
[Link fragment](./awesome.md#existing-heading)
[Link fragment Repeated 0](./awesome.md#repeated-heading)
[Link fragment Repeated 1](./awesome.md#repeated-heading-1)
[Link fragment Repeated 2](./awesome.md#repeated-heading-2)

3
test/fixtures/valid/existing-image.md vendored Normal file
View File

@ -0,0 +1,3 @@
# Valid
![Image](./image.png)

View File

@ -0,0 +1,3 @@
# Valid
![Absolute Path](/absolute/path.png)

View File

@ -0,0 +1,7 @@
# Valid
[External https link](https://example.com/)
[External https link 2](https:./external.https)
[External ftp link](ftp:./external.ftp)

View File

Before

Width:  |  Height:  |  Size: 95 B

After

Width:  |  Height:  |  Size: 95 B

112
test/index.test.js Normal file
View File

@ -0,0 +1,112 @@
const { test } = require("node:test")
const assert = require("node:assert/strict")
const { markdownlint } = require("markdownlint").promises
const relativeLinksRule = require("../src/index.js")
/**
*
* @param {string} fixtureFile
* @returns
*/
const validateMarkdownLint = async (fixtureFile) => {
const lintResults = await markdownlint({
files: [fixtureFile],
config: {
default: false,
"relative-links": true,
},
customRules: [relativeLinksRule],
})
return lintResults[fixtureFile]
}
test("ensure the rule validates correctly", async (t) => {
await t.test("should be valid", async (t) => {
await t.test("with an existing heading fragment", async () => {
const lintResults = await validateMarkdownLint(
"test/fixtures/valid/existing-heading-fragment/existing-heading-fragment.md",
)
assert.equal(lintResults?.length, 0)
})
await t.test("with an existing file", async () => {
const lintResults = await validateMarkdownLint(
"test/fixtures/valid/existing-file.md",
)
assert.equal(lintResults?.length, 0)
})
await t.test("with an existing image", async () => {
const lintResults = await validateMarkdownLint(
"test/fixtures/valid/existing-image.md",
)
assert.equal(lintResults?.length, 0)
})
await t.test("should ignore absolute paths", async () => {
const lintResults = await validateMarkdownLint(
"test/fixtures/valid/ignore-absolute-paths.md",
)
assert.equal(lintResults?.length, 0)
})
await t.test("should ignore external links", async () => {
const lintResults = await validateMarkdownLint(
"test/fixtures/valid/ignore-external-links.md",
)
assert.equal(lintResults?.length, 0)
})
})
await t.test("should be invalid", async (t) => {
await t.test("with a non-existing heading fragment", async () => {
const lintResults = await validateMarkdownLint(
"test/fixtures/invalid/non-existing-heading-fragment/non-existing-heading-fragment.md",
)
assert.equal(lintResults?.length, 1)
assert.deepEqual(lintResults?.[0]?.ruleNames, relativeLinksRule.names)
assert.equal(
lintResults?.[0]?.ruleDescription,
relativeLinksRule.description,
)
assert.equal(
lintResults?.[0]?.errorDetail,
'"./awesome.md#non-existing-heading" should have a valid fragment identifier',
)
})
await t.test("with a non-existing file", async () => {
const lintResults = await validateMarkdownLint(
"test/fixtures/invalid/non-existing-file.md",
)
assert.equal(lintResults?.length, 1)
assert.deepEqual(lintResults?.[0]?.ruleNames, relativeLinksRule.names)
assert.equal(
lintResults?.[0]?.ruleDescription,
relativeLinksRule.description,
)
assert.equal(
lintResults?.[0]?.errorDetail,
'"./index.test.js" should exist in the file system',
)
})
await t.test("with a non-existing image", async () => {
const lintResults = await validateMarkdownLint(
"test/fixtures/invalid/non-existing-image.md",
)
assert.equal(lintResults?.length, 1)
assert.deepEqual(lintResults?.[0]?.ruleNames, relativeLinksRule.names)
assert.equal(
lintResults?.[0]?.ruleDescription,
relativeLinksRule.description,
)
assert.equal(
lintResults?.[0]?.errorDetail,
'"./image.png" should exist in the file system',
)
})
})
})

View File

@ -1,4 +1,4 @@
const test = require("node:test") const { test } = require("node:test")
const assert = require("node:assert/strict") const assert = require("node:assert/strict")
const { const {