pl-api: enable perf rules

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-02-15 03:06:56 +01:00
parent ad00129411
commit 6ee90c7c26
3 changed files with 22 additions and 10 deletions

View File

@ -4,7 +4,8 @@
"categories": {
"correctness": "error",
"suspicious": "error",
"pedantic": "warn"
"pedantic": "warn",
"perf": "warn",
},
"rules": {
"max-dependencies": "off",

View File

@ -948,14 +948,25 @@ class PlApiClient {
let response: any;
if (this.features.version.software === PIXELFED) {
response = [];
for (const accountId of accountIds) {
const accounts = (await this.request(`/api/v1.1/accounts/mutuals/${accountId}`)).json;
response.push({
id: accountId,
accounts,
});
}
const settledResponse = await Promise.allSettled(
accountIds.map(async (accountId) => {
const accounts = (await this.request(`/api/v1.1/accounts/mutuals/${accountId}`)).json;
return {
id: accountId,
accounts,
};
}),
);
response = settledResponse.map((result, index) =>
result.status === 'fulfilled'
? result.value
: {
id: accountIds[index],
accounts: [],
},
);
} else {
response = (
await this.request('/api/v1/accounts/familiar_followers', { params: { id: accountIds } })

View File

@ -45,7 +45,7 @@ type CreateAccountParams = {
/** EIP-4361 signature (required if message is present) */
signature: string;
}
| Record<string, never>
| {}
);
/**