chore: add mdformat and prettier for yaml#1865
Conversation
Sync pre-commit config from deepmd-kit@69eb0c3bb10be0ace823a5240c9fef6d0bb26c08 Changes: - Add mdformat for markdown formatting - Add mdformat plugins: myst, ruff, web, config, beautysh, gfm-alerts - Add prettier for yaml formatting only Authored by OpenClaw (model: glm-5)
📝 WalkthroughWalkthroughAdds two pre-commit hooks to configuration: mdformat for markdown formatting with additional git-based dependencies, and prettier for YAML file formatting. Both hooks are pinned to specific versions. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.pre-commit-config.yaml:
- Around line 42-61: The YAML has the markdown and yaml hook blocks nested under
the previous repo mapping; move the "- repo: https://github.com/hukkin/mdformat"
and "- repo: https://github.com/pre-commit/mirrors-prettier" entries out to be
top-level list items under the main "repos:" sequence so each "- repo: ..."
starts at the same indentation as other repo entries; ensure their inner "rev:"
and "hooks:" mappings are indented one level under each "- repo" (use 2 spaces
per level) so the mdformat and prettier hooks are valid top-level repo entries.
- Around line 57-61: Update the Prettier hook in the pre-commit config by
changing the mirrors-prettier rev from "v4.0.0-alpha.8" to the stable release
"v3.8.1" for the hook with id "prettier" (the block that currently lists repo:
https://github.com/pre-commit/mirrors-prettier and types_or: [yaml]); this pins
Prettier to the stable version to avoid formatter churn—if you need v4 testing
instead, use a newer v4 alpha (e.g., "v4.0.0-alpha.13") rather than the old
alpha.8.
| # markdown | ||
| - repo: https://github.com/hukkin/mdformat | ||
| rev: 1.0.0 | ||
| hooks: | ||
| - id: mdformat | ||
| additional_dependencies: | ||
| # - mdformat-myst==0.3.0 | ||
| # See https://github.com/executablebooks/mdformat-myst/issues/13 | ||
| - "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst" | ||
| - mdformat-ruff==0.1.3 | ||
| - mdformat-web==0.2.0 | ||
| - mdformat-config==0.2.1 | ||
| - mdformat-beautysh==1.0.0 | ||
| - mdformat-gfm-alerts==2.0.0 | ||
| # yaml | ||
| - repo: https://github.com/pre-commit/mirrors-prettier | ||
| rev: v4.0.0-alpha.8 | ||
| hooks: | ||
| - id: prettier | ||
| types_or: [yaml] |
There was a problem hiding this comment.
Fix YAML indentation so new repos are top‑level list items.
The markdown/yaml hooks are indented under the previous repo mapping, which makes the YAML invalid (matches the YAMLlint error) and will break pre-commit parsing. Align them with the other top‑level repos entries.
✅ Proposed fix
- # markdown
- - repo: https://github.com/hukkin/mdformat
- rev: 1.0.0
- hooks:
- - id: mdformat
- additional_dependencies:
- # - mdformat-myst==0.3.0
- # See https://github.com/executablebooks/mdformat-myst/issues/13
- - "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst"
- - mdformat-ruff==0.1.3
- - mdformat-web==0.2.0
- - mdformat-config==0.2.1
- - mdformat-beautysh==1.0.0
- - mdformat-gfm-alerts==2.0.0
- # yaml
- - repo: https://github.com/pre-commit/mirrors-prettier
- rev: v4.0.0-alpha.8
- hooks:
- - id: prettier
- types_or: [yaml]
+# markdown
+- repo: https://github.com/hukkin/mdformat
+ rev: 1.0.0
+ hooks:
+ - id: mdformat
+ additional_dependencies:
+ # - mdformat-myst==0.3.0
+ # See https://github.com/executablebooks/mdformat-myst/issues/13
+ - "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst"
+ - mdformat-ruff==0.1.3
+ - mdformat-web==0.2.0
+ - mdformat-config==0.2.1
+ - mdformat-beautysh==1.0.0
+ - mdformat-gfm-alerts==2.0.0
+# yaml
+- repo: https://github.com/pre-commit/mirrors-prettier
+ rev: v4.0.0-alpha.8
+ hooks:
+ - id: prettier
+ types_or: [yaml]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # markdown | |
| - repo: https://github.com/hukkin/mdformat | |
| rev: 1.0.0 | |
| hooks: | |
| - id: mdformat | |
| additional_dependencies: | |
| # - mdformat-myst==0.3.0 | |
| # See https://github.com/executablebooks/mdformat-myst/issues/13 | |
| - "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst" | |
| - mdformat-ruff==0.1.3 | |
| - mdformat-web==0.2.0 | |
| - mdformat-config==0.2.1 | |
| - mdformat-beautysh==1.0.0 | |
| - mdformat-gfm-alerts==2.0.0 | |
| # yaml | |
| - repo: https://github.com/pre-commit/mirrors-prettier | |
| rev: v4.0.0-alpha.8 | |
| hooks: | |
| - id: prettier | |
| types_or: [yaml] | |
| # markdown | |
| - repo: https://github.com/hukkin/mdformat | |
| rev: 1.0.0 | |
| hooks: | |
| - id: mdformat | |
| additional_dependencies: | |
| # - mdformat-myst==0.3.0 | |
| # See https://github.com/executablebooks/mdformat-myst/issues/13 | |
| - "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst" | |
| - mdformat-ruff==0.1.3 | |
| - mdformat-web==0.2.0 | |
| - mdformat-config==0.2.1 | |
| - mdformat-beautysh==1.0.0 | |
| - mdformat-gfm-alerts==2.0.0 | |
| # yaml | |
| - repo: https://github.com/pre-commit/mirrors-prettier | |
| rev: v4.0.0-alpha.8 | |
| hooks: | |
| - id: prettier | |
| types_or: [yaml] |
🧰 Tools
🪛 YAMLlint (1.38.0)
[error] 43-43: syntax error: expected , but found ''
(syntax)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.pre-commit-config.yaml around lines 42 - 61, The YAML has the markdown and
yaml hook blocks nested under the previous repo mapping; move the "- repo:
https://github.com/hukkin/mdformat" and "- repo:
https://github.com/pre-commit/mirrors-prettier" entries out to be top-level list
items under the main "repos:" sequence so each "- repo: ..." starts at the same
indentation as other repo entries; ensure their inner "rev:" and "hooks:"
mappings are indented one level under each "- repo" (use 2 spaces per level) so
the mdformat and prettier hooks are valid top-level repo entries.
| - repo: https://github.com/pre-commit/mirrors-prettier | ||
| rev: v4.0.0-alpha.8 | ||
| hooks: | ||
| - id: prettier | ||
| types_or: [yaml] |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# List recent releases to confirm latest stable vs alpha.
gh release list -R pre-commit/mirrors-prettier --limit 10Repository: deepmodeling/dpgen
Length of output: 243
🌐 Web query:
Prettier v4 latest stable release vs v4.0.0-alpha.8
💡 Result:
- Latest stable Prettier (as of Feb 24, 2026): v3.8.1 (published Jan 21, 2026). This is the version you get from the npm
latesttag and is recommended for production use. [1] - Prettier v4.0.0-alpha.8: a prerelease (alpha) from Dec 20, 2023—meant for testing upcoming v4 changes and more likely to have breaking changes/instability than stable releases. [2]
- Context: v4 has continued to ship newer alphas after alpha.8 (e.g., v4.0.0-alpha.13 on Nov 18, 2025), so alpha.8 is also quite old compared to the current v4 prerelease line. [3]
Practical choice: use v3.8.1 unless you specifically need to test v4 behavior; if you do, prefer the latest v4 alpha rather than alpha.8. [1][3]
Sources: [1] Snyk (npm prettier versions list), [2] Libraries.io (prettier version timeline incl. 4.0.0-alpha.8), [3] ReleaseAlert (prettier release timeline incl. 4.0.0-alpha.13).
Pin Prettier to the latest stable release (v3.8.1).
v4.0.0-alpha.8 (Dec 2023) is outdated and unstable. It will cause formatter churn and unpredictable behavior. Use v3.8.1 (the current stable release as of Jan 2026) unless there is a specific requirement to test Prettier v4 features—in which case, use a newer v4 alpha (e.g., v4.0.0-alpha.13) rather than the old alpha.8.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.pre-commit-config.yaml around lines 57 - 61, Update the Prettier hook in
the pre-commit config by changing the mirrors-prettier rev from "v4.0.0-alpha.8"
to the stable release "v3.8.1" for the hook with id "prettier" (the block that
currently lists repo: https://github.com/pre-commit/mirrors-prettier and
types_or: [yaml]); this pins Prettier to the stable version to avoid formatter
churn—if you need v4 testing instead, use a newer v4 alpha (e.g.,
"v4.0.0-alpha.13") rather than the old alpha.8.
|
Recreating from njzjz-bot |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #1865 +/- ##
=======================================
Coverage 49.80% 49.80%
=======================================
Files 83 83
Lines 14988 14988
=======================================
Hits 7465 7465
Misses 7523 7523 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sync pre-commit config from deepmd-kit@69eb0c3bb10be0ace823a5240c9fef6d0bb26c08
Changes:
Authored by OpenClaw (model: glm-5)
Summary by CodeRabbit