Skip to content

Commit ff14f6b

Browse files
committed
perf: code prettier
1 parent 7892f5b commit ff14f6b

33 files changed

Lines changed: 223 additions & 341 deletions

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"tabWidth": 2,
55
"useTabs": false,
66
"trailingComma": "none",
7-
"printWidth": 100,
7+
"printWidth": 120,
88
"bracketSpacing": true,
99
"arrowParens": "always",
1010
"endOfLine": "lf",

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"tauri:build": "tauri build",
2323
"tauri:build:debug": "tauri build --debug",
2424
"cleanup": "./cleanup.sh",
25-
"prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
25+
"prettier": "prettier --write \"ui/**/*.{js,ts,tsx,jsx,vue,css,scss,less,html,md,json,yml,yaml}\"",
2626
"fresh-start": "./cleanup.sh && pnpm install && pnpm run tauri:dev",
2727
"reset": "rm -rf node_modules .nuxt dist && cd src-tauri && cargo clean"
2828
},
@@ -65,6 +65,7 @@
6565
"@vueuse/nuxt": "^13.9.0",
6666
"bumpp": "^10.2.0",
6767
"eslint": "^9.31.0",
68+
"prettier": "^3.6.2",
6869
"typescript": "^5.8.3"
6970
},
7071
"resolutions": {

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/app.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ useHead({
5656
}
5757
});
5858
59-
watch(
60-
() => [userTheme.value, primaryColorLight.value, primaryColorDark.value],
61-
applyCurrentThemeColor,
62-
{ immediate: true }
63-
);
59+
watch(() => [userTheme.value, primaryColorLight.value, primaryColorDark.value], applyCurrentThemeColor, {
60+
immediate: true
61+
});
6462
6563
watch(
6664
() => fontFamily.value,
@@ -70,8 +68,7 @@ watch(
7068
7169
function applyCurrentThemeColor() {
7270
const mode = userTheme.value === "dark" ? "dark" : "light";
73-
const hex =
74-
mode === "dark" ? (primaryColorDark.value as string) : (primaryColorLight.value as string);
71+
const hex = mode === "dark" ? (primaryColorDark.value as string) : (primaryColorLight.value as string);
7572
if (hex) {
7673
applyPrimaryColor(hex);
7774
}

ui/assets/css/main.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
--bg-hover-dark: rgba(0, 0, 0, 0.3);
2222
--bg-selected-light: rgba(209, 209, 209, 0.8);
2323
--bg-selected-dark: rgba(0, 0, 0, 0.5);
24-
2524
}
2625

2726
.text-xs-plus {
@@ -66,19 +65,19 @@
6665
/* Windows 平台 */
6766
.platform-windows .header-bg {
6867
--header-bg-light: rgb(248, 248, 248);
69-
--header-bg-dark: #2C2C2E;
68+
--header-bg-dark: #2c2c2e;
7069
}
7170

7271
/* macOS 平台 */
7372
.platform-darwin .header-bg {
7473
--header-bg-light: rgba(255, 255, 255, 0.8);
75-
--header-bg-dark: #1E1E1E;
74+
--header-bg-dark: #1e1e1e;
7675
}
7776

7877
/* Linux 平台 */
7978
.platform-linux .header-bg {
8079
--header-bg-light: rgb(240, 240, 240);
81-
--header-bg-dark: #2D2D30;
80+
--header-bg-dark: #2d2d30;
8281
}
8382

8483
/* 主题颜色应用 */

ui/components/AssetContextMenu/contextMenu.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ const emits = defineEmits<{
2121
}>();
2222
2323
const { t } = useI18n();
24-
const { handleAssetConnection, displayUser, handleAssetFavorite, handleAssetUnfavorite } =
25-
useAssetAction();
24+
const { handleAssetConnection, displayUser, handleAssetFavorite, handleAssetUnfavorite } = useAssetAction();
2625
2726
interface MenuItem {
2827
value?: string;

ui/components/BasePage/basePage.vue

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,7 @@ const assetManager = useAssetFetcher(props.type, scrollRef);
3131
const connEditorRef = ref<InstanceType<typeof ConnectionEditor> | null>(null);
3232
3333
const { loggedIn, currentSite, currentUser } = storeToRefs(userInfoStore);
34-
const {
35-
fetchNextPage,
36-
assetsData,
37-
isAppending,
38-
scrollbarStyles,
39-
isInitialLoading,
40-
appendSkeletonCount
41-
} = assetManager;
34+
const { fetchNextPage, assetsData, isAppending, scrollbarStyles, isInitialLoading, appendSkeletonCount } = assetManager;
4235
4336
const { visibleAssets } = useDisplayAssets(
4437
assetsData,
@@ -185,10 +178,7 @@ onBeforeUnmount(() => {
185178
class="w-full overflow-y-auto container-scrollbar pr-2"
186179
:style="scrollbarStyles"
187180
>
188-
<div
189-
v-if="!loggedIn"
190-
class="w-full h-full flex flex-col items-center justify-center gap-2 p-2"
191-
>
181+
<div v-if="!loggedIn" class="w-full h-full flex flex-col items-center justify-center gap-2 p-2">
192182
<CardLoginCard />
193183
</div>
194184

@@ -230,10 +220,7 @@ onBeforeUnmount(() => {
230220
class="w-full overflow-y-auto container-scrollbar h-[calc(100vh-5rem)]"
231221
:style="scrollbarStyles"
232222
>
233-
<div
234-
v-if="!loggedIn"
235-
class="w-full h-full flex flex-col items-center justify-center gap-2 p-2"
236-
>
223+
<div v-if="!loggedIn" class="w-full h-full flex flex-col items-center justify-center gap-2 p-2">
237224
<CardLoginCard />
238225
</div>
239226

ui/components/Card/GridCard/cardItem.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ const cancelRename = () => {
9090
container: 'p-0 sm:p-0 '
9191
}"
9292
>
93-
<section
94-
class="w-full p-4"
95-
@dblclick="emits('connectAsset', props.asset)"
96-
@contextmenu="handleContextMenu"
97-
>
93+
<section class="w-full p-4" @dblclick="emits('connectAsset', props.asset)" @contextmenu="handleContextMenu">
9894
<div class="flex items-center justify-between w-full">
9995
<div class="flex items-center gap-3 flex-1 min-w-0">
10096
<CardAssetIcon :type="props.asset.type" size="lg" />

ui/components/Card/TableCard/tableCard.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ const buildMenuItems = (asset: AssetItem): MenuItem[] => {
7272
{
7373
label: asset.isFavorite ? t("ContextMenu.Unfavorite") : t("ContextMenu.Favorite"),
7474
icon: "i-lucide-star",
75-
onClick: () =>
76-
asset.isFavorite ? handleAssetUnfavorite(asset.id) : handleAssetFavorite(asset.id)
75+
onClick: () => (asset.isFavorite ? handleAssetUnfavorite(asset.id) : handleAssetFavorite(asset.id))
7776
}
7877
];
7978
@@ -155,14 +154,12 @@ const columns: TableColumn<AssetItem>[] = [
155154
return h("input", {
156155
ref: (el: any) => (renameInputEl.value = el as HTMLInputElement),
157156
value: renameValue.value,
158-
class:
159-
"sm:text-sm font-medium truncate whitespace-nowrap border-b border-primary focus:outline-none w-full",
157+
class: "sm:text-sm font-medium truncate whitespace-nowrap border-b border-primary focus:outline-none w-full",
160158
autocapitalize: "off",
161159
autocorrect: "off",
162160
spellcheck: false,
163161
style: { textTransform: "none" },
164-
onInput: (e: InputEvent) =>
165-
(renameValue.value = (e.target as HTMLInputElement).value || ""),
162+
onInput: (e: InputEvent) => (renameValue.value = (e.target as HTMLInputElement).value || ""),
166163
onKeyup: (e: KeyboardEvent) => {
167164
if (e.key === "Enter") submitRename(row.original.id);
168165
if (e.key === "Escape") cancelRename();

ui/components/ConnectionEditor/connectionEditor.vue

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ const initDraft = (asset: AssetItem) => {
5050
5151
if (dynamic) {
5252
draftAccount.value =
53-
locale.value === "zh"
54-
? `${dynamic.name}(${dynamic.username})`
55-
: `Dynamic user(${dynamic.username})`;
53+
locale.value === "zh" ? `${dynamic.name}(${dynamic.username})` : `Dynamic user(${dynamic.username})`;
5654
} else if (manual) {
5755
draftAccount.value = locale.value === "zh" ? manual.name : "Manual input";
5856
} else {
@@ -91,10 +89,7 @@ const buildConnectionInfo = () => {
9189
if (accountMode === "hosted") {
9290
const accs = currentAsset.value?.permedAccounts || [];
9391
const matched = accs.find(
94-
(a) =>
95-
a.name === normalizedAccount ||
96-
a.username === normalizedAccount ||
97-
a.alias === normalizedAccount
92+
(a) => a.name === normalizedAccount || a.username === normalizedAccount || a.alias === normalizedAccount
9893
);
9994
accountId = matched?.id;
10095
}
@@ -150,11 +145,7 @@ async function ensureDetails(asset: AssetItem) {
150145
const detailsReady = new Promise<AssetItem>((resolve) => {
151146
const unsubscribe = useEventBus().once(
152147
"assetDetailUpdated",
153-
(payload: {
154-
assetId: string;
155-
permedAccounts: PermedAccount[];
156-
permedProtocols: PermedProtocol[];
157-
}) => {
148+
(payload: { assetId: string; permedAccounts: PermedAccount[]; permedProtocols: PermedProtocol[] }) => {
158149
if (payload.assetId !== asset.id) return;
159150
160151
currentAsset.value = {

0 commit comments

Comments
 (0)