Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
65 changes: 65 additions & 0 deletions .github/workflows/format-check.yml
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

Copy link
Copy Markdown

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 runs yarn lint:fix and 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 lint step to the PR workflow, or remove yarn lint:fix from the post-merge formatter if lint is intentionally outside this check.

Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
# AUTO-MAS: A Multi-Script, Multi-Config Management and Automation Software
# Copyright © 2025-2026 AUTO-MAS Team

name: Scheduled formatting
name: Format Fix

on:
schedule:
# GitHub Actions 使用 UTC,此处对应北京时间每周一 03:00。
# 避开 0 点的 github runner 高峰时段。
- cron: '0 19 * * 1'
workflow_dispatch:
pull_request_target:
types: [closed]
branches:
- dev

permissions:
contents: write

concurrency:
group: weekly-format-dev
group: format-fix-dev
cancel-in-progress: false

jobs:
format:
fix:
name: 格式化代码
if: >-
github.repository == 'AUTO-MAS-Project/AUTO-MAS' &&
(github.event_name == 'schedule' || github.ref == 'refs/heads/dev')
github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -64,6 +63,10 @@ jobs:
working-directory: frontend
run: yarn format

- name: 修复前端 Markdown Lint
working-directory: frontend
run: yarn lint:md:fix

- name: 提交格式化结果
run: |
git add --update
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ list/

# IDE and editors
.idea/
.vscode/
.vscode
*.swp
*.swo
.DS_Store
Expand Down Expand Up @@ -77,4 +77,4 @@ list/
res/docs/ok-series-common-script-report.md

# 强制加入的测试源产生的字节码不纳入版本库
tests/**/__pycache__/
tests/**/__pycache__/
14 changes: 14 additions & 0 deletions frontend/.markdownlint-cli2.jsonc
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/**"],
}
13 changes: 13 additions & 0 deletions frontend/.oxfmtrc.json
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"]
}
78 changes: 78 additions & 0 deletions frontend/.oxlintrc.json
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"
]
}
4 changes: 0 additions & 4 deletions frontend/.prettierignore

This file was deleted.

10 changes: 0 additions & 10 deletions frontend/.prettierrc

This file was deleted.

4 changes: 0 additions & 4 deletions frontend/.vscode/extensions.json

This file was deleted.

18 changes: 0 additions & 18 deletions frontend/.vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ yarn build
- **桌面端**: Electron
- **包管理**: Yarn

eslint + Prettier 代码规范相关
oxlint + oxfmt 代码规范相关

```bash
yarn lint # 查看问题
yarn lint:fix # 自动修复
yarn format # 仅 Prettier 全量改格式(非必须)
yarn format # 仅 oxfmt 全量改格式(非必须)
yarn typecheck # 检查 Vue renderer 类型
```
Loading
Loading