feat: add markdown plugin

This commit is contained in:
Anthony Fu 2022-03-07 16:47:31 +08:00
parent 1ccdd44162
commit 48a0d78824
4 changed files with 131 additions and 9 deletions

View File

@ -6,7 +6,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",
"lint": "npx eslint --ext .js,.json,.vue --fix .", "lint": "npx eslint --ext .js,.json,.vue,.md .",
"release": "lerna publish --conventional-commits" "release": "lerna publish --conventional-commits"
}, },
"devDependencies": { "devDependencies": {

View File

@ -10,6 +10,16 @@ module.exports = {
'plugin:eslint-comments/recommended', 'plugin:eslint-comments/recommended',
'plugin:jsonc/recommended-with-jsonc', 'plugin:jsonc/recommended-with-jsonc',
'plugin:yml/standard', 'plugin:yml/standard',
'plugin:markdown/recommended',
],
ignorePatterns: [
'.cache',
'*.min.*',
'CHANGELOG.md',
'dist',
'LICENSE.*',
'public',
'temp',
], ],
plugins: [ plugins: [
'html', 'html',
@ -88,7 +98,7 @@ module.exports = {
}, },
}, },
{ {
files: ['scripts/**/*.*'], files: ['scripts/**/*.*', 'cli.*'],
rules: { rules: {
'no-console': 'off', 'no-console': 'off',
}, },
@ -99,6 +109,20 @@ module.exports = {
'no-unused-expressions': 'off', 'no-unused-expressions': 'off',
}, },
}, },
{
files: ['*.md'],
parser: 'markdown-eslint-parser',
},
{
// Code blocks in markdown file
files: ['**/*.md/*.*'],
rules: {
'no-unused-vars': 'off',
'no-undef': 'off',
'no-unused-expressions': 'off',
'import/no-unresolved': 'off',
},
},
], ],
rules: { rules: {
// import // import

View File

@ -21,6 +21,7 @@
"eslint-plugin-html": "^6.2.0", "eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.25.4", "eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsonc": "^2.2.1", "eslint-plugin-jsonc": "^2.2.1",
"eslint-plugin-markdown": "^2.2.1",
"eslint-plugin-n": "^15.0.1", "eslint-plugin-n": "^15.0.1",
"eslint-plugin-promise": "^6.0.0", "eslint-plugin-promise": "^6.0.0",
"eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-unicorn": "^41.0.0",

View File

@ -16,8 +16,8 @@ importers:
packages/all: packages/all:
specifiers: specifiers:
'@antfu/eslint-config-react': ^0.16.1 '@antfu/eslint-config-react': ^0.17.0
'@antfu/eslint-config-vue': ^0.16.1 '@antfu/eslint-config-vue': ^0.17.0
'@typescript-eslint/eslint-plugin': ^5.13.0 '@typescript-eslint/eslint-plugin': ^5.13.0
'@typescript-eslint/parser': ^5.13.0 '@typescript-eslint/parser': ^5.13.0
eslint: ^8.10.0 eslint: ^8.10.0
@ -61,6 +61,7 @@ importers:
eslint-plugin-html: ^6.2.0 eslint-plugin-html: ^6.2.0
eslint-plugin-import: ^2.25.4 eslint-plugin-import: ^2.25.4
eslint-plugin-jsonc: ^2.2.1 eslint-plugin-jsonc: ^2.2.1
eslint-plugin-markdown: ^2.2.1
eslint-plugin-n: ^15.0.1 eslint-plugin-n: ^15.0.1
eslint-plugin-promise: ^6.0.0 eslint-plugin-promise: ^6.0.0
eslint-plugin-unicorn: ^41.0.0 eslint-plugin-unicorn: ^41.0.0
@ -73,6 +74,7 @@ importers:
eslint-plugin-html: 6.2.0 eslint-plugin-html: 6.2.0
eslint-plugin-import: 2.25.4_eslint@8.10.0 eslint-plugin-import: 2.25.4_eslint@8.10.0
eslint-plugin-jsonc: 2.2.1_eslint@8.10.0 eslint-plugin-jsonc: 2.2.1_eslint@8.10.0
eslint-plugin-markdown: 2.2.1_eslint@8.10.0
eslint-plugin-n: 15.0.1_eslint@8.10.0 eslint-plugin-n: 15.0.1_eslint@8.10.0
eslint-plugin-promise: 6.0.0_eslint@8.10.0 eslint-plugin-promise: 6.0.0_eslint@8.10.0
eslint-plugin-unicorn: 41.0.0_eslint@8.10.0 eslint-plugin-unicorn: 41.0.0_eslint@8.10.0
@ -84,7 +86,7 @@ importers:
packages/react: packages/react:
specifiers: specifiers:
'@antfu/eslint-config-ts': ^0.16.1 '@antfu/eslint-config-ts': ^0.17.0
eslint: ^8.10.0 eslint: ^8.10.0
eslint-plugin-react: ^7.29.3 eslint-plugin-react: ^7.29.3
react: ^17.0.2 react: ^17.0.2
@ -99,7 +101,7 @@ importers:
packages/typescript: packages/typescript:
specifiers: specifiers:
'@antfu/eslint-config-basic': ^0.16.1 '@antfu/eslint-config-basic': ^0.17.0
'@typescript-eslint/eslint-plugin': ^5.13.0 '@typescript-eslint/eslint-plugin': ^5.13.0
'@typescript-eslint/parser': ^5.13.0 '@typescript-eslint/parser': ^5.13.0
eslint: ^8.10.0 eslint: ^8.10.0
@ -112,7 +114,7 @@ importers:
packages/vue: packages/vue:
specifiers: specifiers:
'@antfu/eslint-config-ts': ^0.16.1 '@antfu/eslint-config-ts': ^0.17.0
eslint: ^8.10.0 eslint: ^8.10.0
eslint-plugin-vue: ^8.5.0 eslint-plugin-vue: ^8.5.0
dependencies: dependencies:
@ -1043,6 +1045,12 @@ packages:
resolution: {integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4=} resolution: {integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4=}
dev: false dev: false
/@types/mdast/3.0.10:
resolution: {integrity: sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA==}
dependencies:
'@types/unist': 2.0.6
dev: false
/@types/minimatch/3.0.3: /@types/minimatch/3.0.3:
resolution: {integrity: sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==} resolution: {integrity: sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==}
dev: true dev: true
@ -1062,6 +1070,10 @@ packages:
resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==}
dev: true dev: true
/@types/unist/2.0.6:
resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==}
dev: false
/@typescript-eslint/eslint-plugin/5.13.0_33fffc354ccfa91fbe7d1677b9395a0a: /@typescript-eslint/eslint-plugin/5.13.0_33fffc354ccfa91fbe7d1677b9395a0a:
resolution: {integrity: sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==} resolution: {integrity: sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@ -1534,6 +1546,18 @@ packages:
supports-color: 7.1.0 supports-color: 7.1.0
dev: true dev: true
/character-entities-legacy/1.1.4:
resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==}
dev: false
/character-entities/1.2.4:
resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==}
dev: false
/character-reference-invalid/1.1.4:
resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==}
dev: false
/chardet/0.7.0: /chardet/0.7.0:
resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==}
dev: true dev: true
@ -2187,6 +2211,18 @@ packages:
natural-compare: 1.4.0 natural-compare: 1.4.0
dev: false dev: false
/eslint-plugin-markdown/2.2.1_eslint@8.10.0:
resolution: {integrity: sha512-FgWp4iyYvTFxPwfbxofTvXxgzPsDuSKHQy2S+a8Ve6savbujey+lgrFFbXQA0HPygISpRYWYBjooPzhYSF81iA==}
engines: {node: ^8.10.0 || ^10.12.0 || >= 12.0.0}
peerDependencies:
eslint: '>=6.0.0'
dependencies:
eslint: 8.10.0
mdast-util-from-markdown: 0.8.5
transitivePeerDependencies:
- supports-color
dev: false
/eslint-plugin-n/15.0.1_eslint@8.10.0: /eslint-plugin-n/15.0.1_eslint@8.10.0:
resolution: {integrity: sha512-w1vgnlS3Y3kd2Ye2YpQvWJppx6ViySIpBIcdlw1dBBaX3m1R/cdKHE3X2PWXhJdH88pmFy1a+04a6lMlo5D9EQ==} resolution: {integrity: sha512-w1vgnlS3Y3kd2Ye2YpQvWJppx6ViySIpBIcdlw1dBBaX3m1R/cdKHE3X2PWXhJdH88pmFy1a+04a6lMlo5D9EQ==}
engines: {node: '>=12.22.0'} engines: {node: '>=12.22.0'}
@ -3042,7 +3078,7 @@ packages:
run-async: 2.4.1 run-async: 2.4.1
rxjs: 6.6.0 rxjs: 6.6.0
string-width: 4.2.2 string-width: 4.2.2
strip-ansi: 6.0.0 strip-ansi: 6.0.1
through: 2.3.8 through: 2.3.8
dev: true dev: true
@ -3064,6 +3100,17 @@ packages:
resolution: {integrity: sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=} resolution: {integrity: sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=}
dev: true dev: true
/is-alphabetical/1.0.4:
resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==}
dev: false
/is-alphanumerical/1.0.4:
resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==}
dependencies:
is-alphabetical: 1.0.4
is-decimal: 1.0.4
dev: false
/is-arrayish/0.2.1: /is-arrayish/0.2.1:
resolution: {integrity: sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=} resolution: {integrity: sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=}
@ -3116,6 +3163,10 @@ packages:
resolution: {integrity: sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==} resolution: {integrity: sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
/is-decimal/1.0.4:
resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==}
dev: false
/is-extglob/2.1.1: /is-extglob/2.1.1:
resolution: {integrity: sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=} resolution: {integrity: sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -3155,6 +3206,10 @@ packages:
dependencies: dependencies:
is-extglob: 2.1.1 is-extglob: 2.1.1
/is-hexadecimal/1.0.4:
resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==}
dev: false
/is-lambda/1.0.1: /is-lambda/1.0.1:
resolution: {integrity: sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=} resolution: {integrity: sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=}
dev: true dev: true
@ -3575,6 +3630,22 @@ packages:
engines: {node: '>=8'} engines: {node: '>=8'}
dev: true dev: true
/mdast-util-from-markdown/0.8.5:
resolution: {integrity: sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==}
dependencies:
'@types/mdast': 3.0.10
mdast-util-to-string: 2.0.0
micromark: 2.11.4
parse-entities: 2.0.0
unist-util-stringify-position: 2.0.3
transitivePeerDependencies:
- supports-color
dev: false
/mdast-util-to-string/2.0.0:
resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==}
dev: false
/meow/3.7.0: /meow/3.7.0:
resolution: {integrity: sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=} resolution: {integrity: sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -3616,6 +3687,15 @@ packages:
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
/micromark/2.11.4:
resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==}
dependencies:
debug: 4.3.2
parse-entities: 2.0.0
transitivePeerDependencies:
- supports-color
dev: false
/micromatch/4.0.2: /micromatch/4.0.2:
resolution: {integrity: sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==} resolution: {integrity: sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -4207,6 +4287,17 @@ packages:
callsites: 3.1.0 callsites: 3.1.0
dev: true dev: true
/parse-entities/2.0.0:
resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==}
dependencies:
character-entities: 1.2.4
character-entities-legacy: 1.1.4
character-reference-invalid: 1.1.4
is-alphanumerical: 1.0.4
is-decimal: 1.0.4
is-hexadecimal: 1.0.4
dev: false
/parse-github-repo-url/1.4.1: /parse-github-repo-url/1.4.1:
resolution: {integrity: sha1-nn2LslKmy2ukJZUGC3v23z28H1A=} resolution: {integrity: sha1-nn2LslKmy2ukJZUGC3v23z28H1A=}
dev: true dev: true
@ -4933,7 +5024,7 @@ packages:
dependencies: dependencies:
emoji-regex: 8.0.0 emoji-regex: 8.0.0
is-fullwidth-code-point: 3.0.0 is-fullwidth-code-point: 3.0.0
strip-ansi: 6.0.0 strip-ansi: 6.0.1
dev: true dev: true
/string.prototype.matchall/4.0.6: /string.prototype.matchall/4.0.6:
@ -5310,6 +5401,12 @@ packages:
imurmurhash: 0.1.4 imurmurhash: 0.1.4
dev: true dev: true
/unist-util-stringify-position/2.0.3:
resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==}
dependencies:
'@types/unist': 2.0.6
dev: false
/universal-user-agent/6.0.0: /universal-user-agent/6.0.0:
resolution: {integrity: sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==} resolution: {integrity: sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==}
dev: true dev: true