From 31e0a61fe4a535a65407f3779438bce6044ce58b Mon Sep 17 00:00:00 2001 From: yaozm Date: Tue, 30 Apr 2024 20:34:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0lint=E4=B8=8Ezhlint=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 19 +++++++++++++++++++ .github/workflows/lint-md.yml | 20 ++++++++------------ .lintmdrc | 28 ++++++++++++++++++++++------ .zhlintignore | 6 ++++++ .zhlintrc | 7 +++++++ 5 files changed, 62 insertions(+), 18 deletions(-) create mode 100644 .editorconfig create mode 100644 .zhlintignore create mode 100644 .zhlintrc diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..e74e04ca --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = false + +[*.{vue,js,scss}] +indent_size = 2 +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml,xml,xml.dist}] +indent_size = 2 \ No newline at end of file diff --git a/.github/workflows/lint-md.yml b/.github/workflows/lint-md.yml index 815a32a5..d1079628 100644 --- a/.github/workflows/lint-md.yml +++ b/.github/workflows/lint-md.yml @@ -12,18 +12,14 @@ jobs: - name: Set node version uses: actions/setup-node@v4 - - name: Install dependencies - run: npm install + - name: Install lint-md + run: npm install @lint-md/cli -g - - name: Lint markdown - run: npm run md-fix + - name: Install zhlint + run: npm install zhlint -g - - name: Lint zh_CN - run: npm run zh-fix + - name: Lint markdown + run: lint-md 'README.md' --config=.lintmdrc --threads - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_options: '--no-verify' - commit_message: Fix markdown - file_pattern: '*.md */*.md */*/*.md' +# - name: Lint zh_CN +# run: zhlint 'README.md' --config=.zhlintrc diff --git a/.lintmdrc b/.lintmdrc index b82ea520..a16c496b 100644 --- a/.lintmdrc +++ b/.lintmdrc @@ -1,19 +1,35 @@ { "excludeFiles": [ - "src/", - "tests/", - "vendor/" + "./.build/**", + "./.github/**", + "./node_modules/**", + "./vendor/**", + "./vendor-bin/**" ], "rules": { - "no-empty-code": 1, + "space-around-alphabet": 2, + "space-around-number": 2, + "no-empty-code-lang": 2, + "no-empty-url": 2, + "no-empty-list": 2, + "no-empty-code": 2, + "no-empty-inline-code": 2, + "no-empty-blockquote": 2, + "no-special-characters": 2, + "use-standard-ellipsis": 2, + "no-fullwidth-number": 2, + "no-space-in-link": 2, + "no-multiple-space-blockquote": 2, + "correct-title-trailing-punctuation": 2, + "no-space-in-inline-code": 2, "no-long-code": [ 2, { - "length": 256, + "length": 120, "exclude": [ "dot" ] } ] } -} \ No newline at end of file +} diff --git a/.zhlintignore b/.zhlintignore new file mode 100644 index 00000000..371abdc5 --- /dev/null +++ b/.zhlintignore @@ -0,0 +1,6 @@ +/.build +/.github +/node_modules +/vendor +/vendor-bin +/传说部分/地方传说/鸠龙岗的来历.md \ No newline at end of file diff --git a/.zhlintrc b/.zhlintrc new file mode 100644 index 00000000..9db6bc57 --- /dev/null +++ b/.zhlintrc @@ -0,0 +1,7 @@ +{ + "preset": "default", + "rules": { + "noSinglePair": false, + "noSpaceBetweenFullwidthContent": false + } +}