diff --git a/docs/CLI_FLAGS.md b/docs/CLI_FLAGS.md index b6e7b9f52..c1c79a3d2 100644 --- a/docs/CLI_FLAGS.md +++ b/docs/CLI_FLAGS.md @@ -1,32 +1,34 @@ # CLI Options Options: -| Flag | Effect | -|------|--------| -|`--minimized` | Start deltachat in minimized mode with trayicon (trayicon will be activated for this session regardless whether it's disabled) | -| **Development Options** | | -| `--translation-watch` | enable auto-reload for `_locales/_untranslated_en.json`, when that file changes the current language is reloaded | -| `--devmode` | opens electron devtools and activates `--log-debug` & `--log-to-console` | -| `--allow-unsafe-core-replacement` | allow changing core with `DELTA_CHAT_RPC_SERVER` and looking for it in `PATH` instead of forcing the use of the prebuilds | -| **Theme** | | -| `--theme ` | set a specific theme (see [THEMES.md](./THEMES.md)) | -| `--theme-watch` | enable auto-reload for the active theme | -| **Logging** | | -| `--log-debug` | Log debug messages | -| `--log-to-console` | Output the log to stdout / Chrome dev console | -| `--machine-readable-stacktrace` | Enable JSON stack trace | -| `--no-color` | Disable colors in the output of main process | + +| Flag | Effect | +| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| `--minimized` | Start deltachat in minimized mode with trayicon (trayicon will be activated for this session regardless whether it's disabled) | +| **Development Options** | | +| `--translation-watch` | enable auto-reload for `_locales/_untranslated_en.json`, when that file changes the current language is reloaded | +| `--devmode` | opens electron devtools and activates `--log-debug` & `--log-to-console` | +| `--allow-unsafe-core-replacement` | allow changing core with `DELTA_CHAT_RPC_SERVER` and looking for it in `PATH` instead of forcing the use of the prebuilds | +| **Theme** | | +| `--theme ` | set a specific theme (see [THEMES.md](./THEMES.md)) | +| `--theme-watch` | enable auto-reload for the active theme | +| **Logging** | | +| `--log-debug` | Log debug messages | +| `--log-to-console` | Output the log to stdout / Chrome dev console | +| `--machine-readable-stacktrace` | Enable JSON stack trace | +| `--no-color` | Disable colors in the output of main process | For more info on logging see [LOGGING.md](./LOGGING.md). ## Env vars useful env vars you can set: -| Variable (sometimes with value) | Effect | -|---------------------------------|--------| -|`NODE_OPTIONS=--enable-source-maps`| Make stacktraces in errors useful by enabling source map support in the main process | -|`DC_TEST_DIR=`| specify an alternative data directory | -| `DELTACHAT_LOCALE_DIR=` | allows to specify an alternative translation data directory in development, the intended purpose is to be used together with `--translation-watch` [^1] | + +| Variable (sometimes with value) | Effect | +| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `NODE_OPTIONS=--enable-source-maps` | Make stacktraces in errors useful by enabling source map support in the main process | +| `DC_TEST_DIR=` | specify an alternative data directory | +| `DELTACHAT_LOCALE_DIR=` | allows to specify an alternative translation data directory in development, the intended purpose is to be used together with `--translation-watch` [^1] | Most env vars can be set in .env files, read by dotenv. Look fo a env.example in the related package for more info. diff --git a/docs/LOGGING.md b/docs/LOGGING.md index e5703179d..e441e20a5 100644 --- a/docs/LOGGING.md +++ b/docs/LOGGING.md @@ -12,7 +12,7 @@ Debug messages are disabled by default, enable them with the `--log-debug` flag. | `--no-color` | Disable colors in the output of main process | > as of 1.21.0 `--devmode` enables both `--log-debug` and `--log-to-console` (formerly `--debug`) -> ~as of 1.3.0 `--debug` enables both `--log-debug` and `--log-to-console`~ +> ~~as of 1.3.0 `--debug` enables both `--log-debug` and `--log-to-console`~~ #### Log locations diff --git a/eslint.config.js b/eslint.config.js index 2981ca55e..aad939cb1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -34,7 +34,8 @@ export default defineConfig( 'react-hooks': pluginReactHooks, }, rules: { - ...pluginReactHooks.configs.recommended.rules, + 'react-hooks/rules-of-hooks': 'error', + 'react-hooks/exhaustive-deps': 'warn', }, }, { diff --git a/packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx b/packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx index 8e0091719..425819eac 100644 --- a/packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx +++ b/packages/frontend/src/components/AudioRecorder/AudioRecorder.tsx @@ -10,8 +10,8 @@ import { getLogger } from '@deltachat-desktop/shared/logger' const log = getLogger('renderer/AudioRecorder') export enum AudioErrorType { - 'NO_INPUT', - 'OTHER_ERROR', + NO_INPUT, + OTHER_ERROR, } export class AudioRecorderError extends Error { @@ -105,7 +105,7 @@ export const AudioRecorder = ({ }, [openDialog, tx]) const onRecordingStart = async () => { - let access = 'unknown' + let access: string try { access = await runtime.checkMediaAccess('microphone') log.debug('checkMediaAccess', { access }) diff --git a/packages/frontend/src/components/Reactions/index.tsx b/packages/frontend/src/components/Reactions/index.tsx index 0b6886d0a..b18e4911b 100644 --- a/packages/frontend/src/components/Reactions/index.tsx +++ b/packages/frontend/src/components/Reactions/index.tsx @@ -31,7 +31,7 @@ export default function Reactions(props: Props) { const { reactionsByContact, reactions } = props.reactions useEffect(() => { - let emojiSpaces = 0 + let emojiSpaces: number if (messageWidth <= 234) { emojiSpaces = 1 } else { diff --git a/packages/frontend/src/components/dialogs/FullscreenMedia.tsx b/packages/frontend/src/components/dialogs/FullscreenMedia.tsx index 00a0e5492..138589614 100644 --- a/packages/frontend/src/components/dialogs/FullscreenMedia.tsx +++ b/packages/frontend/src/components/dialogs/FullscreenMedia.tsx @@ -127,7 +127,7 @@ export default function FullscreenMedia(props: Props & DialogProps) { }, ]) - let elm = null + let elm: React.ReactNode if (isImage(fileMime)) { const imageHeight = diff --git a/packages/frontend/src/components/dialogs/ViewProfile/index.tsx b/packages/frontend/src/components/dialogs/ViewProfile/index.tsx index 926532288..31a9928c6 100644 --- a/packages/frontend/src/components/dialogs/ViewProfile/index.tsx +++ b/packages/frontend/src/components/dialogs/ViewProfile/index.tsx @@ -36,7 +36,7 @@ const log = getLogger('renderer/dialogs/ViewProfile') function LastSeen({ timestamp }: { timestamp: number }) { const tx = useTranslationFunction() - let lastSeenString = '' + let lastSeenString: string let lastSeenAbsolute: string | undefined = undefined // Dates from 1970 mean that contact has never been seen diff --git a/packages/frontend/src/components/message/Message.tsx b/packages/frontend/src/components/message/Message.tsx index 1dc53b3a0..76d18ab90 100644 --- a/packages/frontend/src/components/message/Message.tsx +++ b/packages/frontend/src/components/message/Message.tsx @@ -674,7 +674,7 @@ async function fetchPrivittyBubbleState( } const filePath = normalizePrivittyFilePath(file) - let status: PrivittyStatus = 'none' + let status: PrivittyStatus let expiryTime: number | null = null let waitingCount = 0 let isPrivittyForwarded = false @@ -1184,7 +1184,7 @@ export default function Message(props: { useEffect(() => { const resizeHandler = () => { if (messageContainerRef.current) { - let messageWidth = 0 + let messageWidth: number // set message width which is used by reaction component // to adapt the number of visible reactions if (fileMime || window.innerWidth < 900) { @@ -1297,8 +1297,6 @@ export default function Message(props: { openViewProfileDialog(accountId, contact.id) } - let onClickMessageBody - // Check if the message is saved or has a saved message // in both cases we display the bookmark icon const isOrHasSavedMessage = message.originalMsgId @@ -1605,13 +1603,7 @@ export default function Message(props: { )} {/*

