use oxfmt instead of prettier

This commit is contained in:
pa
2026-03-13 22:30:12 +09:00
parent 82122a4fab
commit 7b7c1b4568
155 changed files with 3467 additions and 1631 deletions
+16 -5
View File
@@ -50,10 +50,18 @@ const showAvatarDialog = vi.fn();
const showWorldDialog = vi.fn();
const showGroupDialog = vi.fn();
vi.mock('../../coordinators/userCoordinator', () => ({ showUserDialog: (...args) => showUserDialog(...args) }));
vi.mock('../../coordinators/avatarCoordinator', () => ({ showAvatarDialog: (...args) => showAvatarDialog(...args) }));
vi.mock('../../coordinators/worldCoordinator', () => ({ showWorldDialog: (...args) => showWorldDialog(...args) }));
vi.mock('../../coordinators/groupCoordinator', () => ({ showGroupDialog: (...args) => showGroupDialog(...args) }));
vi.mock('../../coordinators/userCoordinator', () => ({
showUserDialog: (...args) => showUserDialog(...args)
}));
vi.mock('../../coordinators/avatarCoordinator', () => ({
showAvatarDialog: (...args) => showAvatarDialog(...args)
}));
vi.mock('../../coordinators/worldCoordinator', () => ({
showWorldDialog: (...args) => showWorldDialog(...args)
}));
vi.mock('../../coordinators/groupCoordinator', () => ({
showGroupDialog: (...args) => showGroupDialog(...args)
}));
import { useGlobalSearchStore } from '../globalSearch';
@@ -104,7 +112,10 @@ describe('useGlobalSearchStore', () => {
});
expect(store.friendResults).toEqual([]);
mocks.friendStore.friends.set('usr_new', { id: 'usr_new', ref: { id: 'usr_new' } });
mocks.friendStore.friends.set('usr_new', {
id: 'usr_new',
ref: { id: 'usr_new' }
});
worker.emit({
type: 'searchResult',
payload: {
+1 -3
View File
@@ -119,9 +119,7 @@ describe('notyGetImage', () => {
test('returns empty string when user lookup fails', async () => {
deps.getUserIdFromNoty.mockReturnValue('usr_abc');
deps.queryRequest.fetch.mockRejectedValue(
new Error('Network error')
);
deps.queryRequest.fetch.mockRejectedValue(new Error('Network error'));
dispatch = createOverlayDispatch(deps);
const result = await dispatch.notyGetImage({});
+4 -6
View File
@@ -221,9 +221,7 @@ describe('useSearchStore', () => {
});
test('parses vrchat.com group URL', () => {
store.directAccessParse(
'https://vrchat.com/home/group/grp_abc123'
);
store.directAccessParse('https://vrchat.com/home/group/grp_abc123');
expect(mockShowGroupDialog).toHaveBeenCalledWith('grp_abc123');
});
@@ -248,9 +246,9 @@ describe('useSearchStore', () => {
});
test('returns false for short vrchat URL with insufficient path segments', () => {
expect(
store.directAccessParse('https://vrchat.com/home')
).toBe(false);
expect(store.directAccessParse('https://vrchat.com/home')).toBe(
false
);
});
});
+39 -6
View File
@@ -30,7 +30,12 @@ describe('searchWorker message protocol', () => {
harness.dispatch({
type: 'search',
payload: { seq: 7, query: 'a', currentUserId: 'usr_me', language: 'en-US' }
payload: {
seq: 7,
query: 'a',
currentUserId: 'usr_me',
language: 'en-US'
}
});
expect(harness.sent).toHaveLength(1);
@@ -57,17 +62,45 @@ describe('searchWorker message protocol', () => {
type: 'updateIndex',
payload: {
friends: [],
avatars: [{ id: 'avtr_1', name: 'Alpha Avatar', authorId: 'usr_me', imageUrl: '' }],
worlds: [{ id: 'wrld_1', name: 'Alpha World', authorId: 'usr_me', imageUrl: '' }],
groups: [{ id: 'grp_1', name: 'Alpha Group', ownerId: 'usr_me', imageUrl: '' }],
favAvatars: [{ id: 'avtr_1', name: 'Alpha Avatar', imageUrl: '' }],
avatars: [
{
id: 'avtr_1',
name: 'Alpha Avatar',
authorId: 'usr_me',
imageUrl: ''
}
],
worlds: [
{
id: 'wrld_1',
name: 'Alpha World',
authorId: 'usr_me',
imageUrl: ''
}
],
groups: [
{
id: 'grp_1',
name: 'Alpha Group',
ownerId: 'usr_me',
imageUrl: ''
}
],
favAvatars: [
{ id: 'avtr_1', name: 'Alpha Avatar', imageUrl: '' }
],
favWorlds: [{ id: 'wrld_1', name: 'Alpha World', imageUrl: '' }]
}
});
harness.dispatch({
type: 'search',
payload: { seq: 8, query: 'Alpha', currentUserId: 'usr_me', language: 'en-US' }
payload: {
seq: 8,
query: 'Alpha',
currentUserId: 'usr_me',
language: 'en-US'
}
});
const result = harness.sent.at(-1);
+3 -4
View File
@@ -28,10 +28,9 @@ vi.mock('vue-sonner', () => ({
vi.mock('vue-i18n', () => ({
useI18n: () => ({
t: (key) => key
,
locale: require('vue').ref('en')
})
t: (key) => key,
locale: require('vue').ref('en')
})
}));
function flushPromises() {
+4 -2
View File
@@ -3,7 +3,10 @@ import { defineStore } from 'pinia';
import { checkVRChatCache } from '../shared/utils';
import { queryRequest } from '../api';
import { getAvatarHistory, preloadOwnAvatars } from '../coordinators/avatarCoordinator';
import {
getAvatarHistory,
preloadOwnAvatars
} from '../coordinators/avatarCoordinator';
import { database } from '../services/database';
import { watchState } from '../services/watchState';
@@ -84,7 +87,6 @@ export const useAvatarStore = defineStore('Avatar', () => {
* @returns {Promise<string[]>}
*/
async function getAvatarGallery(avatarId) {
const D = avatarDialog.value;
const args = await queryRequest
.fetch('avatarGallery', { avatarId })
+11 -7
View File
@@ -12,12 +12,18 @@ function clonePanel(panel) {
if (typeof panel === 'string' && panel) {
return panel;
}
if (panel && typeof panel === 'object' && typeof panel.key === 'string' && panel.key) {
if (
panel &&
typeof panel === 'object' &&
typeof panel.key === 'string' &&
panel.key
) {
return {
key: panel.key,
config: panel.config && typeof panel.config === 'object'
? JSON.parse(JSON.stringify(panel.config))
: {}
config:
panel.config && typeof panel.config === 'object'
? JSON.parse(JSON.stringify(panel.config))
: {}
};
}
return null;
@@ -139,9 +145,7 @@ export const useDashboardStore = defineStore('dashboard', () => {
}
function generateNextDashboardName(baseName = 'Dashboard') {
const existingNames = new Set(
dashboards.value.map((d) => d.name)
);
const existingNames = new Set(dashboards.value.map((d) => d.name));
if (!existingNames.has(baseName)) {
return baseName;
}
-1
View File
@@ -241,7 +241,6 @@ export const useGlobalSearchStore = defineStore('GlobalSearch', () => {
joinedGroupResults.value = [];
}
function open() {
sendIndexUpdate();
isOpen.value = true;
+2 -1
View File
@@ -258,7 +258,8 @@ export const useInstanceStore = defineStore('Instance', () => {
emptyDefault: { id: '', name: '' },
idAlias: 'worldId',
nameKey: 'name',
fetchFn: (id) => queryRequest.fetch('world.location', { worldId: id })
fetchFn: (id) =>
queryRequest.fetch('world.location', { worldId: id })
});
}
+69 -17
View File
@@ -124,12 +124,12 @@ function isPrefixMatch(name, query, comparer) {
// ── Index data (updated from main thread) ───────────────────────────
let indexedFriends = []; // { id, name, memo, note, imageUrl }
let indexedAvatars = []; // { id, name, authorId, imageUrl }
let indexedWorlds = []; // { id, name, authorId, imageUrl }
let indexedGroups = []; // { id, name, ownerId, imageUrl }
let indexedFriends = []; // { id, name, memo, note, imageUrl }
let indexedAvatars = []; // { id, name, authorId, imageUrl }
let indexedWorlds = []; // { id, name, authorId, imageUrl }
let indexedGroups = []; // { id, name, ownerId, imageUrl }
let indexedFavAvatars = []; // { id, name, imageUrl }
let indexedFavWorlds = []; // { id, name, imageUrl }
let indexedFavWorlds = []; // { id, name, imageUrl }
/**
* Update the search index with fresh data snapshots.
@@ -181,7 +181,15 @@ function searchFriends(query, comparer, limit = 10) {
return results;
}
function searchItems(query, items, type, comparer, ownerKey, ownerId, limit = 10) {
function searchItems(
query,
items,
type,
comparer,
ownerKey,
ownerId,
limit = 10
) {
const results = [];
for (const ref of items) {
if (!ref || !ref.name) continue;
@@ -226,18 +234,60 @@ function handleSearch(payload) {
return;
}
const comparer = new Intl.Collator(
(language || 'en').replace('_', '-'),
{ usage: 'search', sensitivity: 'base' }
);
const comparer = new Intl.Collator((language || 'en').replace('_', '-'), {
usage: 'search',
sensitivity: 'base'
});
const friends = searchFriends(query, comparer);
const ownAvatars = searchItems(query, indexedAvatars, 'avatar', comparer, 'authorId', currentUserId);
const favAvatars = searchItems(query, indexedFavAvatars, 'avatar', comparer, null, null);
const ownWorlds = searchItems(query, indexedWorlds, 'world', comparer, 'authorId', currentUserId);
const favWorlds = searchItems(query, indexedFavWorlds, 'world', comparer, null, null);
const ownGroups = searchItems(query, indexedGroups, 'group', comparer, 'ownerId', currentUserId);
const joinedGroups = searchItems(query, indexedGroups, 'group', comparer, null, null);
const ownAvatars = searchItems(
query,
indexedAvatars,
'avatar',
comparer,
'authorId',
currentUserId
);
const favAvatars = searchItems(
query,
indexedFavAvatars,
'avatar',
comparer,
null,
null
);
const ownWorlds = searchItems(
query,
indexedWorlds,
'world',
comparer,
'authorId',
currentUserId
);
const favWorlds = searchItems(
query,
indexedFavWorlds,
'world',
comparer,
null,
null
);
const ownGroups = searchItems(
query,
indexedGroups,
'group',
comparer,
'ownerId',
currentUserId
);
const joinedGroups = searchItems(
query,
indexedGroups,
'group',
comparer,
null,
null
);
// Deduplicate favorites against own
const ownAvatarIds = new Set(ownAvatars.map((r) => r.id));
@@ -245,7 +295,9 @@ function handleSearch(payload) {
const ownWorldIds = new Set(ownWorlds.map((r) => r.id));
const dedupedFavWorlds = favWorlds.filter((r) => !ownWorldIds.has(r.id));
const ownGroupIds = new Set(ownGroups.map((r) => r.id));
const dedupedJoinedGroups = joinedGroups.filter((r) => !ownGroupIds.has(r.id));
const dedupedJoinedGroups = joinedGroups.filter(
(r) => !ownGroupIds.has(r.id)
);
self.postMessage({
type: 'searchResult',