From e44fa160c6df4beeaf40ce5a8bd25562bf7855a1 Mon Sep 17 00:00:00 2001 From: Jan Amann Date: Thu, 7 Nov 2024 11:31:17 +0100 Subject: [PATCH] docs: Lint links (#1510) --- docs/lintLinks.mjs | 11 +++++++++ docs/package.json | 4 +++- pnpm-lock.yaml | 56 ++++++++++++++++++++++++++++++++++++---------- 3 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 docs/lintLinks.mjs diff --git a/docs/lintLinks.mjs b/docs/lintLinks.mjs new file mode 100644 index 000000000..3156cac8e --- /dev/null +++ b/docs/lintLinks.mjs @@ -0,0 +1,11 @@ +import glob from 'fast-glob'; +import {printErrors, scanURLs, validateFiles} from 'next-validate-link'; + +const scanned = await scanURLs(); + +printErrors( + await validateFiles(await glob('src/pages/docs/**/*.{md,mdx}'), { + scanned + }), + true +); diff --git a/docs/package.json b/docs/package.json index deaf6f849..aede457f5 100644 --- a/docs/package.json +++ b/docs/package.json @@ -3,7 +3,7 @@ "private": true, "scripts": { "dev": "next dev", - "lint": "eslint src && tsc && prettier src --check", + "lint": "eslint src && tsc && prettier src --check && node lintLinks.mjs", "test": "echo 'No tests yet'", "build": "next build", "sitemap": "next-sitemap", @@ -34,8 +34,10 @@ "autoprefixer": "^10.4.19", "eslint": "^9.11.1", "eslint-config-molindo": "^8.0.0", + "fast-glob": "^3.3.2", "globals": "^15.11.0", "next-sitemap": "^4.2.3", + "next-validate-link": "^1.3.0", "prettier": "^3.3.3", "typescript": "^5.5.3" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 851f93f28..253e2107e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -126,12 +126,18 @@ importers: eslint-config-molindo: specifier: ^8.0.0 version: 8.0.0(@typescript-eslint/eslint-plugin@8.11.0(@typescript-eslint/parser@8.9.0(eslint@9.13.0(jiti@2.3.3))(typescript@5.6.3))(eslint@9.13.0(jiti@2.3.3))(typescript@5.6.3))(@typescript-eslint/parser@8.9.0(eslint@9.13.0(jiti@2.3.3))(typescript@5.6.3))(eslint@9.13.0(jiti@2.3.3))(jest@29.7.0(@types/node@20.17.0))(tailwindcss@3.4.14)(typescript@5.6.3)(vitest@2.1.3(@edge-runtime/vm@4.0.3)(@types/node@20.17.0)(jsdom@25.0.1)(terser@5.36.0)) + fast-glob: + specifier: ^3.3.2 + version: 3.3.2 globals: specifier: ^15.11.0 version: 15.11.0 next-sitemap: specifier: ^4.2.3 version: 4.2.3(next@14.2.16(@babel/core@7.25.9)(@playwright/test@1.48.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)) + next-validate-link: + specifier: ^1.3.0 + version: 1.3.0 prettier: specifier: ^3.3.3 version: 3.3.3 @@ -2595,7 +2601,7 @@ packages: '@expo/bunyan@4.0.1': resolution: {integrity: sha512-+Lla7nYSiHZirgK+U/uYzsLv/X+HaJienbD5AKX1UQZHYfWaP+9uuQluRB4GrEVWF0GZ7vEVp/jzaOT9k/SQlg==} - engines: {'0': node >=0.10.0} + engines: {node: '>=0.10.0'} '@expo/cli@0.4.11': resolution: {integrity: sha512-L9Ci9RBh0aPFEDF1AjDYPk54OgeUJIKzxF3lRgITm+lQpI3IEKjAc9LaYeQeO1mlZMUQmPkHArF8iyz1eOeVoQ==} @@ -10551,6 +10557,9 @@ packages: react: ^16.8 || ^17 || ^18 react-dom: ^16.8 || ^17 || ^18 + next-validate-link@1.3.0: + resolution: {integrity: sha512-wvP+wGZ2pCsvymh+KunaYEo7/OPcKn0qvx+IChtbQmkDu5e/MRfBZukPVf1Q9YR0fZA4Y03FGsmojKyBv0F2+w==} + next@12.3.4: resolution: {integrity: sha512-VcyMJUtLZBGzLKo3oMxrEF0stxh8HwuW976pAzlHhI3t8qJ4SROjCrSh1T24bhrbjw55wfZXAbXPGwPt5FLRfQ==} engines: {node: '>=12.22.0'} @@ -12249,6 +12258,9 @@ packages: remark-stringify@11.0.0: resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==} + remark@15.0.1: + resolution: {integrity: sha512-Eht5w30ruCXgFmxVUSlNWQ9iiimq07URKeFS3hNc8cUWy1llX4KDWfyEDZRycMc+znsN9Ux5/tJ/BFdgdOwA3A==} + remove-trailing-separator@1.1.0: resolution: {integrity: sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==} @@ -16996,7 +17008,7 @@ snapshots: jest-util: 29.7.0 jest-validate: 29.7.0 jest-watcher: 29.7.0 - micromatch: 4.0.7 + micromatch: 4.0.8 pretty-format: 29.7.0 slash: 3.0.0 strip-ansi: 6.0.1 @@ -17111,7 +17123,7 @@ snapshots: jest-haste-map: 29.7.0 jest-regex-util: 29.6.3 jest-util: 29.7.0 - micromatch: 4.0.7 + micromatch: 4.0.8 pirates: 4.0.6 slash: 3.0.0 write-file-atomic: 4.0.2 @@ -23615,7 +23627,7 @@ snapshots: '@nodelib/fs.walk': 1.2.8 glob-parent: 5.1.2 merge2: 1.4.1 - micromatch: 4.0.7 + micromatch: 4.0.8 fast-json-parse@1.0.3: {} @@ -25376,7 +25388,7 @@ snapshots: jest-runner: 29.7.0 jest-util: 29.7.0 jest-validate: 29.7.0 - micromatch: 4.0.7 + micromatch: 4.0.8 parse-json: 5.2.0 pretty-format: 29.7.0 slash: 3.0.0 @@ -25406,7 +25418,7 @@ snapshots: jest-runner: 29.7.0 jest-util: 29.7.0 jest-validate: 29.7.0 - micromatch: 4.0.7 + micromatch: 4.0.8 parse-json: 5.2.0 pretty-format: 29.7.0 slash: 3.0.0 @@ -25476,7 +25488,7 @@ snapshots: jest-regex-util: 29.6.3 jest-util: 29.7.0 jest-worker: 29.7.0 - micromatch: 4.0.7 + micromatch: 4.0.8 walker: 1.0.8 optionalDependencies: fsevents: 2.3.3 @@ -25500,7 +25512,7 @@ snapshots: '@types/stack-utils': 2.0.3 chalk: 4.1.2 graceful-fs: 4.2.11 - micromatch: 4.0.7 + micromatch: 4.0.8 pretty-format: 29.7.0 slash: 3.0.0 stack-utils: 2.0.6 @@ -27643,7 +27655,7 @@ snapshots: nanospinner@1.1.0: dependencies: - picocolors: 1.1.0 + picocolors: 1.1.1 natural-compare-lite@1.4.0: {} @@ -27696,6 +27708,17 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) + next-validate-link@1.3.0: + dependencies: + fast-glob: 3.3.2 + gray-matter: 4.0.3 + picocolors: 1.1.1 + remark: 15.0.1 + remark-gfm: 4.0.0 + unist-util-visit: 5.0.0 + transitivePeerDependencies: + - supports-color + next@12.3.4(@babel/core@7.25.9)(react-dom@17.0.2(react@17.0.2))(react@17.0.2): dependencies: '@next/env': 12.3.4 @@ -29023,13 +29046,13 @@ snapshots: postcss@8.4.38: dependencies: nanoid: 3.3.7 - picocolors: 1.0.1 + picocolors: 1.1.1 source-map-js: 1.2.0 postcss@8.4.39: dependencies: nanoid: 3.3.7 - picocolors: 1.0.1 + picocolors: 1.1.1 source-map-js: 1.2.0 postcss@8.4.47: @@ -29900,6 +29923,15 @@ snapshots: mdast-util-to-markdown: 2.1.0 unified: 11.0.5 + remark@15.0.1: + dependencies: + '@types/mdast': 4.0.4 + remark-parse: 11.0.0 + remark-stringify: 11.0.0 + unified: 11.0.5 + transitivePeerDependencies: + - supports-color + remove-trailing-separator@1.1.0: {} remove-trailing-slash@0.1.1: {} @@ -31958,7 +31990,7 @@ snapshots: debug: 4.3.7(supports-color@6.1.0) mlly: 1.7.1 pathe: 1.1.2 - picocolors: 1.0.1 + picocolors: 1.1.1 source-map: 0.6.1 source-map-support: 0.5.21 vite: 4.5.5(@types/node@22.7.9)(terser@5.36.0)