mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
chore: add noUnusedLocals and noUnusedParameters rules (#3476)
Co-authored-by: LongYinan <lynweklm@gmail.com>
This commit is contained in:
@@ -6,7 +6,7 @@ const PORT = process.env.PORT || 8080;
|
|||||||
|
|
||||||
app.use('/', express.static('dist'));
|
app.use('/', express.static('dist'));
|
||||||
|
|
||||||
app.get('/*', (req, res) => {
|
app.get('/*', (_, res) => {
|
||||||
res.sendFile('index.html', { root: 'dist' });
|
res.sendFile('index.html', { root: 'dist' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export const pageSettingFamily = atomFamily((pageId: string) =>
|
|||||||
|
|
||||||
export const setPageModeAtom = atom(
|
export const setPageModeAtom = atom(
|
||||||
void 0,
|
void 0,
|
||||||
(get, set, pageId: string, mode: PageMode) => {
|
(_, set, pageId: string, mode: PageMode) => {
|
||||||
set(pageSettingFamily(pageId), { mode });
|
set(pageSettingFamily(pageId), { mode });
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const DetailPageImpl = (): ReactElement => {
|
|||||||
const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace;
|
const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace;
|
||||||
const collectionManager = useCollectionManager(currentWorkspace.id);
|
const collectionManager = useCollectionManager(currentWorkspace.id);
|
||||||
const onLoad = useCallback(
|
const onLoad = useCallback(
|
||||||
(page: Page, editor: EditorContainer) => {
|
(_: Page, editor: EditorContainer) => {
|
||||||
const dispose = editor.slots.pageLinkClicked.on(({ pageId }) => {
|
const dispose = editor.slots.pageLinkClicked.on(({ pageId }) => {
|
||||||
return openPage(blockSuiteWorkspace.id, pageId);
|
return openPage(blockSuiteWorkspace.id, pageId);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default {
|
|||||||
framework: {
|
framework: {
|
||||||
name: '@storybook/react-vite',
|
name: '@storybook/react-vite',
|
||||||
},
|
},
|
||||||
async viteFinal(config, { configType }) {
|
async viteFinal(config, _) {
|
||||||
return mergeConfig(config, {
|
return mergeConfig(config, {
|
||||||
assetsInclude: ['**/*.md'],
|
assetsInclude: ['**/*.md'],
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const notificationsAtom = atom<Notification[]>(get =>
|
|||||||
get(notificationsBaseAtom)
|
get(notificationsBaseAtom)
|
||||||
);
|
);
|
||||||
|
|
||||||
export const removeNotificationAtom = atom(null, (get, set, key: string) => {
|
export const removeNotificationAtom = atom(null, (_, set, key: string) => {
|
||||||
set(notificationsBaseAtom, notifications =>
|
set(notificationsBaseAtom, notifications =>
|
||||||
notifications.filter(notification => notification.key !== key)
|
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>(
|
export const pushNotificationAtom = atom<null, [Notification], void>(
|
||||||
null,
|
null,
|
||||||
(get, set, newNotification) => {
|
(_, set, newNotification) => {
|
||||||
const key = newNotification.key;
|
const key = newNotification.key;
|
||||||
const removeNotification = () =>
|
const removeNotification = () =>
|
||||||
set(notificationsBaseAtom, notifications =>
|
set(notificationsBaseAtom, notifications =>
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ export class DataDefine<Data extends DataTypeShape = Record<string, unknown>> {
|
|||||||
interface DataDefineConfig<T extends DataTypeShape> {
|
interface DataDefineConfig<T extends DataTypeShape> {
|
||||||
name: string;
|
name: string;
|
||||||
supers: DataDefine[];
|
supers: DataDefine[];
|
||||||
|
_phantom?: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DataHelper<T extends DataTypeShape> {
|
interface DataHelper<T extends DataTypeShape> {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const getSize = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getButtonColors = (
|
export const getButtonColors = (
|
||||||
theme: Theme,
|
_theme: Theme,
|
||||||
type: ButtonProps['type'],
|
type: ButtonProps['type'],
|
||||||
disabled: boolean,
|
disabled: boolean,
|
||||||
extend?: {
|
extend?: {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export function useBlockSuiteWorkspaceName(blockSuiteWorkspace: Workspace) {
|
|||||||
);
|
);
|
||||||
const writableAtom = atom(
|
const writableAtom = atom(
|
||||||
get => get(baseAtom),
|
get => get(baseAtom),
|
||||||
(get, set, name: string) => {
|
(_, set, name: string) => {
|
||||||
blockSuiteWorkspace.meta.setName(name);
|
blockSuiteWorkspace.meta.setName(name);
|
||||||
set(baseAtom, name);
|
set(baseAtom, name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export function useBlockSuiteWorkspacePageIsPublic(page: Page) {
|
|||||||
const baseAtom = atom<boolean>(page.meta.isPublic ?? false);
|
const baseAtom = atom<boolean>(page.meta.isPublic ?? false);
|
||||||
const writableAtom = atom(
|
const writableAtom = atom(
|
||||||
get => get(baseAtom),
|
get => get(baseAtom),
|
||||||
(get, set, isPublic: boolean) => {
|
(_, set, isPublic: boolean) => {
|
||||||
page.workspace.setPageMeta(page.id, {
|
page.workspace.setPageMeta(page.id, {
|
||||||
isPublic,
|
isPublic,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export const contentLayoutAtom = atom<
|
|||||||
void
|
void
|
||||||
>(
|
>(
|
||||||
get => get(contentLayoutBaseAtom),
|
get => get(contentLayoutBaseAtom),
|
||||||
(get, set, layout) => {
|
(_, set, layout) => {
|
||||||
set(contentLayoutBaseAtom, prev => {
|
set(contentLayoutBaseAtom, prev => {
|
||||||
let setV: (prev: ExpectedLayout) => ExpectedLayout;
|
let setV: (prev: ExpectedLayout) => ExpectedLayout;
|
||||||
if (typeof layout !== 'function') {
|
if (typeof layout !== 'function') {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ type SubdocEvent = {
|
|||||||
const docUpdateCallbackWeakMap = new WeakMap<Doc, UpdateCallback>();
|
const docUpdateCallbackWeakMap = new WeakMap<Doc, UpdateCallback>();
|
||||||
|
|
||||||
const createMonitor = (doc: Doc) => {
|
const createMonitor = (doc: Doc) => {
|
||||||
const onUpdate: UpdateCallback = (update, origin) => {
|
const onUpdate: UpdateCallback = (_, origin) => {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
if (typeof origin !== 'string' && typeof origin !== 'number') {
|
if (typeof origin !== 'string' && typeof origin !== 'number') {
|
||||||
console.warn(
|
console.warn(
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ const mockedAddBlob = vi.fn();
|
|||||||
vi.stubGlobal('window', {
|
vi.stubGlobal('window', {
|
||||||
apis: {
|
apis: {
|
||||||
db: {
|
db: {
|
||||||
getDocAsUpdates: async (workspaceId, guid) => {
|
getDocAsUpdates: async (_, guid) => {
|
||||||
const subdoc = guid ? getDoc(offlineYdoc, guid) : offlineYdoc;
|
const subdoc = guid ? getDoc(offlineYdoc, guid) : offlineYdoc;
|
||||||
if (!subdoc) {
|
if (!subdoc) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Y.encodeStateAsUpdate(subdoc);
|
return Y.encodeStateAsUpdate(subdoc);
|
||||||
},
|
},
|
||||||
applyDocUpdate: async (id, update, subdocId) => {
|
applyDocUpdate: async (_, update, subdocId) => {
|
||||||
const subdoc = subdocId ? getDoc(offlineYdoc, subdocId) : offlineYdoc;
|
const subdoc = subdocId ? getDoc(offlineYdoc, subdocId) : offlineYdoc;
|
||||||
if (!subdoc) {
|
if (!subdoc) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ const getFollowingUpAtoms = (
|
|||||||
const baseAtom = atomWithDefault<Promise<string[]> | string[]>(async () => {
|
const baseAtom = atomWithDefault<Promise<string[]> | string[]>(async () => {
|
||||||
return chatHistory?.getFollowingUp() ?? [];
|
return chatHistory?.getFollowingUp() ?? [];
|
||||||
});
|
});
|
||||||
const setAtom = atom<null, [], void>(null, async (get, set) => {
|
const setAtom = atom<null, [], void>(null, async (_, set) => {
|
||||||
if (!followupLLMChain || !chatHistory) {
|
if (!followupLLMChain || !chatHistory) {
|
||||||
throw new Error('followupLLMChain not set');
|
throw new Error('followupLLMChain not set');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noImplicitThis": true,
|
"noImplicitThis": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
// noPropertyAccessFromIndexSignature: false,
|
// noPropertyAccessFromIndexSignature: false,
|
||||||
// noUncheckedIndexedAccess: false,
|
// noUncheckedIndexedAccess: false,
|
||||||
// noUnusedLocals: false,
|
|
||||||
// noUnusedParameters: false,
|
|
||||||
"useUnknownInCatchVariables": true,
|
"useUnknownInCatchVariables": true,
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
|
|||||||
Reference in New Issue
Block a user