Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autocorrect-node and configure that run lint before git commit. #14773

Merged
merged 17 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .autocorrectignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
files/
docs/
huacnlee marked this conversation as resolved.
Show resolved Hide resolved
!files/zh-cn/
!docs/zh-cn/
_wikihistory.json
44 changes: 0 additions & 44 deletions .github/workflows/autocorrect-lint.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/markdown-lint-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
run: |
yarn markdownlint-cli2 --fix "**/${{ matrix.lang }}/**/*.md"
node ./scripts/check-url-locale.js --fix "files/${{ matrix.lang }}"
ls -d 2>/dev/null "files/${{ matrix.lang }}" "docs/${{ matrix.lang }}" | xargs yarn autocorrect --fix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ls -d to filter out non-existed dirs

yarn prettier -w "**/${{ matrix.lang }}/**/*.md"
cd ${{ github.workspace }}/mdn/content && yarn fix:fm --config-file ${{ github.workspace }}/front-matter-config.json "${{ github.workspace }}/files/${{ matrix.lang }}"

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pr-check-lint_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ jobs:
echo "Running url locale checker"
node ./scripts/check-url-locale.js --fix ${files_to_lint}

echo "Running autocorrect"
yarn autocorrect --fix ${files_to_lint}

echo "Running Prettier"
yarn prettier -w ${files_to_lint}

Expand Down
1 change: 1 addition & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"*.md": [
"markdownlint-cli2 --fix",
"node ./scripts/check-url-locale.js --fix",
"autocorrect --fix",
"prettier --write"
]
}
2 changes: 1 addition & 1 deletion files/zh-cn/glossary/accent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ slug: Glossary/Accent

**强调色**(accent)通常为一种明亮的颜色,与颜色方案中更实用的背景和前景色形成对比。这些颜色存在于很多平台(但不是所有平台)的视觉样式中。

web 上,强调色有时用于 {{HTMLElement("input")}} 元素中控件的活跃部分,例如勾选的[复选框](/zh-CN/docs/Web/HTML/Element/input/checkbox)的背景。
Web 上,强调色有时用于 {{HTMLElement("input")}} 元素中控件的活跃部分,例如勾选的[复选框](/zh-CN/docs/Web/HTML/Element/input/checkbox)的背景。

## 参见

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
"type": "module",
"scripts": {
"fix:json": "prettier -w \"**/*.json(c)?\"",
"fix:md": "markdownlint-cli2 --fix \"**/*.md\" && node ./scripts/check-url-locale.js --fix files && prettier -w \"**/*.md\"",
"fix:md": "markdownlint-cli2 --fix \"**/*.md\" && node ./scripts/check-url-locale.js --fix files && yarn autocorrect --fix files docs && prettier -w \"**/*.md\"",
huacnlee marked this conversation as resolved.
Show resolved Hide resolved
"fix:yml": "prettier -w \"**/*.yml\"",
"lint:json": "prettier -c \"**/*.json(c)?\"",
"lint:md": "markdownlint-cli2 \"**/*.md\" && node ./scripts/check-url-locale.js files && prettier -c \"**/*.md\"",
"lint:md": "markdownlint-cli2 \"**/*.md\" && node ./scripts/check-url-locale.js files && yarn autocorrect --lint files docs && prettier -c \"**/*.md\"",
huacnlee marked this conversation as resolved.
Show resolved Hide resolved
"lint:yml": "prettier -c \"**/*.yml\"",
"prepare": "husky install"
},
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"autocorrect-node": "^2.8.4",
"cld": "^2.9.0",
"fdir": "^6.1.0",
"front-matter": "^4.0.2",
Expand Down
41 changes: 41 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,47 @@ argparse@^2.0.1:
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==

astral-regex@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==

[email protected]:
version "2.8.4"
resolved "https://registry.yarnpkg.com/autocorrect-node-darwin-arm64/-/autocorrect-node-darwin-arm64-2.8.4.tgz#b763bdd67a361149eae5802d89bf3454fa34cc65"
integrity sha512-eJFsrZZZUJVPTbdA6hAmVUbTBaznIfkIwstcfn02CXLVKq15j00CXkNytQIdmKpBraTmxjub9kQvYY0Nz2h4DQ==

[email protected]:
version "2.8.4"
resolved "https://registry.yarnpkg.com/autocorrect-node-darwin-x64/-/autocorrect-node-darwin-x64-2.8.4.tgz#d5102b555d08f02ed1f9db1c0882d91d4b829c4b"
integrity sha512-3QheEz2VgZnJcId7zgzbyC88CSmyHg+F93Bw5wsf7dTSwhVdnXeIIlYtXzFabp+c2aCi9lRAQkHFC9Om1CYkuQ==

[email protected]:
version "2.8.4"
resolved "https://registry.yarnpkg.com/autocorrect-node-linux-x64-gnu/-/autocorrect-node-linux-x64-gnu-2.8.4.tgz#5706ef15f099da62897d350e8c14c5ac4a00650c"
integrity sha512-0nR3VnxpfU6HINQiZjC2cz1YVxOTCn529VPqHsWz2H03BPbS9YskGzbRpujnLvwLCyyDlYXJJneFYD1G+9VPaA==

[email protected]:
version "2.8.4"
resolved "https://registry.yarnpkg.com/autocorrect-node-linux-x64-musl/-/autocorrect-node-linux-x64-musl-2.8.4.tgz#8f6df5d6f829028b469f95d9fba4abe899bb852c"
integrity sha512-2LtKtaN6YWUnDtBpo2w5c7FSulozbt2kv9UigrckCX8M/AOVw0MA6uB5snglmKMx1f7fYC06/V4A7Ny1weUOGA==

[email protected]:
version "2.8.4"
resolved "https://registry.yarnpkg.com/autocorrect-node-win32-x64-msvc/-/autocorrect-node-win32-x64-msvc-2.8.4.tgz#968b805b88e3a43a03e012738730b09d7541bec7"
integrity sha512-ExcoBqRjEVnK9n2AVy/dmkiUSnvs5P/VdzI909bCjej1XgOpXonsZ4vGPEPicRfiHb8dc7whl6sh5P/TunDB7A==

autocorrect-node@^2.8.4:
version "2.8.4"
resolved "https://registry.yarnpkg.com/autocorrect-node/-/autocorrect-node-2.8.4.tgz#e94e38b7a333257ff6b627d7ede31209504098a2"
integrity sha512-65DUHJhIUwAlEtyDjYxE94sTT2anQtGXrPB7W9fdrk/Bm7ro4b7mjxQAP14lQlISXXtbNEJO1WABMqNpNbTjxQ==
optionalDependencies:
autocorrect-node-darwin-arm64 "2.8.4"
autocorrect-node-darwin-x64 "2.8.4"
autocorrect-node-linux-x64-gnu "2.8.4"
autocorrect-node-linux-x64-musl "2.8.4"
autocorrect-node-win32-x64-msvc "2.8.4"

balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
Expand Down
Loading