From ee01773e64974f2fe45fc94b775dcccb5709f9c3 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Sun, 31 Jul 2022 21:35:30 +0800 Subject: [PATCH] update pre-commit --- .pre-commit-config.yaml | 27 ++++++++++++++++----- admin-frontend/package.json | 2 +- admin-frontend/src/App.tsx | 14 +++++------ src/plugins/nonebot_bison/admin_page/api.py | 22 +++++++++++------ 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 42dc09a..d6ba15a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,12 +20,27 @@ repos: hooks: - id: prettier types_or: [markdown, ts, tsx] + exclude: 'admin-frontend/' - - repo: local + - repo: https://github.com/pre-commit/mirrors-eslint + rev: v8.20.0 hooks: - - id: admin-eslint - name: eslint - entry: bash -c 'yarn --cwd admin-frontend lint || exit 0' - language: system - pass_filenames: false + - id: eslint + additional_dependencies: + - "eslint@8.2.0" + - "@typescript-eslint/eslint-plugin" + - "@typescript-eslint/parser" + - "eslint-config-airbnb" + - "eslint-config-airbnb-typescript" + - "eslint-import-resolver-typescript" + - "eslint-plugin-import" + - "eslint-plugin-jsx-a11y" + - "eslint-plugin-react" + - "eslint-plugin-react-hooks" + - "eslint-plugin-react-redux" + types_or: [ts, tsx] + types: [] + files: ^admin-frontend/ + args: [--fix, -c, './admin-frontend/.eslintrc.json'] + exclude: 'CHANGELOG.md' diff --git a/admin-frontend/package.json b/admin-frontend/package.json index af032f2..c8967d4 100644 --- a/admin-frontend/package.json +++ b/admin-frontend/package.json @@ -13,7 +13,6 @@ "@types/node": "^17.0.25", "@types/react": "^18.0.6", "@types/react-dom": "^18.0.2", - "eslint": "^7.32.0 || ^8.2.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-redux": "^8.0.1", @@ -48,6 +47,7 @@ ] }, "devDependencies": { + "eslint": "^7.32.0 || ^8.2.0", "@typescript-eslint/eslint-plugin": "^5.31.0", "@typescript-eslint/parser": "^5.31.0", "eslint-config-airbnb": "^19.0.4", diff --git a/admin-frontend/src/App.tsx b/admin-frontend/src/App.tsx index 87900bb..9e8544a 100644 --- a/admin-frontend/src/App.tsx +++ b/admin-frontend/src/App.tsx @@ -19,13 +19,13 @@ function App() { return ( globalConfLoaded - && ( - - } /> - } /> - } /> - - ) + ? ( + + } /> + } /> + } /> + + ) :
loading
); } diff --git a/src/plugins/nonebot_bison/admin_page/api.py b/src/plugins/nonebot_bison/admin_page/api.py index a802332..9492e79 100644 --- a/src/plugins/nonebot_bison/admin_page/api.py +++ b/src/plugins/nonebot_bison/admin_page/api.py @@ -86,14 +86,16 @@ async def get_subs_info(jwt_obj: dict): group_id = group["id"] raw_subs = await config.list_subscribe(group_id, "group") subs = list( - map(lambda sub: { + map( + lambda sub: { "platformName": sub.target.platform_name, "targetName": sub.target.name, "cats": sub.categories, - "tags": sub.tags - }, - raw_subs) - ) + "tags": sub.tags, + }, + raw_subs, + ) + ) res[group_id] = {"name": group["name"], "subscribes": subs} return res @@ -111,8 +113,14 @@ async def add_group_sub( tags: list[str], ): await config.add_subscribe( - int(group_number), "group", T_Target(target), target_name, platform_name, cats, tags - ) + int(group_number), + "group", + T_Target(target), + target_name, + platform_name, + cats, + tags, + ) return {"status": 200, "msg": ""}