From f079c4444d2a0ae8793dd080686e79ad5eec5a44 Mon Sep 17 00:00:00 2001 From: David Anson Date: Wed, 4 Oct 2023 20:33:08 -0700 Subject: [PATCH] Update .markdownlint-cli2.jsonc/yaml example files with modulePaths, add test case for absolute platform-specific modulePaths. --- .../.markdownlint-cli2.jsonc | 5 +++++ .../.markdownlint-cli2.yaml | 4 ++++ .../dir2/.markdownlint-cli2.cjs | 20 ++++++++++++++++++ test/modulePaths-non-root/dir2/link.md | 3 +++ .../markdownlint-cli2-test-exec.js.md | 2 +- .../markdownlint-cli2-test-exec.js.snap | Bin 14297 -> 14301 bytes .../markdownlint-cli2-test-main.js.md | 2 +- .../markdownlint-cli2-test-main.js.snap | Bin 12520 -> 12523 bytes 8 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 test/modulePaths-non-root/dir2/.markdownlint-cli2.cjs create mode 100644 test/modulePaths-non-root/dir2/link.md diff --git a/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc b/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc index 350631b8..87cd4992 100644 --- a/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc +++ b/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc @@ -34,6 +34,11 @@ [ "@iktakahiro/markdown-it-katex" ] ], + // Additional paths to resolve module locations from + "modulePaths": [ + "./modules" + ], + // Disable inline config comments "noInlineConfig": true, diff --git a/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml b/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml index adb4ee29..eca7edd6 100644 --- a/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml +++ b/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml @@ -30,6 +30,10 @@ markdownItPlugins: - - "@iktakahiro/markdown-it-katex" +# Additional paths to resolve module locations from +modulePaths: + - "./modules" + # Disable inline config comments noInlineConfig: true diff --git a/test/modulePaths-non-root/dir2/.markdownlint-cli2.cjs b/test/modulePaths-non-root/dir2/.markdownlint-cli2.cjs new file mode 100644 index 00000000..427994db --- /dev/null +++ b/test/modulePaths-non-root/dir2/.markdownlint-cli2.cjs @@ -0,0 +1,20 @@ +// @ts-check + +"use strict"; + +const path = require("node:path"); + +module.exports = { + "customRules": [ + "markdownlint-rule-sample-commonjs" + ], + "markdownItPlugins": [ + [ "custom-markdown-it-plugin" ] + ], + "modulePaths": [ + "../../customRules", + "../../invalid", + "../../no-config", + "../../markdownItPlugins/module" + ].map((dir) => path.resolve(__dirname, dir)) +}; diff --git a/test/modulePaths-non-root/dir2/link.md b/test/modulePaths-non-root/dir2/link.md new file mode 100644 index 00000000..88b7f3b6 --- /dev/null +++ b/test/modulePaths-non-root/dir2/link.md @@ -0,0 +1,3 @@ +# Heading + +Text [ link ](https://example.com) diff --git a/test/snapshots/markdownlint-cli2-test-exec.js.md b/test/snapshots/markdownlint-cli2-test-exec.js.md index f26076f7..bb1069d9 100644 --- a/test/snapshots/markdownlint-cli2-test-exec.js.md +++ b/test/snapshots/markdownlint-cli2-test-exec.js.md @@ -7250,7 +7250,7 @@ Generated by [AVA](https://avajs.dev). `, stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ Finding: **/*.md␊ - Linting: 5 file(s)␊ + Linting: 6 file(s)␊ Summary: 14 error(s)␊ `, } diff --git a/test/snapshots/markdownlint-cli2-test-exec.js.snap b/test/snapshots/markdownlint-cli2-test-exec.js.snap index 49d4176614efbf3a3634181c1318c4c4be6cbe72..1df6cce66201e6fafce1c68062e2282b85b5d9e5 100644 GIT binary patch delta 77 zcmV-T0J8ttZ{2S)K~_N^Q*L2!b7*gLAa*kf0|4%&1StJQOxs883S?xV-8L9f%_0b> j!$T#18ix5u^Qo~inl}+%S>w0jHU9qx9U~DM9L)p(&rTnJ delta 73 zcmV-P0Ji_#Z`p4$K~_N^Q*L2!b7*gLAa*kf0|0Z!$VHe(I@$-8SS6a+PuFpqoKspY fDLmTf86)x4{1~w^nl}y3OXL54ZW=iW9L)p(VoV-_ diff --git a/test/snapshots/markdownlint-cli2-test-main.js.md b/test/snapshots/markdownlint-cli2-test-main.js.md index f3436ae1..30f42d83 100644 --- a/test/snapshots/markdownlint-cli2-test-main.js.md +++ b/test/snapshots/markdownlint-cli2-test-main.js.md @@ -5325,7 +5325,7 @@ Generated by [AVA](https://avajs.dev). `, stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ Finding: **/*.md␊ - Linting: 5 file(s)␊ + Linting: 6 file(s)␊ Summary: 14 error(s)␊ `, } diff --git a/test/snapshots/markdownlint-cli2-test-main.js.snap b/test/snapshots/markdownlint-cli2-test-main.js.snap index dea4afe7d53d1e7884168aeabbbf8e09ea8b1443..58139d1284052507a27aed5594b41fa9c3c9d660 100644 GIT binary patch delta 75 zcmV-R0JQ(;Ve4TsK~_N^Q*L2!b7*gLAa*kf0{{)Yzqja!Spz7GC*nw_wF`jK$A3Jr h;a}ee*xKWjG*_`QsxS|7VWv~#|9?vEUn7m10|3msA({XH delta 72 zcmV-O0Js0^Vd!BpK~_N^Q*L2!b7*gLAa*kf0{|P&BG|M2>le-5oG%|1o(m*rj!HT= eVg58T{(f!fOaZYnsxS;o