4
0
Эх сурвалжийг харах

Migrate markdownlint-cli to markdownlint-cli2 (single config file) (#8987)

* Migrate markdownlint-cli to markdownlint-cli2

Replace markdownlint-cli with markdownlint-cli2 and consolidate the three
separate configuration points (.markdownlint.json rules, .markdownlintignore
excludes, and the '**/*.md' glob in the npm scripts) into a single
.markdownlint-cli2.jsonc holding config + globs + ignores.

The npm script names (markdownlint / markdownlint_fix) are unchanged, so the
CI step and the test/fix compound scripts need no change. markdownlint-cli2
v0.23.0 bundles the same markdownlint v0.41.0, so linting behaviour is
identical (112 files, 0 errors).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Add JSONC to .editorconfig

* Reduce obvious comments

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Jam Balaya 10 цаг өмнө
parent
commit
ffc5a966c3

+ 1 - 1
.editorconfig

@@ -15,7 +15,7 @@ indent_style = tab
 [*.js]
 indent_style = tab
 
-[*.json]
+[*.{json,jsonc}]
 indent_style = tab
 
 [*.md]

+ 1 - 1
.github/instructions/markdown.instructions.md

@@ -5,7 +5,7 @@ description: Editing Markdown
 
 # Markdown files
 
-* Obey formatting rules defined in [`.markdownlint.json`](../../.markdownlint.json)
+* Obey formatting rules defined in [`.markdownlint-cli2.jsonc`](../../.markdownlint-cli2.jsonc)
 * For fenced code blocks:
 	* Use language identifiers as much as possible, e.g., `php`, `js`, `css`
 	* Favour `sh` over `bash`

+ 36 - 0
.markdownlint-cli2.jsonc

@@ -0,0 +1,36 @@
+{
+	"config": {
+		"default": true,
+		"blanks-around-fences": false,
+		"blanks-around-lists": false,
+		"first-line-heading": false,
+		"line-length": false,
+		"no-hard-tabs": false,
+		"no-inline-html": {
+			"allowed_elements": ["br", "img", "kbd", "translations", "meta"]
+		},
+		"no-multiple-blanks": {
+			"maximum": 2
+		},
+		"no-trailing-spaces": true,
+		"table-column-style": false,
+		"ul-indent": false,
+		"ul-style": {
+			"style": "consistent"
+		}
+	},
+	// Markdown files to lint (previously the '**/*.md' CLI argument)
+	"globs": [
+		"**/*.md"
+	],
+	"ignores": [
+		"**/node_modules/**",
+		"extensions/**",
+		"lib/marienfressinaud/**",
+		"lib/phpgt/**",
+		"lib/phpmailer/**",
+		"lib/simplepie/**",
+		"p/scripts/vendor/**",
+		"vendor/**"
+	]
+}

+ 0 - 20
.markdownlint.json

@@ -1,20 +0,0 @@
-{
-	"default": true,
-	"blanks-around-fences": false,
-	"blanks-around-lists": false,
-	"first-line-heading": false,
-	"line-length": false,
-	"no-hard-tabs": false,
-	"no-inline-html": {
-		"allowed_elements": ["br", "img", "kbd", "translations", "meta"]
-	},
-	"no-multiple-blanks": {
-		"maximum": 2
-	},
-	"no-trailing-spaces": true,
-	"table-column-style": false,
-	"ul-indent": false,
-	"ul-style": {
-		"style": "consistent"
-	}
-}

+ 0 - 9
.markdownlintignore

@@ -1,9 +0,0 @@
-.git/
-extensions/
-lib/marienfressinaud/
-lib/phpgt/
-lib/phpmailer/
-lib/simplepie/
-node_modules/
-p/scripts/vendor/
-vendor/

+ 1 - 1
docs/en/developers/02_First_steps.md

@@ -148,7 +148,7 @@ A short (not complete) summary:
 > ℹ Check [`markdown.instructions.md`](https://github.com/FreshRSS/FreshRSS/blob/edge/.github/instructions/markdown.instructions.md) for detailed coding conventions (both for humans and AI agents).
 
 - Linter:
-  - via npm `.markdownlint.json`
+  - via npm `.markdownlint-cli2.jsonc`
 
 ## Spaces, tabs and other whitespace characters
 

+ 53 - 113
package-lock.json

@@ -11,7 +11,7 @@
 				"@stylistic/stylelint-plugin": "^5.2.1",
 				"eslint": "^9.39.4",
 				"globals": "^17.4.0",
-				"markdownlint-cli": "^0.49.0",
+				"markdownlint-cli2": "^0.23.0",
 				"neostandard": "^0.13.0",
 				"rtlcss": "^4.3.0",
 				"stylelint": "^17.14.0",
@@ -1286,16 +1286,6 @@
 			"integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==",
 			"dev": true
 		},
-		"node_modules/commander": {
-			"version": "15.0.0",
-			"resolved": "https://registry.npmjs.org/commander/-/commander-15.0.0.tgz",
-			"integrity": "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==",
-			"dev": true,
-			"license": "MIT",
-			"engines": {
-				"node": ">=22.12.0"
-			}
-		},
 		"node_modules/concat-map": {
 			"version": "0.0.1",
 			"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -1460,15 +1450,6 @@
 				"url": "https://github.com/sponsors/wooorm"
 			}
 		},
