-
Notifications
You must be signed in to change notification settings - Fork 48
ci: PR 阶段格式检查并在合并后修复 #515
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
Draft
Craun718
wants to merge
6
commits into
AUTO-MAS-Project:dev
Choose a base branch
from
Craun718:patch-fmt
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
ci: PR 阶段格式检查并在合并后修复 #515
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d6d9bf0
release: v5.4.0 (#422)
DLmaster361 5640abd
docs: 修正格式化ci的注释
Craun718 4b555cc
chore(frontend): 替换 ESLint 与 Prettier 为 oxlint 与 oxfmt
Craun718 08dbdc3
ci: PR 阶段格式检查并在合并后修复
Craun718 0ab8e86
ci: PR 阶段加入前端 lint 检查
Craun718 82cebad
ci: 仅检查进入 dev 的 PR
Craun718 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # AUTO-MAS: A Multi-Script, Multi-Config Management and Automation Software | ||
| # Copyright © 2025-2026 AUTO-MAS Team | ||
|
|
||
| name: Format Check | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - reopened | ||
| branches: | ||
| - dev | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: format-check-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| check: | ||
| name: 格式检查 | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: 检出代码 | ||
| uses: actions/checkout@v7.0.1 | ||
|
|
||
| - name: 设置 Python 环境 | ||
| uses: actions/setup-python@v7.0.0 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: 检查 Python 格式 | ||
| run: | | ||
| python -m pip install ruff==0.15.14 | ||
| ruff format --check . | ||
|
|
||
| - name: 设置 Node.js 环境 | ||
| uses: actions/setup-node@v7.0.0 | ||
| with: | ||
| node-version: '24' | ||
|
|
||
| - name: 设置 Yarn | ||
| run: | | ||
| corepack enable | ||
| corepack prepare yarn@4.9.1 --activate | ||
|
|
||
| - name: 安装前端依赖 | ||
| working-directory: frontend | ||
| run: yarn install --immutable --mode=skip-build | ||
|
|
||
| - name: 检查前端 Lint | ||
| working-directory: frontend | ||
| run: yarn lint | ||
|
|
||
| - name: 检查前端格式 | ||
| working-directory: frontend | ||
| run: yarn oxfmt . --check | ||
|
|
||
| - name: 检查前端 Markdown Lint | ||
| working-directory: frontend | ||
| run: yarn lint:md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "config": { | ||
| "default": true, | ||
| "line-length": false, | ||
| "first-line-h1": false, | ||
| "no-inline-html": false, | ||
| "fenced-code-language": false, | ||
| "no-blanks-blockquote": false, | ||
| "no-emphasis-as-heading": false, | ||
| "no-space-in-code": false, | ||
| "no-trailing-punctuation": false, | ||
| }, | ||
| "ignores": ["node_modules/**", "dist/**", "dist-electron/**", "src/api/**"], | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "$schema": "./node_modules/oxfmt/configuration_schema.json", | ||
| "semi": false, | ||
| "singleQuote": true, | ||
| "printWidth": 100, | ||
| "tabWidth": 2, | ||
| "trailingComma": "es5", | ||
| "bracketSpacing": true, | ||
| "arrowParens": "avoid", | ||
| "endOfLine": "lf", | ||
| "sortPackageJson": false, | ||
| "ignorePatterns": ["dist", "node_modules", "dist-electron", "src/api", "**/*.md"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| { | ||
| "$schema": "./node_modules/oxlint/configuration_schema.json", | ||
| "plugins": ["vue"], | ||
| "env": { | ||
| "browser": true, | ||
| "builtin": true, | ||
| "node": true | ||
| }, | ||
| "categories": { | ||
| "correctness": "error" | ||
| }, | ||
| "rules": { | ||
| "no-caller": "off", | ||
| "no-eval": "off", | ||
| "no-iterator": "off", | ||
| "no-unassigned-vars": "off", | ||
| "no-unused-expressions": "off", | ||
| "no-useless-rename": "off", | ||
| "no-unused-vars": [ | ||
| "warn", | ||
| { | ||
| "argsIgnorePattern": "^_", | ||
| "varsIgnorePattern": "^_" | ||
| } | ||
| ], | ||
| "no-case-declarations": "error", | ||
| "no-empty": "error", | ||
| "no-fallthrough": "error", | ||
| "no-prototype-builtins": "error", | ||
| "no-redeclare": "error", | ||
| "no-regex-spaces": "error", | ||
| "no-undef": "error", | ||
| "no-unexpected-multiline": "error", | ||
| "vue/no-this-in-before-route-enter": "off", | ||
| "vue/component-definition-name-casing": "warn", | ||
| "vue/no-multiple-slot-args": "warn", | ||
| "vue/no-required-prop-with-default": "warn", | ||
| "vue/prop-name-casing": "warn", | ||
| "vue/require-default-prop": "warn", | ||
| "vue/require-prop-types": "warn" | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "files": ["**/*.vue"], | ||
| "globals": { | ||
| "defineEmits": "readonly", | ||
| "defineExpose": "readonly", | ||
| "defineModel": "readonly", | ||
| "defineOptions": "readonly", | ||
| "defineProps": "readonly", | ||
| "withDefaults": "readonly" | ||
| } | ||
| }, | ||
| { | ||
| "files": ["electron/**/*.ts"], | ||
| "rules": { | ||
| "no-undef": "off" | ||
| } | ||
| }, | ||
| { | ||
| "files": ["*.mjs"], | ||
| "rules": { | ||
| "no-unused-vars": "error" | ||
| } | ||
| } | ||
| ], | ||
| "ignorePatterns": [ | ||
| "dist", | ||
| "dist-electron", | ||
| "out", | ||
| "build", | ||
| "node_modules", | ||
| "**/*.d.ts", | ||
| "**/*.js", | ||
| "**/*.md", | ||
| "src/api" | ||
| ] | ||
| } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (broader_impact): PR 工作流从未运行
yarn lint,因此即使合并后的工作流会运行yarn lint:fix并随后重写已合并的代码,oxlint 错误仍然可以通过 PR 检查。触发条件: 当 PR 包含不会影响 Ruff、oxfmt 或 Markdown 检查的 oxlint 错误时。
建议修复: 在 PR 工作流中添加一个只读的
yarn lint步骤;或者,如果 lint 有意不在此次检查范围内,则从合并后的格式化工作流中移除yarn lint:fix。Original comment in English
issue (broader_impact): The PR workflow never runs
yarn lint, so oxlint errors are allowed through PR checks even though the post-merge workflow runsyarn lint:fixand can subsequently rewrite the merged code.Triggers: When a PR contains an oxlint error that does not affect Ruff, oxfmt, or Markdown checks.
Suggested fix: Add a read-only
yarn lintstep to the PR workflow, or removeyarn lint:fixfrom the post-merge formatter if lint is intentionally outside this check.