mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-03 18:40:00 +08:00
chore: add noUnusedLocals and noUnusedParameters rules (#3476)
Co-authored-by: LongYinan <lynweklm@gmail.com>
This commit is contained in:
@@ -32,7 +32,7 @@ export const notificationsAtom = atom<Notification[]>(get =>
|
||||
get(notificationsBaseAtom)
|
||||
);
|
||||
|
||||
export const removeNotificationAtom = atom(null, (get, set, key: string) => {
|
||||
export const removeNotificationAtom = atom(null, (_, set, key: string) => {
|
||||
set(notificationsBaseAtom, notifications =>
|
||||
notifications.filter(notification => notification.key !== key)
|
||||
);
|
||||
@@ -40,7 +40,7 @@ export const removeNotificationAtom = atom(null, (get, set, key: string) => {
|
||||
|
||||
export const pushNotificationAtom = atom<null, [Notification], void>(
|
||||
null,
|
||||
(get, set, newNotification) => {
|
||||
(_, set, newNotification) => {
|
||||
const key = newNotification.key;
|
||||
const removeNotification = () =>
|
||||
set(notificationsBaseAtom, notifications =>
|
||||
|
||||
@@ -145,6 +145,7 @@ export class DataDefine<Data extends DataTypeShape = Record<string, unknown>> {
|
||||
interface DataDefineConfig<T extends DataTypeShape> {
|
||||
name: string;
|
||||
supers: DataDefine[];
|
||||
_phantom?: T;
|
||||
}
|
||||
|
||||
interface DataHelper<T extends DataTypeShape> {
|
||||
|
||||
@@ -35,7 +35,7 @@ export const getSize = (
|
||||
};
|
||||
|
||||
export const getButtonColors = (
|
||||
theme: Theme,
|
||||
_theme: Theme,
|
||||
type: ButtonProps['type'],
|
||||
disabled: boolean,
|
||||
extend?: {
|
||||
|
||||
@@ -15,7 +15,7 @@ export function useBlockSuiteWorkspaceName(blockSuiteWorkspace: Workspace) {
|
||||
);
|
||||
const writableAtom = atom(
|
||||
get => get(baseAtom),
|
||||
(get, set, name: string) => {
|
||||
(_, set, name: string) => {
|
||||
blockSuiteWorkspace.meta.setName(name);
|
||||
set(baseAtom, name);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export function useBlockSuiteWorkspacePageIsPublic(page: Page) {
|
||||
const baseAtom = atom<boolean>(page.meta.isPublic ?? false);
|
||||
const writableAtom = atom(
|
||||
get => get(baseAtom),
|
||||
(get, set, isPublic: boolean) => {
|
||||
(_, set, isPublic: boolean) => {
|
||||
page.workspace.setPageMeta(page.id, {
|
||||
isPublic,
|
||||
});
|
||||
|
||||
@@ -56,7 +56,7 @@ export const contentLayoutAtom = atom<
|
||||
void
|
||||
>(
|
||||
get => get(contentLayoutBaseAtom),
|
||||
(get, set, layout) => {
|
||||
(_, set, layout) => {
|
||||
set(contentLayoutBaseAtom, prev => {
|
||||
let setV: (prev: ExpectedLayout) => ExpectedLayout;
|
||||
if (typeof layout !== 'function') {
|
||||
|
||||
@@ -45,7 +45,7 @@ type SubdocEvent = {
|
||||
const docUpdateCallbackWeakMap = new WeakMap<Doc, UpdateCallback>();
|
||||
|
||||
const createMonitor = (doc: Doc) => {
|
||||
const onUpdate: UpdateCallback = (update, origin) => {
|
||||
const onUpdate: UpdateCallback = (_, origin) => {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (typeof origin !== 'string' && typeof origin !== 'number') {
|
||||
console.warn(
|
||||
|
||||
@@ -32,14 +32,14 @@ const mockedAddBlob = vi.fn();
|
||||
vi.stubGlobal('window', {
|
||||
apis: {
|
||||
db: {
|
||||
getDocAsUpdates: async (workspaceId, guid) => {
|
||||
getDocAsUpdates: async (_, guid) => {
|
||||
const subdoc = guid ? getDoc(offlineYdoc, guid) : offlineYdoc;
|
||||
if (!subdoc) {
|
||||
return false;
|
||||
}
|
||||
return Y.encodeStateAsUpdate(subdoc);
|
||||
},
|
||||
applyDocUpdate: async (id, update, subdocId) => {
|
||||
applyDocUpdate: async (_, update, subdocId) => {
|
||||
const subdoc = subdocId ? getDoc(offlineYdoc, subdocId) : offlineYdoc;
|
||||
if (!subdoc) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user