-		"node_modules/deep-extend": {
-			"version": "0.6.0",
-			"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
-			"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
-			"dev": true,
-			"engines": {
-				"node": ">=4.0.0"
-			}
-		},
 		"node_modules/deep-is": {
 			"version": "0.1.4",
 			"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
@@ -2684,15 +2665,6 @@
 				"node": ">=0.8.19"
 			}
 		},
-		"node_modules/ini": {
-			"version": "4.1.3",
-			"resolved": "https://registry.npmjs.org/ini/-/ini-4.1.3.tgz",
-			"integrity": "sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg==",
-			"dev": true,
-			"engines": {
-				"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
-			}
-		},
 		"node_modules/internal-slot": {
 			"version": "1.1.0",
 			"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz",
@@ -3439,76 +3411,80 @@
 				"url": "https://github.com/sponsors/DavidAnson"
 			}
 		},
-		"node_modules/markdownlint-cli": {
-			"version": "0.49.0",
-			"resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.49.0.tgz",
-			"integrity": "sha512-vS5tWq5W91Gg33LD4pyAaXPclnz/sRvo6/RGOyDQjQ3eds2DkK6H4szUuE0M9TiRB/u/VBx1gtd9Ktrtx5WlSA==",
+		"node_modules/markdownlint-cli2": {
+			"version": "0.23.0",
+			"resolved": "https://registry.npmjs.org/markdownlint-cli2/-/markdownlint-cli2-0.23.0.tgz",
+			"integrity": "sha512-1nmgQmU/ZTMRVwYCDs7i1HI3zfBISnT2NNRv+9V01oOLZbAtqL+a7tldpPhBWBVBten3FqhMCGV6EUh9McqutQ==",
 			"dev": true,
 			"license": "MIT",
 			"dependencies": {
-				"commander": "~15.0.0",
-				"deep-extend": "~0.6.0",
-				"ignore": "~7.0.5",
-				"js-yaml": "~4.2.0",
-				"jsonc-parser": "~3.3.1",
-				"jsonpointer": "~5.0.1",
-				"markdown-it": "~14.2.0",
-				"markdownlint": "~0.41.0",
-				"minimatch": "~10.2.5",
-				"run-con": "~1.3.2",
-				"smol-toml": "~1.6.1",
-				"tinyglobby": "~0.2.17"
+				"globby": "16.2.0",
+				"js-yaml": "5.2.0",
+				"jsonc-parser": "3.3.1",
+				"jsonpointer": "5.0.1",
+				"markdown-it": "14.2.0",
+				"markdownlint": "0.41.0",
+				"markdownlint-cli2-formatter-default": "0.0.6",
+				"micromatch": "4.0.8",
+				"smol-toml": "1.7.0"
 			},
 			"bin": {
-				"markdownlint": "markdownlint.js"
+				"markdownlint-cli2": "markdownlint-cli2-bin.mjs"
 			},
 			"engines": {
 				"node": ">=22"
+			},
+			"funding": {
+				"url": "https://github.com/sponsors/DavidAnson"
 			}
 		},
-		"node_modules/markdownlint-cli/node_modules/balanced-match": {
-			"version": "4.0.4",
-			"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
-			"integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
+		"node_modules/markdownlint-cli2-formatter-default": {
+			"version": "0.0.6",
+			"resolved": "https://registry.npmjs.org/markdownlint-cli2-formatter-default/-/markdownlint-cli2-formatter-default-0.0.6.tgz",
+			"integrity": "sha512-VVDGKsq9sgzu378swJ0fcHfSicUnMxnL8gnLm/Q4J/xsNJ4e5bA6lvAz7PCzIl0/No0lHyaWdqVD2jotxOSFMQ==",
 			"dev": true,
-			"engines": {
-				"node": "18 || 20 || >=22"
+			"license": "MIT",
+			"funding": {
+				"url": "https://github.com/sponsors/DavidAnson"
+			},
+			"peerDependencies": {
+				"markdownlint-cli2": ">=0.0.4"
 			}
 		},
-		"node_modules/markdownlint-cli/node_modules/brace-expansion": {
-			"version": "5.0.5",
-			"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz",
-			"integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==",
+		"node_modules/markdownlint-cli2/node_modules/js-yaml": {
+			"version": "5.2.0",
+			"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.0.tgz",
+			"integrity": "sha512-YeLUMlvR4Ou1B119LIaM0r65JvbOBooJDc9yEu0dClb/uSC5P4FrLU8OCCz/HXWvtPoIrR0dRzABTjo1sTN9Bw==",
 			"dev": true,
+			"funding": [
+				{
+					"type": "github",
+					"url": "https://github.com/sponsors/puzrin"
+				},
+				{
+					"type": "github",
+					"url": "https://github.com/sponsors/nodeca"
+				}
+			],
+			"license": "MIT",
 			"dependencies": {
-				"balanced-match": "^4.0.2"
+				"argparse": "^2.0.1"
 			},
-			"engines": {
-				"node": "18 || 20 || >=22"
-			}
-		},
-		"node_modules/markdownlint-cli/node_modules/ignore": {
-			"version": "7.0.5",
-			"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",
-			"integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",
-			"dev": true,
-			"engines": {
-				"node": ">= 4"
+			"bin": {
+				"js-yaml": "bin/js-yaml.mjs"
 			}
 		},
-		"node_modules/markdownlint-cli/node_modules/minimatch": {
-			"version": "10.2.5",
-			"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
-			"integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
+		"node_modules/markdownlint-cli2/node_modules/smol-toml": {
+			"version": "1.7.0",
+			"resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.7.0.tgz",
+			"integrity": "sha512-aqVvWoyO21L23mb+drl4RmMXbf6N7FdHjAhTRA9ZBL7apWBgfWC16KjrASI+1p9GAroljyMHj6fK67i0UiTNvQ==",
 			"dev": true,
-			"dependencies": {
-				"brace-expansion": "^5.0.5"
-			},
+			"license": "BSD-3-Clause",
 			"engines": {
-				"node": "18 || 20 || >=22"
+				"node": ">= 18"
 			},
 			"funding": {
-				"url": "https://github.com/sponsors/isaacs"
+				"url": "https://github.com/sponsors/cyyynthia"
 			}
 		},
 		"node_modules/math-intrinsics": {
@@ -4138,15 +4114,6 @@
 				"node": "*"
 			}
 		},
-		"node_modules/minimist": {
-			"version": "1.2.8",
-			"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
-			"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
-			"dev": true,
-			"funding": {
-				"url": "https://github.com/sponsors/ljharb"
-			}
-		},
 		"node_modules/ms": {
 			"version": "2.1.3",
 			"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@@ -4891,21 +4858,6 @@
 				"node": ">=12.0.0"
 			}
 		},
-		"node_modules/run-con": {
-			"version": "1.3.2",
-			"resolved": "https://registry.npmjs.org/run-con/-/run-con-1.3.2.tgz",
-			"integrity": "sha512-CcfE+mYiTcKEzg0IqS08+efdnH0oJ3zV0wSUFBNrMHMuxCtXvBCLzCJHatwuXDcu/RlhjTziTo/a1ruQik6/Yg==",
-			"dev": true,
-			"dependencies": {
-				"deep-extend": "^0.6.0",
-				"ini": "~4.1.0",
-				"minimist": "^1.2.8",
-				"strip-json-comments": "~3.1.1"
-			},
-			"bin": {
-				"run-con": "cli.js"
-			}
-		},
 		"node_modules/run-parallel": {
 			"version": "1.2.0",
 			"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
@@ -5173,18 +5125,6 @@
 				"url": "https://github.com/chalk/slice-ansi?sponsor=1"
 			}
 		},
-		"node_modules/smol-toml": {
-			"version": "1.6.1",
-			"resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.1.tgz",
-			"integrity": "sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==",
-			"dev": true,
-			"engines": {
-				"node": ">= 18"
-			},
-			"funding": {
-				"url": "https://github.com/sponsors/cyyynthia"
-			}
-		},
 		"node_modules/source-map-js": {
 			"version": "1.2.1",
 			"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",

+ 3 - 3
package.json

@@ -25,8 +25,8 @@
 	"scripts": {
 		"eslint": "eslint .",
 		"eslint_fix": "eslint --fix .",
-		"markdownlint": "markdownlint '**/*.md'",
-		"markdownlint_fix": "markdownlint --fix '**/*.md'",
+		"markdownlint": "markdownlint-cli2",
+		"markdownlint_fix": "markdownlint-cli2 --fix",
 		"rtlcss": "rtlcss -d p/themes/ && find p/themes/ -type f -name '*.rtl.rtl.css' -delete",
 		"stylelint": "stylelint '**/*.css'",
 		"stylelint_fix": "stylelint --fix '**/*.css'",
@@ -37,7 +37,7 @@
 		"eslint": "^9.39.4",
 		"@eslint/js": "^9.39.4",
 		"globals": "^17.4.0",
-		"markdownlint-cli": "^0.49.0",
+		"markdownlint-cli2": "^0.23.0",
 		"neostandard": "^0.13.0",
 		"rtlcss": "^4.3.0",
 		"stylelint": "^17.14.0",