mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-02 02:00:49 +08:00
style: add perf rules (#5413)
This commit is contained in:
+2
-2
@@ -31,7 +31,7 @@
|
||||
"lint:eslint:fix": "yarn lint:eslint --fix",
|
||||
"lint:prettier": "prettier --ignore-unknown --cache --check .",
|
||||
"lint:prettier:fix": "prettier --ignore-unknown --cache --write .",
|
||||
"lint:ox": "oxlint --deny-warnings -D correctness -D nursery -D prefer-array-some -D no-useless-promise-resolve-reject -A no-undef -A consistent-type-exports -A default -A named -A ban-ts-comment",
|
||||
"lint:ox": "oxlint --import-plugin --deny-warnings -D correctness -D nursery -D prefer-array-some -D no-useless-promise-resolve-reject -D perf -A no-undef -A consistent-type-exports -A default -A named -A ban-ts-comment -A export",
|
||||
"lint": "yarn lint:eslint && yarn lint:prettier",
|
||||
"lint:fix": "yarn lint:eslint:fix && yarn lint:prettier:fix",
|
||||
"test": "vitest --run",
|
||||
@@ -97,7 +97,7 @@
|
||||
"nx": "^17.1.3",
|
||||
"nx-cloud": "^16.5.2",
|
||||
"nyc": "^15.1.0",
|
||||
"oxlint": "0.0.21",
|
||||
"oxlint": "0.0.22",
|
||||
"prettier": "^3.1.0",
|
||||
"semver": "^7.5.4",
|
||||
"serve": "^14.2.1",
|
||||
|
||||
@@ -244,8 +244,7 @@ const states: Partial<Record<ArticleId, EdgelessSwitchState>> = {
|
||||
|
||||
export const articles: Record<ArticleId, ArticleOption> = ids.reduce(
|
||||
(acc, id) => {
|
||||
return {
|
||||
...acc,
|
||||
return Object.assign(acc, {
|
||||
[id]: {
|
||||
id,
|
||||
location: paperLocations[id],
|
||||
@@ -254,7 +253,7 @@ export const articles: Record<ArticleId, ArticleOption> = ids.reduce(
|
||||
blocks: contents[id],
|
||||
initState: states[id],
|
||||
} satisfies ArticleOption,
|
||||
};
|
||||
});
|
||||
},
|
||||
{} as Record<ArticleId, ArticleOption>
|
||||
);
|
||||
|
||||
@@ -45,10 +45,9 @@ export function useI18N() {
|
||||
return i18n;
|
||||
}
|
||||
|
||||
const resources = LOCALES.reduce<Resource>(
|
||||
(acc, { tag, res }) => ({ ...acc, [tag]: { translation: res } }),
|
||||
{}
|
||||
);
|
||||
const resources = LOCALES.reduce<Resource>((acc, { tag, res }) => {
|
||||
return Object.assign(acc, { [tag]: { translation: res } });
|
||||
}, {});
|
||||
|
||||
const fallbackLng = 'en';
|
||||
const standardizeLocale = (language: string) => {
|
||||
|
||||
@@ -27,9 +27,9 @@ export const flattenTranslation = (
|
||||
if (!(obj instanceof Object)) return { [path ?? '']: obj };
|
||||
|
||||
return Object.keys(obj).reduce((output, key) => {
|
||||
return {
|
||||
...output,
|
||||
...flattenTranslation(obj[key], path ? path + '.' + key : key),
|
||||
};
|
||||
return Object.assign(
|
||||
output,
|
||||
flattenTranslation(obj[key], path ? path + '.' + key : key)
|
||||
);
|
||||
}, {});
|
||||
};
|
||||
|
||||
@@ -42,10 +42,9 @@ export function createCloudAwarenessProvider(
|
||||
return;
|
||||
}
|
||||
|
||||
const changedClients = Object.values(changes).reduce((res, cur) => [
|
||||
...res,
|
||||
...cur,
|
||||
]);
|
||||
const changedClients = Object.values(changes).reduce((res, cur) =>
|
||||
res.concat(cur)
|
||||
);
|
||||
|
||||
const update = encodeAwarenessUpdate(awareness, changedClients);
|
||||
uint8ArrayToBase64(update)
|
||||
|
||||
@@ -23,10 +23,9 @@ export function createBroadcastChannelAwarenessProvider(
|
||||
return;
|
||||
}
|
||||
|
||||
const changedClients = Object.values(changes).reduce((res, cur) => [
|
||||
...res,
|
||||
...cur,
|
||||
]);
|
||||
const changedClients = Object.values(changes).reduce((res, cur) =>
|
||||
res.concat(cur)
|
||||
);
|
||||
|
||||
const update = encodeAwarenessUpdate(awareness, changedClients);
|
||||
channel.postMessage({
|
||||
|
||||
@@ -582,7 +582,7 @@ __metadata:
|
||||
nx: "npm:^17.1.3"
|
||||
nx-cloud: "npm:^16.5.2"
|
||||
nyc: "npm:^15.1.0"
|
||||
oxlint: "npm:0.0.21"
|
||||
oxlint: "npm:0.0.22"
|
||||
prettier: "npm:^3.1.0"
|
||||
semver: "npm:^7.5.4"
|
||||
serve: "npm:^14.2.1"
|
||||
@@ -9328,44 +9328,44 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@oxlint/darwin-arm64@npm:0.0.21":
|
||||
version: 0.0.21
|
||||
resolution: "@oxlint/darwin-arm64@npm:0.0.21"
|
||||
"@oxlint/darwin-arm64@npm:0.0.22":
|
||||
version: 0.0.22
|
||||
resolution: "@oxlint/darwin-arm64@npm:0.0.22"
|
||||
conditions: os=darwin & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@oxlint/darwin-x64@npm:0.0.21":
|
||||
version: 0.0.21
|
||||
resolution: "@oxlint/darwin-x64@npm:0.0.21"
|
||||
"@oxlint/darwin-x64@npm:0.0.22":
|
||||
version: 0.0.22
|
||||
resolution: "@oxlint/darwin-x64@npm:0.0.22"
|
||||
conditions: os=darwin & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@oxlint/linux-arm64@npm:0.0.21":
|
||||
version: 0.0.21
|
||||
resolution: "@oxlint/linux-arm64@npm:0.0.21"
|
||||
"@oxlint/linux-arm64@npm:0.0.22":
|
||||
version: 0.0.22
|
||||
resolution: "@oxlint/linux-arm64@npm:0.0.22"
|
||||
conditions: os=linux & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@oxlint/linux-x64@npm:0.0.21":
|
||||
version: 0.0.21
|
||||
resolution: "@oxlint/linux-x64@npm:0.0.21"
|
||||
"@oxlint/linux-x64@npm:0.0.22":
|
||||
version: 0.0.22
|
||||
resolution: "@oxlint/linux-x64@npm:0.0.22"
|
||||
conditions: os=linux & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@oxlint/win32-arm64@npm:0.0.21":
|
||||
version: 0.0.21
|
||||
resolution: "@oxlint/win32-arm64@npm:0.0.21"
|
||||
"@oxlint/win32-arm64@npm:0.0.22":
|
||||
version: 0.0.22
|
||||
resolution: "@oxlint/win32-arm64@npm:0.0.22"
|
||||
conditions: os=win32 & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@oxlint/win32-x64@npm:0.0.21":
|
||||
version: 0.0.21
|
||||
resolution: "@oxlint/win32-x64@npm:0.0.21"
|
||||
"@oxlint/win32-x64@npm:0.0.22":
|
||||
version: 0.0.22
|
||||
resolution: "@oxlint/win32-x64@npm:0.0.22"
|
||||
conditions: os=win32 & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
@@ -28564,16 +28564,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"oxlint@npm:0.0.21":
|
||||
version: 0.0.21
|
||||
resolution: "oxlint@npm:0.0.21"
|
||||
"oxlint@npm:0.0.22":
|
||||
version: 0.0.22
|
||||
resolution: "oxlint@npm:0.0.22"
|
||||
dependencies:
|
||||
"@oxlint/darwin-arm64": "npm:0.0.21"
|
||||
"@oxlint/darwin-x64": "npm:0.0.21"
|
||||
"@oxlint/linux-arm64": "npm:0.0.21"
|
||||
"@oxlint/linux-x64": "npm:0.0.21"
|
||||
"@oxlint/win32-arm64": "npm:0.0.21"
|
||||
"@oxlint/win32-x64": "npm:0.0.21"
|
||||
"@oxlint/darwin-arm64": "npm:0.0.22"
|
||||
"@oxlint/darwin-x64": "npm:0.0.22"
|
||||
"@oxlint/linux-arm64": "npm:0.0.22"
|
||||
"@oxlint/linux-x64": "npm:0.0.22"
|
||||
"@oxlint/win32-arm64": "npm:0.0.22"
|
||||
"@oxlint/win32-x64": "npm:0.0.22"
|
||||
dependenciesMeta:
|
||||
"@oxlint/darwin-arm64":
|
||||
optional: true
|
||||
@@ -28589,7 +28589,7 @@ __metadata:
|
||||
optional: true
|
||||
bin:
|
||||
oxlint: bin/oxlint
|
||||
checksum: 8de4a2d5252a459c0ef59634ba6bc4546da65e3c80f91c11e0d65c7df8ebb2f280e7256ef5997d5b1c18d8d98da87c6babc93fc88dd280c147c05eef93935411
|
||||
checksum: 9d780f3293b08c83e45996187c8098e2ef8323ed02427c7a15d5cfa542f967b0e7862f76814ef3b8c4b94badd2f21eb92130de7f2f8f0dfec91e4a3a3797c63f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user