chore: add noUnusedLocals and noUnusedParameters rules (#3476)

Co-authored-by: LongYinan <lynweklm@gmail.com>
This commit is contained in:
Alex Yang
2023-07-30 22:47:37 -07:00
committed by GitHub
parent 5a8c1dcb57
commit 1d43e46f99
14 changed files with 17 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ const PORT = process.env.PORT || 8080;
app.use('/', express.static('dist'));
app.get('/*', (req, res) => {
app.get('/*', (_, res) => {
res.sendFile('index.html', { root: 'dist' });
});

View File

@@ -93,7 +93,7 @@ export const pageSettingFamily = atomFamily((pageId: string) =>
export const setPageModeAtom = atom(
void 0,
(get, set, pageId: string, mode: PageMode) => {
(_, set, pageId: string, mode: PageMode) => {
set(pageSettingFamily(pageId), { mode });
}
);

View File

@@ -27,7 +27,7 @@ const DetailPageImpl = (): ReactElement => {
const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace;
const collectionManager = useCollectionManager(currentWorkspace.id);
const onLoad = useCallback(
(page: Page, editor: EditorContainer) => {
(_: Page, editor: EditorContainer) => {
const dispose = editor.slots.pageLinkClicked.on(({ pageId }) => {
return openPage(blockSuiteWorkspace.id, pageId);
});

View File

@@ -32,7 +32,7 @@ export default {
framework: {
name: '@storybook/react-vite',
},
async viteFinal(config, { configType }) {
async viteFinal(config, _) {
return mergeConfig(config, {
assetsInclude: ['**/*.md'],
plugins: [

View File

@@ -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 =>

View File

@@ -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> {

View File

@@ -35,7 +35,7 @@ export const getSize = (
};
export const getButtonColors = (
theme: Theme,
_theme: Theme,
type: ButtonProps['type'],
disabled: boolean,
extend?: {

View File

@@ -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);
}

View File

@@ -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,
});

View File

@@ -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') {

View File

@@ -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(

View File

@@ -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;

View File

@@ -132,7 +132,7 @@ const getFollowingUpAtoms = (
const baseAtom = atomWithDefault<Promise<string[]> | string[]>(async () => {
return chatHistory?.getFollowingUp() ?? [];
});
const setAtom = atom<null, [], void>(null, async (get, set) => {
const setAtom = atom<null, [], void>(null, async (_, set) => {
if (!followupLLMChain || !chatHistory) {
throw new Error('followupLLMChain not set');
}

View File

@@ -11,10 +11,10 @@
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
// noPropertyAccessFromIndexSignature: false,
// noUncheckedIndexedAccess: false,
// noUnusedLocals: false,
// noUnusedParameters: false,
"useUnknownInCatchVariables": true,
// Modules