chore: switch to pre-commit

This commit is contained in:
Junyan Qin
2025-05-10 17:14:09 +08:00
parent 7b284591bd
commit c52236e8a9
5 changed files with 33 additions and 13 deletions

View File

@@ -1,9 +1,27 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.11.7
hooks:
# Run the linter of backend.
- id: ruff
# Run the formatter of backend.
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.11.7
hooks:
# Run the linter of backend.
- id: ruff
args: [--fix]
# Run the formatter of backend.
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
types_or: [javascript, jsx, ts, tsx, json, css, scss, yaml]
additional_dependencies:
- prettier@3.1.0
- repo: local
hooks:
- id: lint-staged
name: lint-staged
entry: cd web && pnpm lint-staged
language: system
types: [javascript, jsx, ts, tsx]
pass_filenames: false

View File

@@ -25,7 +25,6 @@ stage_order = [
async def make_app(loop: asyncio.AbstractEventLoop) -> app.Application:
# 确定是否为调试模式
if 'DEBUG' in os.environ and os.environ['DEBUG'] in ['true', '1']:
constants.debug_mode = True

View File

@@ -1,2 +0,0 @@
cd web
pnpm lint-staged

View File

@@ -7,9 +7,14 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"prepare": "cd .. && husky web/.husky",
"lint-staged": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"next lint --fix",
"prettier --write"
]
},
"dependencies": {
"@hookform/resolvers": "^5.0.1",
"@radix-ui/react-checkbox": "^1.3.1",
@@ -49,7 +54,6 @@
"eslint-config-next": "15.2.4",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-prettier": "^5.2.6",
"husky": "^9.1.7",
"lint-staged": "^15.5.1",
"prettier": "^3.5.3",
"tw-animate-css": "^1.2.9",

View File

@@ -44,6 +44,7 @@ export default function PluginConfigPage() {
const taskId = resp.task_id;
let alreadySuccess = false;
console.log('taskId:', taskId);
// 每秒拉取一次任务状态
const interval = setInterval(() => {