From 1eaa80212a208b13e4bb0a1326ed40f6e792eeab Mon Sep 17 00:00:00 2001 From: Joshua Fernandes Date: Wed, 21 Aug 2024 20:35:55 +1000 Subject: [PATCH] adding a md linter to the lint process --- .editorconfig | 2 + .eslintignore | 3 +- .eslintrc.md.js | 20 ++++++++++ package-lock.json | 97 +++++++++++++++++++++++++++++++++++++++++++++-- package.json | 4 +- 5 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 .eslintrc.md.js diff --git a/.editorconfig b/.editorconfig index 28c5cd2..93b9e01 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,5 +12,7 @@ max_line_length = 80 trim_trailing_whitespace = true [*.md] +max_line_length = 80 +indent_style = space insert_final_newline = false trim_trailing_whitespace = false \ No newline at end of file diff --git a/.eslintignore b/.eslintignore index d94fd68..c42cbf4 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,7 +1,6 @@ build/ .eslintrc.js +.eslintrc.md.js docs/test-api ./node_modules/* -*.md -*.mdx LICENSE diff --git a/.eslintrc.md.js b/.eslintrc.md.js new file mode 100644 index 0000000..1be6a6a --- /dev/null +++ b/.eslintrc.md.js @@ -0,0 +1,20 @@ +module.exports = { + extends: [ + "plugin:markdownlint/recommended", + ], + "parser": "eslint-plugin-markdownlint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module", + "ecmaFeatures": { + "jsx": true + }, + }, + rules: { + "markdownlint/md001": "off", + "markdownlint/md003": "warn", + "markdownlint/md025": ["error", { + "level": 2 + }] + } +}; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b957b59..1a96a2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "commitizen": "^4.3.0", "cspell": "^6.31.1", "cz-conventional-changelog": "^3.3.0", + "eslint-plugin-markdownlint": "^0.6.0", "semantic-release": "^21.0.0", "stylelint": "^15.0.0 ", "stylelint-config-standard": "^34.0.0", @@ -5976,9 +5977,9 @@ } }, "node_modules/acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "bin": { "acorn": "bin/acorn" }, @@ -9071,6 +9072,21 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-plugin-markdownlint": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-markdownlint/-/eslint-plugin-markdownlint-0.6.0.tgz", + "integrity": "sha512-idYAzR2k7tQ+zL6UC17I/zzkqM0t6/k50uGgO39tabryqVkJh8Qe57fhBhe7QN+17yqIVqFB9YJFzBCAOdSXjw==", + "dev": true, + "dependencies": { + "markdownlint": "0.34.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": ">=7.5.0" + } + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -12115,6 +12131,15 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dev": true, + "dependencies": { + "uc.micro": "^2.0.0" + } + }, "node_modules/load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -12443,6 +12468,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, "node_modules/markdown-table": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.3.tgz", @@ -12452,6 +12494,34 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/markdownlint": { + "version": "0.34.0", + "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.34.0.tgz", + "integrity": "sha512-qwGyuyKwjkEMOJ10XN6OTKNOVYvOIi35RNvDLNxTof5s8UmyGHlCdpngRHoRGNvQVGuxO3BJ7uNSgdeX166WXw==", + "dev": true, + "dependencies": { + "markdown-it": "14.1.0", + "markdownlint-micromark": "0.1.9" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/DavidAnson" + } + }, + "node_modules/markdownlint-micromark": { + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.9.tgz", + "integrity": "sha512-5hVs/DzAFa8XqYosbEAEg6ok6MF2smDj89ztn9pKkCtdKHVdPQuGMH7frFfYL9mLkvfFe4pTyAMffLbjf3/EyA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/DavidAnson" + } + }, "node_modules/marked": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/marked/-/marked-5.1.2.tgz", @@ -12925,6 +12995,12 @@ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==" }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -19624,6 +19700,15 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==" }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/pupa": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/pupa/-/pupa-3.1.0.tgz", @@ -23548,6 +23633,12 @@ "node": ">=14.17" } }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true + }, "node_modules/uglify-js": { "version": "3.17.4", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", diff --git a/package.json b/package.json index 3ddb81f..3d961a0 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "write-heading-ids": "docusaurus write-heading-ids", "typecheck": "tsc", "typecheck-staged": "tsc-files --noEmit", - "lint": "npm run lint:spelling && npm run lint:js && npm run lint:style", + "lint": "npm run lint:spelling && npm run lint:md && npm run lint:js && npm run lint:style", + "lint:md": "eslint . --config .eslintrc.md.js --ext md,mdx --max-warnings=0", "lint:js": "eslint . --ext js,jsx,ts,tsx --max-warnings=0", "lint:spelling": "cspell \"**\" --no-progress", "lint:style": "stylelint \"**/*.css\"", @@ -61,6 +62,7 @@ "cspell": "^6.31.1", "cz-conventional-changelog": "^3.3.0", "semantic-release": "^21.0.0", + "eslint-plugin-markdownlint": "^0.6.0", "stylelint": "^15.0.0 ", "stylelint-config-standard": "^34.0.0", "tsc-files": "^1.1.4",