fix: modify some eslint rule (#2359)

This commit is contained in:
qinluhe 2023-04-27 10:53:22 +08:00 committed by GitHub
parent 9717dfa3c4
commit a0efd206a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 14 deletions

View File

@ -17,7 +17,7 @@ module.exports = {
'@typescript-eslint/adjacent-overload-signatures': 'error', '@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/no-empty-function': 'error', '@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-empty-interface': 'warn', '@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/await-thenable': 'error',
'@typescript-eslint/no-namespace': 'error', '@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error',
@ -42,18 +42,13 @@ module.exports = {
'no-param-reassign': 'error', 'no-param-reassign': 'error',
'no-redeclare': 'error', 'no-redeclare': 'error',
'no-sequences': 'error', 'no-sequences': 'error',
'no-shadow': [
'error',
{
hoist: 'all',
},
],
'no-throw-literal': 'error', 'no-throw-literal': 'error',
'no-unsafe-finally': 'error', 'no-unsafe-finally': 'error',
'no-unused-labels': 'error', 'no-unused-labels': 'error',
'no-var': 'warn', 'no-var': 'warn',
'no-void': 'off', 'no-void': 'off',
'prefer-const': 'warn', 'prefer-const': 'warn',
'prefer-spread': 'off',
}, },
ignorePatterns: ['src/**/*.test.ts'], ignorePatterns: ['src/**/*.test.ts'],
}; };

View File

@ -2,7 +2,7 @@ import { DocumentControllerContext } from '$app/stores/effects/document/document
import { useAppDispatch } from '@/appflowy_app/stores/store'; import { useAppDispatch } from '@/appflowy_app/stores/store';
import { useCallback, useContext } from 'react'; import { useCallback, useContext } from 'react';
import { insertAfterNodeThunk, deleteNodeThunk } from '@/appflowy_app/stores/reducers/document/async_actions'; import { insertAfterNodeThunk, deleteNodeThunk } from '@/appflowy_app/stores/reducers/document/async_actions';
// eslint-disable-next-line no-shadow
export enum ActionType { export enum ActionType {
InsertAfter = 'insertAfter', InsertAfter = 'insertAfter',
Remove = 'remove', Remove = 'remove',

View File

@ -1,4 +1,3 @@
// eslint-disable-next-line no-shadow
export enum BlockType { export enum BlockType {
PageBlock = 'page', PageBlock = 'page',
HeadingBlock = 'heading', HeadingBlock = 'heading',
@ -38,7 +37,6 @@ export interface TextDelta {
attributes?: Record<string, string | boolean>; attributes?: Record<string, string | boolean>;
} }
// eslint-disable-next-line no-shadow
export enum BlockActionType { export enum BlockActionType {
Insert = 0, Insert = 0,
Update = 1, Update = 1,
@ -84,7 +82,6 @@ export interface DocumentState {
textSelections: Record<string, TextSelection>; textSelections: Record<string, TextSelection>;
} }
// eslint-disable-next-line no-shadow
export enum ChangeType { export enum ChangeType {
BlockInsert, BlockInsert,
BlockUpdate, BlockUpdate,

View File

@ -3,7 +3,6 @@ export function debounce(fn: (...args: any[]) => void, delay: number) {
return (...args: any[]) => { return (...args: any[]) => {
clearTimeout(timeout); clearTimeout(timeout);
timeout = setTimeout(() => { timeout = setTimeout(() => {
// eslint-disable-next-line prefer-spread
fn.apply(undefined, args); fn.apply(undefined, args);
}, delay); }, delay);
}; };
@ -15,10 +14,8 @@ export function throttle(fn: (...args: any[]) => void, delay: number, immediate
if (!timeout) { if (!timeout) {
timeout = setTimeout(() => { timeout = setTimeout(() => {
timeout = null; timeout = null;
// eslint-disable-next-line prefer-spread
!immediate && fn.apply(undefined, args); !immediate && fn.apply(undefined, args);
}, delay); }, delay);
// eslint-disable-next-line prefer-spread
immediate && fn.apply(undefined, args); immediate && fn.apply(undefined, args);
} }
}; };