From cf64bf0766d831df963586bf4f70df48b6a6d91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Wed, 5 Jun 2024 19:15:35 +0200 Subject: [PATCH 1/2] Attempt to allow textlint disable comments --- Lombiq.NodeJs.Extensions/package.json | 3 +- Lombiq.NodeJs.Extensions/pnpm-lock.yaml | 67 ++++++++++++------- .../scripts/lint-markdown.js | 3 + 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/Lombiq.NodeJs.Extensions/package.json b/Lombiq.NodeJs.Extensions/package.json index 5685a79f..c3763355 100644 --- a/Lombiq.NodeJs.Extensions/package.json +++ b/Lombiq.NodeJs.Extensions/package.json @@ -12,8 +12,8 @@ "clean-css-cli": "5.6.2", "copyfiles": "2.4.1", "eslint": "8.47.0", - "if-env": "1.0.4", "glob": "10.3.10", + "if-env": "1.0.4", "markdownlint": "0.34.0", "nodemon": "3.0.1", "npm-run-all": "4.1.5", @@ -26,6 +26,7 @@ "stylelint-config-standard-scss": "11.1.0", "terser": "5.19.2", "textlint": "13.3.3", + "textlint-filter-rule-comments": "1.2.2", "textlint-rule-common-misspellings": "1.0.1", "textlint-rule-doubled-spaces": "1.0.2", "textlint-rule-max-comma": "3.0.1", diff --git a/Lombiq.NodeJs.Extensions/pnpm-lock.yaml b/Lombiq.NodeJs.Extensions/pnpm-lock.yaml index e49354c6..e1ff9cf2 100644 --- a/Lombiq.NodeJs.Extensions/pnpm-lock.yaml +++ b/Lombiq.NodeJs.Extensions/pnpm-lock.yaml @@ -39,8 +39,8 @@ dependencies: specifier: 1.0.4 version: 1.0.4 markdownlint: - specifier: 0.30.0 - version: 0.30.0 + specifier: 0.34.0 + version: 0.34.0 nodemon: specifier: 3.0.1 version: 3.0.1 @@ -74,6 +74,9 @@ dependencies: textlint: specifier: 13.3.3 version: 13.3.3 + textlint-filter-rule-comments: + specifier: 1.2.2 + version: 1.2.2(textlint@13.3.3) textlint-rule-common-misspellings: specifier: 1.0.1 version: 1.0.1 @@ -2836,8 +2839,8 @@ packages: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} dev: false - /entities@3.0.1: - resolution: {integrity: sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==} + /entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} dev: false @@ -4497,10 +4500,10 @@ packages: /lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - /linkify-it@4.0.1: - resolution: {integrity: sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==} + /linkify-it@5.0.0: + resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} dependencies: - uc.micro: 1.0.6 + uc.micro: 2.1.0 dev: false /load-json-file@1.1.0: @@ -4631,15 +4634,16 @@ packages: resolution: {integrity: sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==} dev: false - /markdown-it@13.0.1: - resolution: {integrity: sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==} + /markdown-it@14.1.0: + resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==} hasBin: true dependencies: argparse: 2.0.1 - entities: 3.0.1 - linkify-it: 4.0.1 - mdurl: 1.0.1 - uc.micro: 1.0.6 + entities: 4.5.0 + linkify-it: 5.0.0 + mdurl: 2.0.0 + punycode.js: 2.3.1 + uc.micro: 2.1.0 dev: false /markdown-table@2.0.0: @@ -4648,17 +4652,17 @@ packages: repeat-string: 1.6.1 dev: false - /markdownlint-micromark@0.1.7: - resolution: {integrity: sha512-BbRPTC72fl5vlSKv37v/xIENSRDYL/7X/XoFzZ740FGEbs9vZerLrIkFRY0rv7slQKxDczToYuMmqQFN61fi4Q==} - engines: {node: '>=16'} + /markdownlint-micromark@0.1.9: + resolution: {integrity: sha512-5hVs/DzAFa8XqYosbEAEg6ok6MF2smDj89ztn9pKkCtdKHVdPQuGMH7frFfYL9mLkvfFe4pTyAMffLbjf3/EyA==} + engines: {node: '>=18'} dev: false - /markdownlint@0.30.0: - resolution: {integrity: sha512-nInuFvI/rEzanAOArW5490Ez4EYpB5ODqVM0mcDYCPx9DKJWCQqCgejjiCvbSeE7sjbDscVtZmwr665qpF5xGA==} - engines: {node: '>=16'} + /markdownlint@0.34.0: + resolution: {integrity: sha512-qwGyuyKwjkEMOJ10XN6OTKNOVYvOIi35RNvDLNxTof5s8UmyGHlCdpngRHoRGNvQVGuxO3BJ7uNSgdeX166WXw==} + engines: {node: '>=18'} dependencies: - markdown-it: 13.0.1 - markdownlint-micromark: 0.1.7 + markdown-it: 14.1.0 + markdownlint-micromark: 0.1.9 dev: false /mathml-tag-names@2.1.3: @@ -4768,8 +4772,8 @@ packages: resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} dev: false - /mdurl@1.0.1: - resolution: {integrity: sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==} + /mdurl@2.0.0: + resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} dev: false /memorystream@0.3.1: @@ -5510,6 +5514,11 @@ packages: resolution: {integrity: sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==} dev: false + /punycode.js@2.3.1: + resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} + engines: {node: '>=6'} + dev: false + /punycode@2.3.0: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} @@ -6353,6 +6362,14 @@ packages: /text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + /textlint-filter-rule-comments@1.2.2(textlint@13.3.3): + resolution: {integrity: sha512-AtyxreCPb3Hq/bd6Qd6szY1OGgnW34LOjQXAHzE8NoXbTUudQqALPdRe+hvRsf81rnmGLxBiCUXZbnbpIseFyw==} + peerDependencies: + textlint: '>=6.8.0' + dependencies: + textlint: 13.3.3 + dev: false + /textlint-rule-common-misspellings@1.0.1: resolution: {integrity: sha512-f5KWhQFJzJBUX3RirAS25aSkAaaOHeSHtBeb7d49O+vxnAX3dZBS5DB/e5M1kR4tifW4qae64oqWZygoGYWkjQ==} dependencies: @@ -6590,8 +6607,8 @@ packages: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} dev: false - /uc.micro@1.0.6: - resolution: {integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==} + /uc.micro@2.1.0: + resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} dev: false /unbox-primitive@1.0.2: diff --git a/Lombiq.NodeJs.Extensions/scripts/lint-markdown.js b/Lombiq.NodeJs.Extensions/scripts/lint-markdown.js index c4bd7a58..b9b34583 100644 --- a/Lombiq.NodeJs.Extensions/scripts/lint-markdown.js +++ b/Lombiq.NodeJs.Extensions/scripts/lint-markdown.js @@ -28,6 +28,9 @@ const textLintConfig = { 'max-comma', 'no-empty-section', ], + filters: { + comments: true, + }, }; function getMarkdownPaths() { From 95dee28933c75242d9b86b4f5b76a5954c4655b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 6 Jun 2024 14:30:08 +0200 Subject: [PATCH 2/2] Fixing textlint disabling comments --- Lombiq.NodeJs.Extensions/Docs/Markdown.md | 19 ++++++++++++++++++- .../scripts/lint-markdown.js | 6 +++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Lombiq.NodeJs.Extensions/Docs/Markdown.md b/Lombiq.NodeJs.Extensions/Docs/Markdown.md index dff1f51d..2a81370e 100644 --- a/Lombiq.NodeJs.Extensions/Docs/Markdown.md +++ b/Lombiq.NodeJs.Extensions/Docs/Markdown.md @@ -1,4 +1,4 @@ -# Pipeline for Markdown files +# Pipeline for Markdown files This project provides a way to lint all Markdown files in your project, a given folder, or the whole solution. @@ -22,6 +22,23 @@ This is useful to catch files not covered by an individual project, such as the > ℹ When using Lombiq Node.js Extensions from a submodule, solution-wide Markdown analysis can more easily be achieved by adding the [Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis](../../Lombiq.NodeJs.Extensions.SolutionMarkdownAnalysis/Readme.md) project to your solution as well. +### Disabling linting rules + +If you find false positives, you can disable linting rules for a specific section of a file with [`textlint-filter-rule-comments`](https://github.com/textlint/textlint-filter-rule-comments). We recommend you only disable the specific rule for only the narrowest block of text affected, e.g.: + +```markdown + + +> [!NOTE] +> The code samples in the documentation reference the latest versions of the workflows and actions from the... + + +``` + +Note the newlines around the disable block, which is necessary, see the [`textlint-filter-rule-comments` docs](https://github.com/textlint/textlint-filter-rule-comments?tab=readme-ov-file#usage). + +Or, you can use `` and `` to disable all rules for a block of text. + ## Available scripts To use the `npm` scripts defined in this project, please follow the setup instructions in the root [Readme](../../Readme.md#how-to-trigger-pipelines-on-demand). diff --git a/Lombiq.NodeJs.Extensions/scripts/lint-markdown.js b/Lombiq.NodeJs.Extensions/scripts/lint-markdown.js index b9b34583..bda7a9bb 100644 --- a/Lombiq.NodeJs.Extensions/scripts/lint-markdown.js +++ b/Lombiq.NodeJs.Extensions/scripts/lint-markdown.js @@ -28,9 +28,9 @@ const textLintConfig = { 'max-comma', 'no-empty-section', ], - filters: { - comments: true, - }, + filterRules: [ + 'comments', + ], }; function getMarkdownPaths() {