Skip to content

Commit

Permalink
🎨 代码格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Oct 10, 2023
1 parent 5c2bb4e commit b04f49e
Show file tree
Hide file tree
Showing 114 changed files with 354 additions and 523 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ dist
src-tauri/target
# Submodules
TGAssistant
# Package files
pnpm-lock.yaml
51 changes: 16 additions & 35 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ globals:
TGApp: readonly
window: readonly
rules:
vue/multi-word-component-names: warn
vue/multi-word-component-names: off
vue/valid-template-root: off
overrides:
- files: ["*.ts"]
extends: standard-with-typescript
Expand All @@ -34,9 +35,7 @@ overrides:
alphabetize:
order: asc
caseInsensitive: true
"@typescript-eslint/indent":
- warn
- 2
"@typescript-eslint/indent": off
"@typescript-eslint/quotes":
- error
- double
Expand All @@ -57,31 +56,23 @@ overrides:
delimiter: semi
requireLast: true
"@typescript-eslint/no-import-type-side-effects": error
"@typescript-eslint/strict-boolean-expressions":
- warn
- allowString: false
allowNumber: false
allowNullableObject: false
allowNullableBoolean: false
allowNullableString: false
allowNullableNumber: false
allowAny: false
"@typescript-eslint/strict-boolean-expressions": off
"@typescript-eslint/consistent-type-assertions":
- warn
- assertionStyle: angle-bracket # 使用尖括号
"@typescript-eslint/naming-convention":
- warn
- selector: variableLike
format: ["camelCase", "UPPER_CASE", "PascalCase", "snake_case"]
leadingUnderscore: "allow"
trailingUnderscore: "allow"
format: [camelCase, UPPER_CASE, PascalCase, snake_case]
leadingUnderscore: allow
trailingUnderscore: allow
"@typescript-eslint/no-non-null-assertion": warn
"@typescript-eslint/no-misused-promises": warn
"@typescript-eslint/no-misused-promises": off
- files: ["*.vue"]
parser: vue-eslint-parser
parserOptions:
parser: "@typescript-eslint/parser"
extraFileExtensions: [".vue"]
extraFileExtensions: [.vue]
rules:
import/order:
- error
Expand All @@ -94,9 +85,7 @@ overrides:
alphabetize:
order: asc
caseInsensitive: true
"@typescript-eslint/indent":
- warn
- 2
"@typescript-eslint/indent": off
"@typescript-eslint/quotes":
- error
- double
Expand All @@ -117,27 +106,19 @@ overrides:
delimiter: semi
requireLast: true
"@typescript-eslint/no-import-type-side-effects": error
"@typescript-eslint/strict-boolean-expressions":
- warn
- allowString: false
allowNumber: false
allowNullableObject: false
allowNullableBoolean: false
allowNullableString: false
allowNullableNumber: false
allowAny: false
"@typescript-eslint/strict-boolean-expressions": off
"@typescript-eslint/consistent-type-assertions":
- warn
- assertionStyle: angle-bracket # 使用尖括号
"@typescript-eslint/naming-convention":
- warn
- selector: variableLike
format: ["camelCase", "UPPER_CASE", "PascalCase", "snake_case"]
leadingUnderscore: "allow"
trailingUnderscore: "allow"
format: [camelCase, UPPER_CASE, PascalCase, snake_case]
leadingUnderscore: allow
trailingUnderscore: allow
"@typescript-eslint/no-non-null-assertion": warn
"@typescript-eslint/no-misused-promises": warn
- files: ["*.json"]
"@typescript-eslint/no-misused-promises": off
- files: [package.json, tsconfig.json]
parser: jsonc-eslint-parser
rules:
jsonc/sort-array-values:
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "TeyvatGuide",
"version": "0.3.3",
"description": "A Genshin Tool build with Tauri",
"private": true,
"version": "0.3.3",
"author": "BTMuli <[email protected]>",
"packageManager": "[email protected]",
"scripts": {
"build": "tauri build",
Expand All @@ -28,26 +27,27 @@
"*.{vue,css}": "stylelint --fix",
"*.{ts,vue,css,yml,json,md}": "prettier --write"
},
"bugs": {
"url": "https://github.com/BTMuli/TeyvatGuide/issues"
},
"directories": {
"doc": "docs"
},
"homepage": "https://github.com/BTMuli/TeyvatGuide#readme",
"keywords": [
"Tauri",
"Genshin Impact",
"Node",
"Tauri",
"Typescript",
"Vite",
"Genshin Impact",
"Vuetify"
],
"author": "BTMuli <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/BTMuli/TeyvatGuide.git"
},
"homepage": "https://github.com/BTMuli/TeyvatGuide#readme",
"bugs": {
"url": "https://github.com/BTMuli/TeyvatGuide/issues"
},
"directories": {
"doc": "docs"
},
"dependencies": {
"@mdi/font": "7.2.96",
"@tauri-apps/api": "^1.4.0",
Expand Down
28 changes: 14 additions & 14 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
#-------------------------------------------------------------------------------#
# -------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
# -------------------------------------------------------------------------------#
version: "1.0"

#Specify inspection profile for code analysis
# Specify inspection profile for code analysis
profile:
name: qodana.starter

#Enable inspections
#include:
# Enable inspections
# include:
# - name: <SomeEnabledInspectionId>

#Disable inspections
#exclude:
# Disable inspections
# exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>

#The following options are only applied in CI/CD environment
#These options are ignored during local run
# The following options are only applied in CI/CD environment
# These options are ignored during local run

#Execute shell command before Qodana execution
#bootstrap: sh ./prepare-qodana.sh
# Execute shell command before Qodana execution
# bootstrap: sh ./prepare-qodana.sh

#Install IDE plugins before Qodana execution
#plugins:
# Install IDE plugins before Qodana execution
# plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)

#Specify Qodana linter for analysis
# Specify Qodana linter for analysis
linter: jetbrains/qodana-js:latest
34 changes: 17 additions & 17 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@
"all": true,
"request": true,
"scope": [
"https://api-takumi.mihoyo.com/*",
"https://api-takumi-record.mihoyo.com/*",
"https://act-webstatic.mihoyo.com/*",
"https://api-static.mihoyo.com/*",
"https://api-takumi-record.mihoyo.com/*",
"https://api-takumi.mihoyo.com/*",
"https://api.geetest.com/*",
"https://bbs-api-static.miyoushe.com/*",
"https://bbs-api.mihoyo.com/*",
"https://bbs-api.miyoushe.com/*",
"https://bbs-api-static.miyoushe.com/*",
"https://bbs.mihoyo.com/*",
"https://enka-api.hut.ao/*",
"https://hk4e-api.mihoyo.com/*",
"https://hk4e-sdk.mihoyo.com/*",
"https://homa.snapgenshin.com/*",
"https://passport-api-v4.mihoyo.com/*",
"https://passport-api.mihoyo.com/*",
"https://passport-api.miyoushe.com/*",
"https://passport-api-v4.mihoyo.com/*",
"https://act-webstatic.mihoyo.com/*",
"https://sdk-webstatic.mihoyo.com/*",
"https://homa.snapgenshin.com/*",
"https://enka-api.hut.ao/*",
"https://api.geetest.com/*"
"https://sdk-webstatic.mihoyo.com/*"
]
},
"shell": {
Expand All @@ -48,21 +48,21 @@
"bundle": {
"active": true,
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.ico",
"icons/icon.png",
"icons/Square30x30Logo.png",
"icons/Square44x44Logo.png",
"icons/Square71x71Logo.png",
"icons/Square89x89Logo.png",
"icons/32x32.png",
"icons/Square107x107Logo.png",
"icons/Square142x142Logo.png",
"icons/Square150x150Logo.png",
"icons/Square284x284Logo.png",
"icons/Square30x30Logo.png",
"icons/Square310x310Logo.png",
"icons/StoreLogo.png"
"icons/Square44x44Logo.png",
"icons/Square71x71Logo.png",
"icons/Square89x89Logo.png",
"icons/StoreLogo.png",
"icons/icon.ico",
"icons/icon.png"
],
"identifier": "TeyvatGuide",
"targets": ["msi"],
Expand Down
28 changes: 17 additions & 11 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@
</template>

<script lang="ts" setup>
// vue
import { app, event, fs, tauri, window as TauriWindow } from "@tauri-apps/api";
import { onBeforeMount, onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import showSnackbar from "./components/func/snackbar";
import TSidebar from "./components/app/t-sidebar.vue";
import TBackTop from "./components/app/t-backTop.vue";
// tauri
import { app, event, fs, tauri, window as TauriWindow } from "@tauri-apps/api";
// store
import { useAppStore } from "./store/modules/app";
import { useUserStore } from "./store/modules/user";
// utils
import TSidebar from "./components/app/t-sidebar.vue";
import showSnackbar from "./components/func/snackbar";
import { getEmojis } from "./plugins/Mys/request/getEmojis";
import TGSqlite from "./plugins/Sqlite";
import { useAppStore } from "./store/modules/app";
import { useUserStore } from "./store/modules/user";
const appStore = useAppStore();
const isMain = ref<boolean>(false);
Expand Down Expand Up @@ -69,6 +66,7 @@ async function listenOnInit(): Promise<void> {
await checkAppLoad();
await checkUserLoad();
});
return;
}
async function emojiLoad(): Promise<void> {
Expand Down Expand Up @@ -155,11 +153,19 @@ async function initData(): Promise<void> {
async function getDeepLink(): Promise<void> {
await event.listen("active_deep_link", (e) => {
new TauriWindow.WebviewWindow("TeyvatGuide")
.show()
.center()
.then(async () => {
if (typeof e.payload !== "string") {
showSnackbar({
text: "无效的 deep link!",
color: "error",
timeout: 3000,
});
return;
}
// 导入格式: teyvatguide://import_uigf?app=appName
// 跳转格式: localhost:4000/achievements/?app=appName
if ((<string>e.payload).startsWith("teyvatguide://import_uigf")) {
if (e.payload.startsWith("teyvatguide://import_uigf")) {
const param = (<string>e.payload).split("teyvatguide://import_uigf/?")[1];
let appName = "";
if (param) {
Expand Down
10 changes: 4 additions & 6 deletions src/components/app/t-sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@
</template>

<script lang="ts" setup>
// vue
import { computed, onMounted, ref } from "vue";
// tauri
import { event } from "@tauri-apps/api";
// store
import { computed, onMounted, ref } from "vue";
import { useAppStore } from "../../store/modules/app";
import { useUserStore } from "../../store/modules/user";
Expand All @@ -137,8 +135,8 @@ const isDevEnv = ref<boolean>(import.meta.env.MODE === "development");
const userInfo = computed(() => {
const info = userStore.getBriefInfo();
return {
nickname: info.nickname || "未登录",
avatar: info.avatar || "/source/UI/defaultUser.webp",
nickname: info?.nickname ?? "未登录",
avatar: info?.avatar ?? "/source/UI/defaultUser.webp",
};
});
const rail = ref(appStore.sidebar.collapse);
Expand Down
6 changes: 2 additions & 4 deletions src/components/app/t-switchTheme.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
</div>
</template>
<script lang="ts" setup>
// vue
import { computed, onMounted } from "vue";
// tauri
import { event } from "@tauri-apps/api";
// store
import { computed, onMounted } from "vue";
import { useAppStore } from "../../store/modules/app";
// store
Expand Down
8 changes: 3 additions & 5 deletions src/components/func/confirm.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/**
* @file component func confirm.ts
* @description 封装自定义 confirm 组件,通过函数调用的方式,简化 confirm 的使用
* @author BTMuli <[email protected]>
* @since Alpha v0.2.3
* @since Beta v0.3.3
*/

// vue
import { h, render, type VNode } from "vue";
// confirm

import confirm from "./confirm.vue";

const confirmId = "tg-func-confirm";
Expand All @@ -24,7 +22,7 @@ const renderBox = (props: TGApp.Component.Confirm.Params): VNode => {
let confirmInstance: VNode;

const showConfirm = async (props: TGApp.Component.Confirm.Params): Promise<string | boolean> => {
if (confirmInstance) {
if (confirmInstance !== undefined) {
const boxVue = confirmInstance.component;
return boxVue?.exposeProxy?.displayBox(props);
} else {
Expand Down
Loading

0 comments on commit b04f49e

Please sign in to comment.