From 9b8acf3efb6bd31571ce8aa35674403992d0a0c5 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 7 Jun 2026 15:46:01 -0400 Subject: [PATCH] Remove unnecessary default parameter values from function signatures (#12617) * Fix remaining no-useless-default-assignment lint warnings * Promote no-useless-default-assignment lint rule to error --- .oxlintrc.json | 1 + app/components/DesktopEventHandler.tsx | 2 +- app/components/FilterOptions.tsx | 2 +- app/components/Sidebar/components/SidebarButton.tsx | 2 +- app/editor/components/EmojiMenu.tsx | 2 +- app/editor/components/SuggestionsMenu.tsx | 2 +- app/scenes/Shared/index.tsx | 2 +- server/commands/documentMover.ts | 2 +- server/presenters/oauthClient.ts | 2 +- server/queues/tasks/ExportDocumentTreeTask.ts | 2 +- server/routes/api/developer/developer.ts | 2 +- 11 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index b1ec802e4e..1fb98f54a6 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -110,6 +110,7 @@ "typescript/consistent-type-imports": "error", "typescript/restrict-template-expressions": "error", "typescript/no-floating-promises": "error", + "typescript/no-useless-default-assignment": "error", "no-unused-vars": [ "error", { diff --git a/app/components/DesktopEventHandler.tsx b/app/components/DesktopEventHandler.tsx index dbfac609b1..28ca23249c 100644 --- a/app/components/DesktopEventHandler.tsx +++ b/app/components/DesktopEventHandler.tsx @@ -15,7 +15,7 @@ export default function DesktopEventHandler() { const hasDisabledUpdateMessage = useRef(false); useEffect(() => { - Desktop.bridge?.redirect((path: string, replace = false) => { + Desktop.bridge?.redirect((path: string, replace: boolean) => { if (replace) { history.replace(path); } else { diff --git a/app/components/FilterOptions.tsx b/app/components/FilterOptions.tsx index 30f1bd293c..59338ec0b7 100644 --- a/app/components/FilterOptions.tsx +++ b/app/components/FilterOptions.tsx @@ -44,7 +44,7 @@ type Props = { const FilterOptions = ({ options, - selectedKeys = [], + selectedKeys, className, onSelect, showFilter, diff --git a/app/components/Sidebar/components/SidebarButton.tsx b/app/components/Sidebar/components/SidebarButton.tsx index 908f818bc7..1bebb27268 100644 --- a/app/components/Sidebar/components/SidebarButton.tsx +++ b/app/components/Sidebar/components/SidebarButton.tsx @@ -23,7 +23,7 @@ const SidebarButton = observer( React.forwardRef( function SidebarButton_( { - position = "top", + position, showMoreMenu, image, title, diff --git a/app/editor/components/EmojiMenu.tsx b/app/editor/components/EmojiMenu.tsx index dae085cbbc..62de2dfd1f 100644 --- a/app/editor/components/EmojiMenu.tsx +++ b/app/editor/components/EmojiMenu.tsx @@ -25,7 +25,7 @@ type Props = Omit< const EmojiMenu = (props: Props) => { const { emojis } = useStores(); - const { search = "" } = props; + const { search } = props; useEffect(() => { if (search) { diff --git a/app/editor/components/SuggestionsMenu.tsx b/app/editor/components/SuggestionsMenu.tsx index ecea2e8da5..d298b2c172 100644 --- a/app/editor/components/SuggestionsMenu.tsx +++ b/app/editor/components/SuggestionsMenu.tsx @@ -400,7 +400,7 @@ function SuggestionsMenu(props: Props) { }; const filtered = React.useMemo(() => { - const { embeds = [], search = "", uploadFile, filterable = true } = props; + const { embeds = [], search, uploadFile, filterable = true } = props; let items: (EmbedDescriptor | MenuItem)[] = [...props.items]; const embedItems: EmbedDescriptor[] = []; diff --git a/app/scenes/Shared/index.tsx b/app/scenes/Shared/index.tsx index 0d72b5171d..dd2531b920 100644 --- a/app/scenes/Shared/index.tsx +++ b/app/scenes/Shared/index.tsx @@ -49,7 +49,7 @@ const canonicalOrigin = canonicalUrl : window.location.origin; type PathParams = { - shareId: string; + shareId?: string; collectionSlug?: string; documentSlug?: string; }; diff --git a/server/commands/documentMover.ts b/server/commands/documentMover.ts index ae13f11ea8..185fc3f7cd 100644 --- a/server/commands/documentMover.ts +++ b/server/commands/documentMover.ts @@ -24,7 +24,7 @@ async function documentMover( ctx: APIContext, { document, - collectionId = null, + collectionId, parentDocumentId = null, // convert undefined to null so parentId comparison treats them as equal index, diff --git a/server/presenters/oauthClient.ts b/server/presenters/oauthClient.ts index 0980d613d8..9c5a359596 100644 --- a/server/presenters/oauthClient.ts +++ b/server/presenters/oauthClient.ts @@ -17,7 +17,7 @@ export function presentDCRClient( baseUrl: string, oauthClient: OAuthClient, { - includeRegistrationAccessToken = false, + includeRegistrationAccessToken, includeCredentials = false, }: { includeRegistrationAccessToken: boolean; diff --git a/server/queues/tasks/ExportDocumentTreeTask.ts b/server/queues/tasks/ExportDocumentTreeTask.ts index f8a6c866a0..59ecd782ef 100644 --- a/server/queues/tasks/ExportDocumentTreeTask.ts +++ b/server/queues/tasks/ExportDocumentTreeTask.ts @@ -26,7 +26,7 @@ export default abstract class ExportDocumentTreeTask extends ExportTask { zip, pathInZip, documentId, - format = FileOperationFormat.MarkdownZip, + format, includeAttachments, pathMap, }: { diff --git a/server/routes/api/developer/developer.ts b/server/routes/api/developer/developer.ts index 0b16c2f96e..6956db0b85 100644 --- a/server/routes/api/developer/developer.ts +++ b/server/routes/api/developer/developer.ts @@ -29,7 +29,7 @@ router.post( auth(), validate(T.CreateTestUsersSchema), async (ctx: APIContext) => { - const { count = 10 } = ctx.input.body; + const { count } = ctx.input.body; const invites = Array(Math.min(count, 100)) .fill(0) .map(() => {