diff --git a/files/zh-cn/.markdownlint-cli2.jsonc b/files/zh-cn/.markdownlint-cli2.jsonc new file mode 100644 index 00000000000000..d11ddf2aa42af9 --- /dev/null +++ b/files/zh-cn/.markdownlint-cli2.jsonc @@ -0,0 +1,73 @@ +{ + "config": { + "extends": "../../.markdownlint-cli2.jsonc", + "search-replace": { + "rules": [ + { + "name": "nbsp", + "message": "Don't use no-break spaces", + "searchPattern": "/ /g", + "replace": " ", + "searchScope": "all" + }, + // XXX Many instances still found in translated content + // { + // "name": "m-dash", + // "message": "Don't use '--'. Use m-dash — instead", + // "search": " -- ", + // "replace": "——", + // "searchScope": "text" + // }, + // { + // "name": "relative-link", + // "message": "Internal links should start with '/'", + // "searchPattern": "/([\\(\"])(en-US|zh-CN)\\/docs/gi", + // "replace": "$1/$2/docs", + // "searchScope": "text" + // }, + { + "name": "relative-link-path", + "message": "Don't use relative paths", + "search": "](..", + "searchScope": "text" + }, + { + "name": "trailing-spaces", + "message": "Avoid trailing spaces", + "searchPattern": "/ +$/gm", + "replace": "", + "searchScope": "all" + }, + { + "name": "double-spaces", + "message": "Avoid double spaces", + "searchPattern": "/([^\\s>]) ([^\\s|])/g", + "replace": "$1 $2", + "searchScope": "text" + }, + { + "name": "stuck-definition", + "message": "Character is stuck to definition description marker", + "searchPattern": "/- :(\\w)/g", + "replace": "- : $1", + "searchScope": "text" + }, + { + "name": "fqdn-moz-links", + "message": "Don't use developer.mozilla.org for links, except for blog posts", + "searchPattern": "/\\]\\(https:\\/\\/developer.mozilla.org\\/(?!en-US\\/blog\\/)/g", + "replace": "](/", + "searchScope": "text" + } + // XXX Many instances still found in translated content + // { + // "name": "localhost-links", + // "message": "Don't use localhost for links", + // "searchPattern": "/\\]\\(https?:\\/\\/localhost:\\d+\\//g", + // "replace": "](/", + // "searchScope": "text" + // } + ] + } + } +} diff --git a/files/zh-tw/.markdownlint-cli2.jsonc b/files/zh-tw/.markdownlint-cli2.jsonc new file mode 100644 index 00000000000000..12691deb3088d0 --- /dev/null +++ b/files/zh-tw/.markdownlint-cli2.jsonc @@ -0,0 +1,88 @@ +{ + "config": { + "extends": "../../.markdownlint-cli2.jsonc", + "search-replace": { + "rules": [ + // XXX Many instances still found in translated content + // { + // "name": "curly-double-quotes", + // "message": "Don't use curly double quotes", + // "searchPattern": "/“(.*?)”/gm", + // "replace": "「$1」", + // "searchScope": "text" + // }, + // { + // "name": "double-quotes", + // "message": "Don't use double quotes", + // "searchPattern": "/‘(.*?)’/g", + // "replace": "『$1』", + // "searchScope": "text" + // }, + { + "name": "nbsp", + "message": "Don't use no-break spaces", + "searchPattern": "/ /g", + "replace": " ", + "searchScope": "all" + }, + // XXX Many instances still found in translated content + // { + // "name": "m-dash", + // "message": "Don't use '--'. Use m-dash — instead", + // "search": " -- ", + // "replace": "——", + // "searchScope": "text" + // }, + // { + // "name": "relative-link", + // "message": "Internal links should start with '/'", + // "searchPattern": "/([\\(\"])(en-US|zh-TW)\\/docs/gi", + // "replace": "$1/$2/docs", + // "searchScope": "text" + //}, + { + "name": "relative-link-path", + "message": "Don't use relative paths", + "search": "](..", + "searchScope": "text" + }, + { + "name": "trailing-spaces", + "message": "Avoid trailing spaces", + "searchPattern": "/ +$/gm", + "replace": "", + "searchScope": "all" + }, + { + "name": "double-spaces", + "message": "Avoid double spaces", + "searchPattern": "/([^\\s>]) ([^\\s|])/g", + "replace": "$1 $2", + "searchScope": "text" + }, + { + "name": "stuck-definition", + "message": "Character is stuck to definition description marker", + "searchPattern": "/- :(\\w)/g", + "replace": "- : $1", + "searchScope": "text" + }, + { + "name": "fqdn-moz-links", + "message": "Don't use developer.mozilla.org for links, except for blog posts", + "searchPattern": "/\\]\\(https:\\/\\/developer.mozilla.org\\/(?!en-US\\/blog\\/)/g", + "replace": "](/", + "searchScope": "text" + } + // XXX Many instances still found in translated content + // { + // "name": "localhost-links", + // "message": "Don't use localhost for links", + // "searchPattern": "/\\]\\(https?:\\/\\/localhost:\\d+\\//g", + // "replace": "](/", + // "searchScope": "text" + // } + ] + } + } +} diff --git a/package.json b/package.json index 352b7c23c5b965..1b70f76f3a94fc 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,10 @@ }, "type": "module", "scripts": { - "fix:json": "prettier -w \"**/*.json\"", + "fix:json": "prettier -w \"**/*.json(c)?\"", "fix:md": "markdownlint-cli2 --fix \"**/*.md\" && prettier -w \"**/*.md\"", "fix:yml": "prettier -w \"**/*.yml\"", - "lint:json": "prettier -c \"**/*.json\"", + "lint:json": "prettier -c \"**/*.json(c)?\"", "lint:md": "markdownlint-cli2 \"**/*.md\" && prettier -c \"**/*.md\"", "lint:yml": "prettier -c \"**/*.yml\"", "prepare": "husky install"