Document File

*/} -
+
{message.quote !== null && ( { if (processingRef.current) return - let text = '' + let text: string try { text = await navigator.clipboard.readText() } catch { diff --git a/packages/frontend/src/hooks/chat/useMessage.ts b/packages/frontend/src/hooks/chat/useMessage.ts index 32322511d..7a8600494 100644 --- a/packages/frontend/src/hooks/chat/useMessage.ts +++ b/packages/frontend/src/hooks/chat/useMessage.ts @@ -143,7 +143,7 @@ export default function useMessage() { message: Partial ) => { log.debug('filePathName', message) - let msgId = 0 + let msgId: number if (message.file && message.filename) { msgId = await BackendRemote.rpc.sendMsg(accountId, chatId, { ...MESSAGE_DEFAULT, diff --git a/packages/frontend/src/stores/messagelist.ts b/packages/frontend/src/stores/messagelist.ts index de48bd0f4..43ce1f917 100644 --- a/packages/frontend/src/stores/messagelist.ts +++ b/packages/frontend/src/stores/messagelist.ts @@ -707,7 +707,7 @@ class MessageListStore extends Store { false, true ) - let indexEnd = -1 + let indexEnd: number const last_item: Type.MessageListItem | undefined = this.state.messageListItems[this.state.messageListItems.length - 1] @@ -883,9 +883,9 @@ class MessageListStore extends Store { // However, let's keep the code that supports arbitrary chatId, // which can be "enabled" by setting `chatIdPreset = undefined`. const chatIdPreset: number | undefined = this.chatId - let chatId: number | undefined = undefined + let chatId: number | undefined - let jumpToMessageStack: number[] = [] + let jumpToMessageStack: number[] if (jumpToMessageId === undefined) { // jump down const jumpToMessageStackLength = this.state.jumpToMessageStack.length diff --git a/packages/shared/localize.ts b/packages/shared/localize.ts index a7b8ac037..0f10b9b85 100644 --- a/packages/shared/localize.ts +++ b/packages/shared/localize.ts @@ -51,7 +51,7 @@ export function translate( raw_opts?: 'other' | getMessageOptions ) { const translationKey = key as string - let opts: getMessageOptions = {} + let opts: getMessageOptions if (typeof raw_opts === 'string') opts = { quantity: raw_opts } else opts = Object.assign({}, raw_opts) diff --git a/packages/target-browser/package.json b/packages/target-browser/package.json index 9f7ba7e9a..067f24647 100644 --- a/packages/target-browser/package.json +++ b/packages/target-browser/package.json @@ -2,7 +2,7 @@ "private": true, "name": "@deltachat-desktop/target-browser", "type": "module", - "version": "1.6.0", + "version": "1.7.0", "license": "GPL-3.0-or-later", "scripts": { "check:types": "tsc --noEmit && tsc --noEmit -p runtime-browser", diff --git a/packages/target-browser/runtime-browser/runtime.ts b/packages/target-browser/runtime-browser/runtime.ts index 0bb44a575..85014c30c 100644 --- a/packages/target-browser/runtime-browser/runtime.ts +++ b/packages/target-browser/runtime-browser/runtime.ts @@ -290,7 +290,8 @@ class BrowserRuntime implements Runtime { ).json() } else { throw new Error( - 'language load failed, even alternative of base language failed.' + 'language load failed, even alternative of base language failed.', + { cause: error1 } ) } } catch (error2) { @@ -299,7 +300,6 @@ class BrowserRuntime implements Runtime { error1, error2 ) - locale = 'en' localeMessages = messagesEnglish } } diff --git a/packages/target-browser/src/index.ts b/packages/target-browser/src/index.ts index c5954a1ab..f95ff00ba 100644 --- a/packages/target-browser/src/index.ts +++ b/packages/target-browser/src/index.ts @@ -191,14 +191,14 @@ app.get('/themes.json', async (_req, res) => { res.json(await readThemeDir()) }) -let certificate = '' +let certificate: string if (process.env.PRIVATE_CERTIFICATE_CERT) { certificate = process.env.PRIVATE_CERTIFICATE_CERT } else { certificate = await readFile(PRIVATE_CERTIFICATE_CERT, 'utf8') } -let certificateKey = '' +let certificateKey: string if (process.env.PRIVATE_CERTIFICATE_KEY) { certificateKey = process.env.PRIVATE_CERTIFICATE_KEY } else { diff --git a/packages/target-electron/src/themes.ts b/packages/target-electron/src/themes.ts index 412d02923..ea446e74b 100644 --- a/packages/target-electron/src/themes.ts +++ b/packages/target-electron/src/themes.ts @@ -91,7 +91,7 @@ function systemDefault() { export function resolveThemeAddress(address: string): string { const addressParts = address != 'system' ? address.split(':') : systemDefault() - let realPath = '' + let realPath: string if (addressParts.length != 2) throw 'not an theme address, must have the format [location]:[themename]' if (addressParts[0] == 'dc') { @@ -127,7 +127,8 @@ If you did not specify this, ask the person which installed deltachat for you to If they are not available find the shortcut/.desktop file yourself and edit it to not contain the "--theme" argument. Using --theme is for developers and theme creators ONLY and should not be used by normal users -If you have question or need help, feel free to ask in our forum https://support.delta.chat.` +If you have question or need help, feel free to ask in our forum https://support.delta.chat.`, + { cause: error } ) } DesktopSettings.update({ activeTheme: app.rc['theme'] }) diff --git a/packages/target-tauri/src-tauri/Cargo.toml b/packages/target-tauri/src-tauri/Cargo.toml index 24ab4e09c..074690df8 100644 --- a/packages/target-tauri/src-tauri/Cargo.toml +++ b/packages/target-tauri/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat-tauri" -version = "1.6.0" +version = "1.7.0" description = "Privitty Chat Desktop: Tauri Edition. Secure, cross-platform, decentralized super-app messenger." authors = ["DeltaChat Contributors"] edition = "2021"