mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 06:16:59 +08:00
style: add @typescript-eslint/return-await rule (#9612)
This commit is contained in:
@@ -159,6 +159,10 @@ export default tseslint.config(
|
|||||||
'@typescript-eslint/no-unsafe-function-type': 'error',
|
'@typescript-eslint/no-unsafe-function-type': 'error',
|
||||||
'@typescript-eslint/no-wrapper-object-types': 'error',
|
'@typescript-eslint/no-wrapper-object-types': 'error',
|
||||||
'@typescript-eslint/unified-signatures': 'error',
|
'@typescript-eslint/unified-signatures': 'error',
|
||||||
|
'@typescript-eslint/return-await': [
|
||||||
|
'error',
|
||||||
|
'error-handling-correctness-only',
|
||||||
|
],
|
||||||
'@typescript-eslint/no-restricted-imports': [
|
'@typescript-eslint/no-restricted-imports': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
@@ -269,7 +273,11 @@ export default tseslint.config(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['packages/frontend/apps/electron/scripts/**/*'],
|
files: [
|
||||||
|
'packages/frontend/apps/electron/scripts/**/*',
|
||||||
|
'blocksuite/tests-legacy/**/*.{ts,tsx}',
|
||||||
|
'blocksuite/**/__tests__/**/*.{ts,tsx}',
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'import-x/no-extraneous-dependencies': 'off',
|
'import-x/no-extraneous-dependencies': 'off',
|
||||||
},
|
},
|
||||||
@@ -280,14 +288,5 @@ export default tseslint.config(
|
|||||||
'rxjs/finnish': 'off',
|
'rxjs/finnish': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
files: [
|
|
||||||
'blocksuite/tests-legacy/**/*.{ts,tsx}',
|
|
||||||
'blocksuite/**/__tests__/**/*.{ts,tsx}',
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
'import-x/no-extraneous-dependencies': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
eslintConfigPrettier
|
eslintConfigPrettier
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export class IndexedDBIndex<S extends Schema> implements Index<S> {
|
|||||||
return fromPromise(async () => {
|
return fromPromise(async () => {
|
||||||
try {
|
try {
|
||||||
const trx = await this.data.readonly();
|
const trx = await this.data.readonly();
|
||||||
return this.data.search(trx, query, options);
|
return await this.data.search(trx, query, options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('search error', error);
|
logger.error('search error', error);
|
||||||
throw error;
|
throw error;
|
||||||
@@ -100,7 +100,7 @@ export class IndexedDBIndex<S extends Schema> implements Index<S> {
|
|||||||
return fromPromise(async () => {
|
return fromPromise(async () => {
|
||||||
try {
|
try {
|
||||||
const trx = await this.data.readonly();
|
const trx = await this.data.readonly();
|
||||||
return this.data.aggregate(trx, query, field, options);
|
return await this.data.aggregate(trx, query, field, options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('aggregate error', error);
|
logger.error('aggregate error', error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ export async function loadDBFile(): Promise<LoadDBFileResult> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const workspaceId = nanoid(10);
|
const workspaceId = nanoid(10);
|
||||||
return loadV1DBFile(originalPath, workspaceId);
|
return await loadV1DBFile(originalPath, workspaceId);
|
||||||
|
|
||||||
// TODO(forehalo): use `nbstore` when it is ready
|
// TODO(forehalo): use `nbstore` when it is ready
|
||||||
// let storage = new DocStorage(originalPath);
|
// let storage = new DocStorage(originalPath);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ async function resizeImage(blob: Blob | File): Promise<Blob | null> {
|
|||||||
if (ctx) {
|
if (ctx) {
|
||||||
ctx.imageSmoothingQuality = 'high';
|
ctx.imageSmoothingQuality = 'high';
|
||||||
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
||||||
return new Promise(resolve =>
|
return await new Promise(resolve =>
|
||||||
canvas.toBlob(blob => resolve(blob), 'image/jpeg', 0.8)
|
canvas.toBlob(blob => resolve(blob), 'image/jpeg', 0.8)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ export class AuthService extends Service {
|
|||||||
this.session.revalidate();
|
this.session.revalidate();
|
||||||
|
|
||||||
track.$.$.auth.signedIn({ method: 'oauth', provider });
|
track.$.$.auth.signedIn({ method: 'oauth', provider });
|
||||||
return res.json();
|
return await res.json();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
track.$.$.auth.signInFail({
|
track.$.$.auth.signInFail({
|
||||||
method: 'oauth',
|
method: 'oauth',
|
||||||
|
|||||||
Reference in New Issue
Block a user