From a0efd206a90f2a54366ab0aa17af023eb72010fc Mon Sep 17 00:00:00 2001 From: qinluhe <108015703+qinluhe@users.noreply.github.com> Date: Thu, 27 Apr 2023 10:53:22 +0800 Subject: [PATCH] fix: modify some eslint rule (#2359) --- frontend/appflowy_tauri/.eslintrc.cjs | 9 ++------- .../components/document/BlockMenu/MenuItem.hooks.ts | 2 +- .../src/appflowy_app/interfaces/document.ts | 3 --- frontend/appflowy_tauri/src/appflowy_app/utils/tool.ts | 3 --- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/frontend/appflowy_tauri/.eslintrc.cjs b/frontend/appflowy_tauri/.eslintrc.cjs index ba23679073..59f19f03f9 100644 --- a/frontend/appflowy_tauri/.eslintrc.cjs +++ b/frontend/appflowy_tauri/.eslintrc.cjs @@ -17,7 +17,7 @@ module.exports = { '@typescript-eslint/adjacent-overload-signatures': 'error', '@typescript-eslint/no-empty-function': 'error', '@typescript-eslint/no-empty-interface': 'warn', - '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-floating-promises': 'warn', '@typescript-eslint/await-thenable': 'error', '@typescript-eslint/no-namespace': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error', @@ -42,18 +42,13 @@ module.exports = { 'no-param-reassign': 'error', 'no-redeclare': 'error', 'no-sequences': 'error', - 'no-shadow': [ - 'error', - { - hoist: 'all', - }, - ], 'no-throw-literal': 'error', 'no-unsafe-finally': 'error', 'no-unused-labels': 'error', 'no-var': 'warn', 'no-void': 'off', 'prefer-const': 'warn', + 'prefer-spread': 'off', }, ignorePatterns: ['src/**/*.test.ts'], }; diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/BlockMenu/MenuItem.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/BlockMenu/MenuItem.hooks.ts index 804a788fc9..359e767da7 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/components/document/BlockMenu/MenuItem.hooks.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/BlockMenu/MenuItem.hooks.ts @@ -2,7 +2,7 @@ import { DocumentControllerContext } from '$app/stores/effects/document/document import { useAppDispatch } from '@/appflowy_app/stores/store'; import { useCallback, useContext } from 'react'; import { insertAfterNodeThunk, deleteNodeThunk } from '@/appflowy_app/stores/reducers/document/async_actions'; -// eslint-disable-next-line no-shadow + export enum ActionType { InsertAfter = 'insertAfter', Remove = 'remove', diff --git a/frontend/appflowy_tauri/src/appflowy_app/interfaces/document.ts b/frontend/appflowy_tauri/src/appflowy_app/interfaces/document.ts index 70b41f1efc..6a81dbb022 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/interfaces/document.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/interfaces/document.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line no-shadow export enum BlockType { PageBlock = 'page', HeadingBlock = 'heading', @@ -38,7 +37,6 @@ export interface TextDelta { attributes?: Record; } -// eslint-disable-next-line no-shadow export enum BlockActionType { Insert = 0, Update = 1, @@ -84,7 +82,6 @@ export interface DocumentState { textSelections: Record; } -// eslint-disable-next-line no-shadow export enum ChangeType { BlockInsert, BlockUpdate, diff --git a/frontend/appflowy_tauri/src/appflowy_app/utils/tool.ts b/frontend/appflowy_tauri/src/appflowy_app/utils/tool.ts index 2886f73da2..92b8eb7ff3 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/utils/tool.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/utils/tool.ts @@ -3,7 +3,6 @@ export function debounce(fn: (...args: any[]) => void, delay: number) { return (...args: any[]) => { clearTimeout(timeout); timeout = setTimeout(() => { - // eslint-disable-next-line prefer-spread fn.apply(undefined, args); }, delay); }; @@ -15,10 +14,8 @@ export function throttle(fn: (...args: any[]) => void, delay: number, immediate if (!timeout) { timeout = setTimeout(() => { timeout = null; - // eslint-disable-next-line prefer-spread !immediate && fn.apply(undefined, args); }, delay); - // eslint-disable-next-line prefer-spread immediate && fn.apply(undefined, args); } };