diff --git a/eslint.config.mjs b/eslint.config.mjs index d207295d30..42d904ed9d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -180,34 +180,16 @@ export default tseslint.config( {prefer: 'type-imports', fixStyle: 'inline-type-imports'}, ], '@typescript-eslint/no-require-imports': 'off', - // Maintain previous behavior - these are stricter in typescript-eslint v8 + // Keep disabled - too many violations to fix now '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-empty-object-type': 'off', - '@typescript-eslint/no-unused-expressions': 'off', - '@typescript-eslint/no-non-null-asserted-optional-chain': 'off', - '@typescript-eslint/no-wrapper-object-types': 'off', - '@typescript-eslint/no-unsafe-function-type': 'off', // Import rules 'import-x/consistent-type-specifier-style': ['warn', 'prefer-inline'], - // Turn off rules that weren't enforced in previous config + // Keep disabled - many are intentional empty destructuring patterns 'no-empty-pattern': 'off', - 'no-async-promise-executor': 'off', - 'no-constant-binary-expression': 'warn', - 'prefer-const': 'off', - 'no-empty': 'off', - 'no-unsafe-optional-chaining': 'off', - 'no-prototype-builtins': 'off', - 'no-var': 'off', - 'prefer-rest-params': 'off', - 'no-case-declarations': 'off', - 'no-irregular-whitespace': 'off', - 'no-useless-escape': 'off', - 'no-sparse-arrays': 'off', - 'no-fallthrough': 'off', - 'no-control-regex': 'off', }, }, diff --git a/src/ageAssurance/data.tsx b/src/ageAssurance/data.tsx index f6353a899b..432ea84913 100644 --- a/src/ageAssurance/data.tsx +++ b/src/ageAssurance/data.tsx @@ -111,13 +111,12 @@ export async function prefetchConfig() { return } - configPrefetchPromise = new Promise(async resolve => { + configPrefetchPromise = (async () => { await cacheHydrationPromise const cached = getConfigFromCache() if (cached) { logger.debug(`prefetchAgeAssuranceConfig: using cache`) - resolve() } else { try { logger.debug(`prefetchAgeAssuranceConfig: resolving...`) @@ -130,11 +129,9 @@ export async function prefetchConfig() { logger.warn(`prefetchAgeAssuranceConfig: failed`, { safeMessage: e.message, }) - } finally { - resolve() } } - }) + })() } export async function refetchConfig() { logger.debug(`refetchConfig: fetching...`) diff --git a/src/ageAssurance/debug.ts b/src/ageAssurance/debug.ts index 8a97cf84ee..bf592a8afa 100644 --- a/src/ageAssurance/debug.ts +++ b/src/ageAssurance/debug.ts @@ -8,6 +8,7 @@ import {type OtherRequiredData} from '#/ageAssurance/data' import {IS_DEV, IS_E2E} from '#/env' import {type Geolocation} from '#/geolocation' +// eslint-disable-next-line no-constant-binary-expression -- intentional debug toggle export const enabled = (IS_DEV && false) || IS_E2E export const geolocation: Geolocation | undefined = enabled diff --git a/src/components/Dialog/index.web.tsx b/src/components/Dialog/index.web.tsx index cf250faf79..f524fd25a9 100644 --- a/src/components/Dialog/index.web.tsx +++ b/src/components/Dialog/index.web.tsx @@ -81,7 +81,11 @@ export function Outer({ const handleBackgroundPress = React.useCallback( async (e: GestureResponderEvent) => { - webOptions?.onBackgroundPress ? webOptions.onBackgroundPress(e) : close() + if (webOptions?.onBackgroundPress) { + webOptions.onBackgroundPress(e) + } else { + close() + } }, [webOptions, close], ) diff --git a/src/components/ProgressGuide/FollowDialog.tsx b/src/components/ProgressGuide/FollowDialog.tsx index ca91665e94..99d2c9979d 100644 --- a/src/components/ProgressGuide/FollowDialog.tsx +++ b/src/components/ProgressGuide/FollowDialog.tsx @@ -167,7 +167,7 @@ function DialogInner({guide}: {guide?: Follow10ProgressGuide}) { const results = hasSearchText ? searchResults?.pages.flatMap(p => p.actors) : suggestions?.actors - let _items: Item[] = [] + const _items: Item[] = [] if (isFetchingSuggestions || isFetchingSearchResults) { const placeholders: Item[] = Array(10) diff --git a/src/components/Tooltip/index.tsx b/src/components/Tooltip/index.tsx index e916ee0ed3..7c25e7c29e 100644 --- a/src/components/Tooltip/index.tsx +++ b/src/components/Tooltip/index.tsx @@ -286,7 +286,7 @@ function Bubble({ left -= left + cw - maxLeft } - let tipLeft = + const tipLeft = targetMeasurements.x - left + targetMeasurements.width / 2 - diff --git a/src/components/contacts/screens/GetContacts.tsx b/src/components/contacts/screens/GetContacts.tsx index 5df967a8a5..00fe63ad9d 100644 --- a/src/components/contacts/screens/GetContacts.tsx +++ b/src/components/contacts/screens/GetContacts.tsx @@ -334,7 +334,7 @@ async function createProfileRecord( imageUri && imageMime ? uploadBlob(agent, imageUri, imageMime) : undefined await agent.upsertProfile(async existing => { - let next: Un$Typed = existing ?? {} + const next: Un$Typed = existing ?? {} if (blobPromise) { const res = await blobPromise diff --git a/src/components/dialogs/EmailDialog/screens/Update.tsx b/src/components/dialogs/EmailDialog/screens/Update.tsx index f92e764767..c17c4bc60e 100644 --- a/src/components/dialogs/EmailDialog/screens/Update.tsx +++ b/src/components/dialogs/EmailDialog/screens/Update.tsx @@ -185,7 +185,9 @@ export function Update(_props: ScreenProps) { try { // fire off a confirmation email immediately await requestEmailVerification() - } catch {} + } catch { + // no-op + } } } catch (e) { logger.error('EmailDialog: update email failed', {safeMessage: e}) diff --git a/src/components/live/EditLiveDialog.tsx b/src/components/live/EditLiveDialog.tsx index 3304bceb61..2a2d3ddda3 100644 --- a/src/components/live/EditLiveDialog.tsx +++ b/src/components/live/EditLiveDialog.tsx @@ -99,7 +99,7 @@ function DialogInner({ } = useRemoveLiveStatusMutation() const {minutesUntilExpiry, expiryDateTime} = useMemo(() => { - tick! + void tick // revalidate every minute const expiry = new Date(status.expiresAt ?? new Date()) return { diff --git a/src/components/live/GoLiveDialog.tsx b/src/components/live/GoLiveDialog.tsx index 44c604cde7..fbf44b358b 100644 --- a/src/components/live/GoLiveDialog.tsx +++ b/src/components/live/GoLiveDialog.tsx @@ -52,7 +52,7 @@ function DialogInner({profile}: {profile: bsky.profile.AnyProfileView}) { const time = useCallback( (offset: number) => { - tick! + void tick // revalidate every minute const date = new Date() date.setMinutes(date.getMinutes() + offset) diff --git a/src/components/moderation/ReportDialog/index.tsx b/src/components/moderation/ReportDialog/index.tsx index 14354332cb..8016424774 100644 --- a/src/components/moderation/ReportDialog/index.tsx +++ b/src/components/moderation/ReportDialog/index.tsx @@ -211,8 +211,8 @@ function Inner(props: ReportDialogProps) { logger.metric( 'reportDialog:success', { - reason: state.selectedOption?.reason!, - labeler: state.selectedLabeler?.creator.handle!, + reason: state.selectedOption?.reason ?? '', + labeler: state.selectedLabeler?.creator.handle ?? '', details: !!state.details, }, {statsig: false}, @@ -719,7 +719,7 @@ function CategoryCard({ {option.title} + style={[a.text_sm, a.leading_snug, t.atoms.text_contrast_medium]}> {option.description} diff --git a/src/geolocation/service.ts b/src/geolocation/service.ts index d04e0a5afb..184cd154e3 100644 --- a/src/geolocation/service.ts +++ b/src/geolocation/service.ts @@ -67,7 +67,7 @@ export async function resolve() { * THIS PROMISE SHOULD NEVER `reject()`! We want the app to proceed with * startup, even if geolocation resolution fails. */ - geolocationServicePromise = new Promise(async resolve => { + geolocationServicePromise = (async () => { let success = false function cacheResponseOrThrow(response: Geolocation | undefined) { @@ -111,10 +111,10 @@ export async function resolve() { }, ) }) - } finally { - resolve({success}) } - }) + + return {success} + })() } } diff --git a/src/geolocation/util.ts b/src/geolocation/util.ts index 8fe52e3f16..87ecde75ea 100644 --- a/src/geolocation/util.ts +++ b/src/geolocation/util.ts @@ -75,7 +75,7 @@ export const USRegionNameToRegionCode: { export function normalizeDeviceLocation( location: LocationGeocodedAddress, ): Geolocation { - let {isoCountryCode, region} = location + const {isoCountryCode, region} = location let regionCode: string | undefined = region ?? undefined /* diff --git a/src/lib/actor-status.ts b/src/lib/actor-status.ts index 31e532eaa0..05302aa44d 100644 --- a/src/lib/actor-status.ts +++ b/src/lib/actor-status.ts @@ -17,7 +17,7 @@ export function useActorStatus(actor?: bsky.profile.AnyProfileView) { const config = useLiveNowConfig() return useMemo(() => { - tick! // revalidate every minute + void tick // revalidate every minute if (shadowed && 'status' in shadowed && shadowed.status) { const isValid = validateStatus(shadowed.did, shadowed.status, config) diff --git a/src/lib/api/feed-manip.ts b/src/lib/api/feed-manip.ts index 335bf28c84..5c2b2a5b50 100644 --- a/src/lib/api/feed-manip.ts +++ b/src/lib/api/feed-manip.ts @@ -208,7 +208,7 @@ export class FeedViewPostsSlice { getAuthors(): AuthorContext { const feedPost = this._feedPost - let author: AppBskyActorDefs.ProfileViewBasic = feedPost.post.author + const author: AppBskyActorDefs.ProfileViewBasic = feedPost.post.author let parentAuthor: AppBskyActorDefs.ProfileViewBasic | undefined let grandparentAuthor: AppBskyActorDefs.ProfileViewBasic | undefined let rootAuthor: AppBskyActorDefs.ProfileViewBasic | undefined diff --git a/src/lib/api/feed/custom.ts b/src/lib/api/feed/custom.ts index 18bb8c8f07..3c71f0b071 100644 --- a/src/lib/api/feed/custom.ts +++ b/src/lib/api/feed/custom.ts @@ -106,7 +106,7 @@ async function loggedOutFetch({ limit: number cursor?: string }) { - let contentLangs = getAppLanguageAsContentLanguage() + const contentLangs = getAppLanguageAsContentLanguage() /** * Copied from our root `Agent` class diff --git a/src/lib/api/feed/merge.ts b/src/lib/api/feed/merge.ts index b3f9575dee..c91e264aab 100644 --- a/src/lib/api/feed/merge.ts +++ b/src/lib/api/feed/merge.ts @@ -129,7 +129,7 @@ export class MergeFeedAPI implements FeedAPI { // assemble a response by sampling from feeds with content const posts: AppBskyFeedDefs.FeedViewPost[] = [] while (posts.length < limit) { - let slice = this.sampleItem() + const slice = this.sampleItem() if (slice[0]) { posts.push(slice[0]) } else { diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 20f0745d69..241cae57fe 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -78,7 +78,7 @@ export async function post( const writes: $Typed[] = [] const uris: string[] = [] - let now = new Date() + const now = new Date() let tid: TID | undefined for (let i = 0; i < thread.posts.length; i++) { diff --git a/src/lib/api/resolve.ts b/src/lib/api/resolve.ts index 0424876767..dd3c30c853 100644 --- a/src/lib/api/resolve.ts +++ b/src/lib/api/resolve.ts @@ -229,5 +229,7 @@ export async function imageToThumb( if (img) { return await createComposerImage(img) } - } catch {} + } catch { + // no-op + } } diff --git a/src/lib/functions.ts b/src/lib/functions.ts index e0d44ce2d7..897635f08b 100644 --- a/src/lib/functions.ts +++ b/src/lib/functions.ts @@ -67,7 +67,7 @@ export function isPlainArray(value: unknown) { } // Copied from: https://github.com/jonschlinkert/is-plain-object -export function isPlainObject(o: any): o is Object { +export function isPlainObject(o: any): o is object { if (!hasObjectPrototype(o)) { return false } @@ -85,7 +85,7 @@ export function isPlainObject(o: any): o is Object { } // If constructor does not have an Object-specific method - if (!prot.hasOwnProperty('isPrototypeOf')) { + if (!Object.prototype.hasOwnProperty.call(prot, 'isPrototypeOf')) { return false } diff --git a/src/lib/hooks/useNavigationTabState.web.ts b/src/lib/hooks/useNavigationTabState.web.ts index 03dcbbb038..3fbd0f2d7d 100644 --- a/src/lib/hooks/useNavigationTabState.web.ts +++ b/src/lib/hooks/useNavigationTabState.web.ts @@ -4,7 +4,7 @@ import {getCurrentRoute} from '#/lib/routes/helpers' export function useNavigationTabState() { return useNavigationState(state => { - let currentRoute = state ? getCurrentRoute(state).name : 'Home' + const currentRoute = state ? getCurrentRoute(state).name : 'Home' return { isAtHome: currentRoute === 'Home', isAtSearch: currentRoute === 'Search', diff --git a/src/lib/hooks/useNonReactiveCallback.ts b/src/lib/hooks/useNonReactiveCallback.ts index 4b3d6abb93..19777142bd 100644 --- a/src/lib/hooks/useNonReactiveCallback.ts +++ b/src/lib/hooks/useNonReactiveCallback.ts @@ -8,6 +8,7 @@ import {useCallback, useInsertionEffect, useRef} from 'react' // // Also, you should avoid calling the returned function during rendering // since the values captured by it are going to lag behind. +// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- generic utility needs Function type export function useNonReactiveCallback(fn: T): T { const ref = useRef(fn) useInsertionEffect(() => { diff --git a/src/lib/hooks/useTabFocusEffect.ts b/src/lib/hooks/useTabFocusEffect.ts index a54a3af73f..0307e1476d 100644 --- a/src/lib/hooks/useTabFocusEffect.ts +++ b/src/lib/hooks/useTabFocusEffect.ts @@ -18,7 +18,7 @@ export function useTabFocusEffect( useEffect(() => { // check if inside - let v = getTabState(state, tabName) !== TabState.Outside + const v = getTabState(state, tabName) !== TabState.Outside if (v !== isInside) { // fire setIsInside(v) diff --git a/src/lib/media/manip.web.ts b/src/lib/media/manip.web.ts index 1f6d90ce34..cdaaac7ae2 100644 --- a/src/lib/media/manip.web.ts +++ b/src/lib/media/manip.web.ts @@ -50,7 +50,7 @@ export async function saveImageToMediaLibrary(_opts: {uri: string}) { } export async function getImageDim(path: string): Promise { - var img = document.createElement('img') + const img = document.createElement('img') const promise = new Promise((resolve, reject) => { img.onload = resolve img.onerror = reject @@ -139,8 +139,8 @@ function createResizedImage( } else if (mode === 'contain') { scale = img.width > img.height ? width / img.width : height / img.height } - let w = img.width * scale - let h = img.height * scale + const w = img.width * scale + const h = img.height * scale canvas.width = w canvas.height = h diff --git a/src/lib/routes/router.ts b/src/lib/routes/router.ts index c74192f298..6f10006d4d 100644 --- a/src/lib/routes/router.ts +++ b/src/lib/routes/router.ts @@ -39,7 +39,7 @@ export class Router> { function createRoute(pattern: string): Route { const pathParamNames: Set = new Set() - let matcherReInternal = pattern.replace(/:([\w]+)/g, (_m, name) => { + const matcherReInternal = pattern.replace(/:([\w]+)/g, (_m, name) => { pathParamNames.add(name) return `(?<${name}>[^/]+)` }) diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx index 860e841eb4..4468119fac 100644 --- a/src/lib/statsig/statsig.tsx +++ b/src/lib/statsig/statsig.tsx @@ -131,8 +131,8 @@ function toStringRecord( metadata: MetricEvents[E] & FlatJSONRecord, ): Record { const record: Record = {} - for (let key in metadata) { - if (metadata.hasOwnProperty(key)) { + for (const key in metadata) { + if (Object.hasOwn(metadata, key)) { if (typeof metadata[key] === 'string') { record[key] = metadata[key] } else { diff --git a/src/lib/strings/display-names.ts b/src/lib/strings/display-names.ts index 612a317eaf..de5f3dcd5e 100644 --- a/src/lib/strings/display-names.ts +++ b/src/lib/strings/display-names.ts @@ -6,6 +6,7 @@ import {type ModerationUI} from '@atproto/api' // \u2611 = ☑ const CHECK_MARKS_RE = /[\u2705\u2713\u2714\u2611]/gu const CONTROL_CHARS_RE = + // eslint-disable-next-line no-control-regex -- intentionally matching control characters for sanitization /[\u0000-\u001F\u007F-\u009F\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g const MULTIPLE_SPACES_RE = /[\s][\s\u200B]+/g diff --git a/src/lib/strings/embed-player.ts b/src/lib/strings/embed-player.ts index 4680be26e4..911079c287 100644 --- a/src/lib/strings/embed-player.ts +++ b/src/lib/strings/embed-player.ts @@ -426,7 +426,7 @@ export function parseEmbedPlayerFromUrl( // link shortened flickr path if (urlp.hostname === 'flic.kr') { const b58alph = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' - let [__, type, idBase58Enc] = urlp.pathname.split('/') + const [__, type, idBase58Enc] = urlp.pathname.split('/') let id = 0n for (const char of idBase58Enc) { const nextIdx = b58alph.indexOf(char) @@ -439,7 +439,7 @@ export function parseEmbedPlayerFromUrl( } switch (type) { - case 'go': + case 'go': { const formattedGroupId = `${id}` return { type: 'flickr_album', @@ -449,6 +449,7 @@ export function parseEmbedPlayerFromUrl( -2, )}@N${formattedGroupId.slice(-2)}`, } + } case 's': return { type: 'flickr_album', @@ -537,13 +538,13 @@ export function parseTenorGif(urlp: URL): return {success: false} } - let [__, id, filename] = urlp.pathname.split('/') + const [, initialId, initialFilename] = urlp.pathname.split('/') - if (!id || !filename) { + if (!initialId || !initialFilename) { return {success: false} } - if (!id.includes('AAAAC')) { + if (!initialId.includes('AAAAC')) { return {success: false} } @@ -559,16 +560,19 @@ export function parseTenorGif(urlp: URL): width: Number(w), } + let id: string + let filename: string if (isWeb) { if (isSafari) { - id = id.replace('AAAAC', 'AAAP1') - filename = filename.replace('.gif', '.mp4') + id = initialId.replace('AAAAC', 'AAAP1') + filename = initialFilename.replace('.gif', '.mp4') } else { - id = id.replace('AAAAC', 'AAAP3') - filename = filename.replace('.gif', '.webm') + id = initialId.replace('AAAAC', 'AAAP3') + filename = initialFilename.replace('.gif', '.webm') } } else { - id = id.replace('AAAAC', 'AAAAM') + id = initialId.replace('AAAAC', 'AAAAM') + filename = initialFilename } return { diff --git a/src/lib/strings/mention-manip.ts b/src/lib/strings/mention-manip.ts index 7b52f745b2..f3ef7245b4 100644 --- a/src/lib/strings/mention-manip.ts +++ b/src/lib/strings/mention-manip.ts @@ -7,7 +7,7 @@ export function getMentionAt( text: string, cursorPos: number, ): FoundMention | undefined { - let re = /(^|\s)@([a-z0-9.-]*)/gi + const re = /(^|\s)@([a-z0-9.-]*)/gi let match while ((match = re.exec(text))) { const spaceOffset = match[1].length diff --git a/src/lib/strings/time.ts b/src/lib/strings/time.ts index 7a3ce5c0a6..82875bee2a 100644 --- a/src/lib/strings/time.ts +++ b/src/lib/strings/time.ts @@ -24,9 +24,9 @@ export function niceDate( } export function getAge(birthDate: Date): number { - var today = new Date() - var age = today.getFullYear() - birthDate.getFullYear() - var m = today.getMonth() - birthDate.getMonth() + const today = new Date() + let age = today.getFullYear() - birthDate.getFullYear() + const m = today.getMonth() - birthDate.getMonth() if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) { age-- } diff --git a/src/lib/strings/url-helpers.ts b/src/lib/strings/url-helpers.ts index 6088e28065..b26e62bd91 100644 --- a/src/lib/strings/url-helpers.ts +++ b/src/lib/strings/url-helpers.ts @@ -28,7 +28,7 @@ const TRUSTED_REGEX = new RegExp( export function isValidDomain(str: string): boolean { return !!TLDs.find(tld => { - let i = str.lastIndexOf(tld) + const i = str.lastIndexOf(tld) if (i === -1) { return false } @@ -123,7 +123,9 @@ export function isBskyPostUrl(url: string): boolean { return /profile\/(?[^/]+)\/post\/(?[^/]+)/i.test( urlp.pathname, ) - } catch {} + } catch { + // no-op + } } return false } @@ -135,7 +137,9 @@ export function isBskyCustomFeedUrl(url: string): boolean { return /profile\/(?[^/]+)\/feed\/(?[^/]+)/i.test( urlp.pathname, ) - } catch {} + } catch { + // no-op + } } return false } @@ -291,10 +295,14 @@ export function labelToDomain(label: string): string | undefined { } try { return new URL(label).hostname.toLowerCase() - } catch {} + } catch { + // no-op + } try { return new URL('https://' + label).hostname.toLowerCase() - } catch {} + } catch { + // no-op + } return undefined } @@ -306,7 +314,7 @@ export function isPossiblyAUrl(str: string): boolean { if (str.startsWith('https://')) { return true } - const [firstWord] = str.split(/[\s\/]/) + const [firstWord] = str.split(/[\s/]/) return isValidDomain(firstWord) } diff --git a/src/platform/polyfills.web.ts b/src/platform/polyfills.web.ts index 7c5a1c00a0..0586b20469 100644 --- a/src/platform/polyfills.web.ts +++ b/src/platform/polyfills.web.ts @@ -11,7 +11,10 @@ if (process.env.NODE_ENV !== 'production') { // This is a hack to get it showing as a redbox on the web so we catch it early. const realConsoleError = console.error const thrownErrors = new WeakSet() - console.error = function consoleErrorWrapper(msgOrError) { + console.error = function consoleErrorWrapper( + ...args: Parameters + ) { + const msgOrError = args[0] if ( typeof msgOrError === 'string' && msgOrError.startsWith('Unexpected text node') @@ -28,7 +31,7 @@ if (process.env.NODE_ENV !== 'production') { thrownErrors.add(err) throw err } else if (!thrownErrors.has(msgOrError)) { - return realConsoleError.apply(this, arguments as any) + return realConsoleError.apply(this, args) } } } diff --git a/src/screens/Bookmarks/index.tsx b/src/screens/Bookmarks/index.tsx index 5faa60d927..4bc197827b 100644 --- a/src/screens/Bookmarks/index.tsx +++ b/src/screens/Bookmarks/index.tsx @@ -123,7 +123,9 @@ function BookmarksInner() { if (isFetchingNextPage || !hasNextPage || error) return try { await fetchNextPage() - } catch {} + } catch { + // no-op + } }, [isFetchingNextPage, hasNextPage, error, fetchNextPage]) const items = useMemo(() => { diff --git a/src/screens/Home/NoFeedsPinned.tsx b/src/screens/Home/NoFeedsPinned.tsx index e524113f56..46e139b306 100644 --- a/src/screens/Home/NoFeedsPinned.tsx +++ b/src/screens/Home/NoFeedsPinned.tsx @@ -29,7 +29,7 @@ export function NoFeedsPinned({ const addRecommendedFeeds = React.useCallback(async () => { let skippedTimeline = false let skippedDiscover = false - let remainingSavedFeeds = [] + const remainingSavedFeeds = [] // remove first instance of both timeline and discover, since we're going to overwrite them for (const savedFeed of preferences.savedFeeds) { diff --git a/src/screens/Messages/components/MessageInputEmbed.tsx b/src/screens/Messages/components/MessageInputEmbed.tsx index c4d61b000e..9bf3f7f9a6 100644 --- a/src/screens/Messages/components/MessageInputEmbed.tsx +++ b/src/screens/Messages/components/MessageInputEmbed.tsx @@ -156,7 +156,7 @@ export function MessageInputEmbed({ ) break - case 'success': + case 'success': { const itemUrip = new AtUri(post.uri) const itemHref = makeProfileLink(post.author, 'post', itemUrip.rkey) @@ -203,6 +203,7 @@ export function MessageInputEmbed({ ) break + } } return ( diff --git a/src/screens/Onboarding/StepFinished/index.tsx b/src/screens/Onboarding/StepFinished/index.tsx index 2c6dfd3198..0ba9b6a4a6 100644 --- a/src/screens/Onboarding/StepFinished/index.tsx +++ b/src/screens/Onboarding/StepFinished/index.tsx @@ -144,7 +144,7 @@ export function StepFinished() { : undefined await agent.upsertProfile(async existing => { - let next: Un$Typed = existing ?? {} + const next: Un$Typed = existing ?? {} if (blobPromise) { const res = await blobPromise diff --git a/src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx b/src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx index 28b331dec4..7297afc366 100644 --- a/src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx +++ b/src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx @@ -82,7 +82,7 @@ export function StarterPackCard({ setIsFollowingAll(true) setIsProcessing(false) batchedUpdates(() => { - for (let did of dids) { + for (const did of dids) { updateProfileShadow(queryClient, did, { followingUri: followUris.get(did), }) diff --git a/src/screens/Search/Explore.tsx b/src/screens/Search/Explore.tsx index b3e26dcfd3..89cadcf94e 100644 --- a/src/screens/Search/Explore.tsx +++ b/src/screens/Search/Explore.tsx @@ -375,7 +375,7 @@ export function Explore({ if (suggestedUsers.actors.length > 0 && moderationOpts) { // Currently the responses contain duplicate items. // Needs to be fixed on backend, but let's dedupe to be safe. - let seen = new Set() + const seen = new Set() const profileItems: ExploreScreenItems[] = [] for (const actor of suggestedUsers.actors) { // checking for following still necessary if search data is used @@ -439,7 +439,7 @@ export function Explore({ if (useFullExperience) { if (suggestedFeeds && preferences) { - let seen = new Set() + const seen = new Set() const feedItems: ExploreScreenItems[] = [] for (const feed of suggestedFeeds.feeds) { if (!seen.has(feed.uri)) { @@ -527,7 +527,7 @@ export function Explore({ if (feeds && preferences) { // Currently the responses contain duplicate items. // Needs to be fixed on backend, but let's dedupe to be safe. - let seen = new Set() + const seen = new Set() const feedItems: ExploreScreenItems[] = [] for (const page of feeds.pages) { for (const feed of page.feeds) { diff --git a/src/screens/Search/SearchResults.tsx b/src/screens/Search/SearchResults.tsx index 6d4dd64784..4f1d50e8be 100644 --- a/src/screens/Search/SearchResults.tsx +++ b/src/screens/Search/SearchResults.tsx @@ -248,7 +248,7 @@ let SearchScreenPostResults = ({ return results?.pages.flatMap(page => page.posts) || [] }, [results]) const items = useMemo(() => { - let temp: SearchResultSlice[] = [] + const temp: SearchResultSlice[] = [] const seenUris = new Set() for (const post of posts) { diff --git a/src/screens/Search/utils.ts b/src/screens/Search/utils.ts index 012ae4e9f3..b32cb10ea8 100644 --- a/src/screens/Search/utils.ts +++ b/src/screens/Search/utils.ts @@ -10,7 +10,7 @@ export function parseSearchQuery(rawQuery: string) { } // find remaining params in base - const rawParams = base.match(/[a-z]+:[a-z-\.@\d:"]+/gi) || [] + const rawParams = base.match(/[a-z]+:[a-z-.@\d:"]+/gi) || [] for (const param of rawParams) { base = base.replace(param, '') diff --git a/src/screens/Signup/state.ts b/src/screens/Signup/state.ts index 5bf0466d75..c0bf610d4a 100644 --- a/src/screens/Signup/state.ts +++ b/src/screens/Signup/state.ts @@ -123,7 +123,7 @@ export function is18(date: Date) { } export function reducer(s: SignupState, a: SignupAction): SignupState { - let next = {...s} + const next = {...s} switch (a.type) { case 'prev': { @@ -330,11 +330,11 @@ export function useSubmitSignup() { /* * Must happen last so that if the user has multiple tabs open and - * createAccount fails, one tab is not stuck in onboarding — Eric + * createAccount fails, one tab is not stuck in onboarding — Eric */ onboardingDispatch({type: 'start'}) } catch (e: any) { - let errMsg = e.toString() + const errMsg = e.toString() if (e instanceof ComAtprotoServerCreateAccount.InvalidInviteCodeError) { dispatch({ type: 'setError', diff --git a/src/screens/StarterPack/StarterPackScreen.tsx b/src/screens/StarterPack/StarterPackScreen.tsx index 18113c83e1..42a1f964a6 100644 --- a/src/screens/StarterPack/StarterPackScreen.tsx +++ b/src/screens/StarterPack/StarterPackScreen.tsx @@ -377,7 +377,7 @@ function Header({ setIsProcessing(false) batchedUpdates(() => { - for (let did of dids) { + for (const did of dids) { updateProfileShadow(queryClient, did, { followingUri: followUris.get(did), }) diff --git a/src/screens/VideoFeed/components/Header.tsx b/src/screens/VideoFeed/components/Header.tsx index 34f2cb03f5..d796bc8df6 100644 --- a/src/screens/VideoFeed/components/Header.tsx +++ b/src/screens/VideoFeed/components/Header.tsx @@ -74,8 +74,9 @@ export function Header({ break } case 'author': - // TODO + // falls through default: { + // TODO: implement author header break } } diff --git a/src/state/cache/post-shadow.ts b/src/state/cache/post-shadow.ts index 0afa272c53..c6b66a02bd 100644 --- a/src/state/cache/post-shadow.ts +++ b/src/state/cache/post-shadow.ts @@ -158,7 +158,7 @@ export function updatePostShadow( value: Partial, ) { const cachedPosts = findPostsInCache(queryClient, uri) - for (let post of cachedPosts) { + for (const post of cachedPosts) { shadows.set(post, {...shadows.get(post), ...value}) } batchedUpdates(() => { @@ -170,28 +170,28 @@ function* findPostsInCache( queryClient: QueryClient, uri: string, ): Generator { - for (let post of findAllPostsInFeedQueryData(queryClient, uri)) { + for (const post of findAllPostsInFeedQueryData(queryClient, uri)) { yield post } - for (let post of findAllPostsInNotifsQueryData(queryClient, uri)) { + for (const post of findAllPostsInNotifsQueryData(queryClient, uri)) { yield post } - for (let post of findAllPostsInThreadV2QueryData(queryClient, uri)) { + for (const post of findAllPostsInThreadV2QueryData(queryClient, uri)) { yield post } - for (let post of findAllPostsInSearchQueryData(queryClient, uri)) { + for (const post of findAllPostsInSearchQueryData(queryClient, uri)) { yield post } - for (let post of findAllPostsInQuoteQueryData(queryClient, uri)) { + for (const post of findAllPostsInQuoteQueryData(queryClient, uri)) { yield post } - for (let post of findAllPostsInExploreFeedPreviewsQueryData( + for (const post of findAllPostsInExploreFeedPreviewsQueryData( queryClient, uri, )) { yield post } - for (let post of findAllPostsInBookmarksQueryData(queryClient, uri)) { + for (const post of findAllPostsInBookmarksQueryData(queryClient, uri)) { yield post } } diff --git a/src/state/cache/profile-shadow.ts b/src/state/cache/profile-shadow.ts index 0fdef08ad0..4aa48369f2 100644 --- a/src/state/cache/profile-shadow.ts +++ b/src/state/cache/profile-shadow.ts @@ -195,7 +195,7 @@ export function updateProfileShadow( value: Partial, ) { const cachedProfiles = findProfilesInCache(queryClient, did) - for (let profile of cachedProfiles) { + for (const profile of cachedProfiles) { shadows.set(profile, {...shadows.get(profile), ...value}) } batchedUpdates(() => { diff --git a/src/state/feed-feedback.tsx b/src/state/feed-feedback.tsx index 1d719978a5..50d09ff62d 100644 --- a/src/state/feed-feedback.tsx +++ b/src/state/feed-feedback.tsx @@ -276,7 +276,7 @@ function sendOrAggregateInteractionsForStats( interactions: AppBskyFeedDefs.Interaction[], feed: string, ) { - for (let interaction of interactions) { + for (const interaction of interactions) { switch (interaction.event) { // Pressing "Show more" / "Show less" is relatively uncommon so we won't aggregate them. // This lets us send the feed context together with them. diff --git a/src/state/lightbox.tsx b/src/state/lightbox.tsx index 78145d5d7e..eace20f215 100644 --- a/src/state/lightbox.tsx +++ b/src/state/lightbox.tsx @@ -46,7 +46,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { ) const closeLightbox = useNonReactiveCallback(() => { - let wasActive = !!activeLightbox + const wasActive = !!activeLightbox setActiveLightbox(null) return wasActive }) diff --git a/src/state/messages/convo/agent.ts b/src/state/messages/convo/agent.ts index c5fd8f017c..5ecc1a5ce9 100644 --- a/src/state/messages/convo/agent.ts +++ b/src/state/messages/convo/agent.ts @@ -95,7 +95,7 @@ export class Convo { this.convoId = params.convoId this.agent = params.agent this.events = params.events - this.senderUserDid = params.agent.session?.did! + this.senderUserDid = params.agent.session?.did ?? '' if (params.placeholderData) { this.setupPlaceholderData(params.placeholderData) @@ -557,11 +557,7 @@ export class Convo { async fetchConvo() { if (this.pendingFetchConvo) return this.pendingFetchConvo - this.pendingFetchConvo = new Promise<{ - convo: ChatBskyConvoDefs.ConvoView - sender: ChatBskyActorDefs.ProfileViewBasic | undefined - recipients: ChatBskyActorDefs.ProfileViewBasic[] - }>(async (resolve, reject) => { + this.pendingFetchConvo = (async () => { try { const response = await networkRetry(2, () => { return this.agent.api.chat.bsky.convo.getConvo( @@ -574,17 +570,15 @@ export class Convo { const convo = response.data.convo - resolve({ + return { convo, sender: convo.members.find(m => m.did === this.senderUserDid), recipients: convo.members.filter(m => m.did !== this.senderUserDid), - }) - } catch (e) { - reject(e) + } } finally { this.pendingFetchConvo = undefined } - }) + })() return this.pendingFetchConvo } diff --git a/src/state/messages/events/agent.ts b/src/state/messages/events/agent.ts index e8404fd000..ac60a20443 100644 --- a/src/state/messages/events/agent.ts +++ b/src/state/messages/events/agent.ts @@ -352,7 +352,7 @@ export class MessagesEventBus { const {logs: events} = response.data let needsEmit = false - let batch: ChatBskyConvoGetLog.OutputSchema['logs'] = [] + const batch: ChatBskyConvoGetLog.OutputSchema['logs'] = [] for (const ev of events) { /* diff --git a/src/state/modals/index.tsx b/src/state/modals/index.tsx index dab90c0af3..60d51c530f 100644 --- a/src/state/modals/index.tsx +++ b/src/state/modals/index.tsx @@ -60,7 +60,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { }) const closeModal = useNonReactiveCallback(() => { - let wasActive = activeModals.length > 0 + const wasActive = activeModals.length > 0 setActiveModals(modals => { return modals.slice(0, -1) }) @@ -68,7 +68,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { }) const closeAllModals = useNonReactiveCallback(() => { - let wasActive = activeModals.length > 0 + const wasActive = activeModals.length > 0 setActiveModals([]) return wasActive }) diff --git a/src/state/queries/actor-autocomplete.ts b/src/state/queries/actor-autocomplete.ts index 80f7dfabdf..4bdc77f260 100644 --- a/src/state/queries/actor-autocomplete.ts +++ b/src/state/queries/actor-autocomplete.ts @@ -108,7 +108,7 @@ function computeSuggestions({ searched?: AppBskyActorDefs.ProfileViewBasic[] moderationOpts: ModerationOpts }) { - let items: AppBskyActorDefs.ProfileViewBasic[] = [] + const items: AppBskyActorDefs.ProfileViewBasic[] = [] for (const item of searched) { if (!items.find(item2 => item2.handle === item.handle)) { items.push(item) diff --git a/src/state/queries/bookmarks/useBookmarksQuery.ts b/src/state/queries/bookmarks/useBookmarksQuery.ts index 3e8e87a132..c14795d97f 100644 --- a/src/state/queries/bookmarks/useBookmarksQuery.ts +++ b/src/state/queries/bookmarks/useBookmarksQuery.ts @@ -135,7 +135,7 @@ export function* findAllPostsInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const bookmark of page.bookmarks) { if ( !bsky.dangerousIsType( diff --git a/src/state/queries/explore-feed-previews.tsx b/src/state/queries/explore-feed-previews.tsx index 53d6b841b4..f2f99834ef 100644 --- a/src/state/queries/explore-feed-previews.tsx +++ b/src/state/queries/explore-feed-previews.tsx @@ -364,7 +364,7 @@ export function* findAllPostsInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const item of page.posts) { if (didOrHandleUriMatches(atUri, item.post)) { yield item.post @@ -420,7 +420,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const item of page.posts) { if (item.post.author.did === did) { yield item.post.author diff --git a/src/state/queries/feed.ts b/src/state/queries/feed.ts index de1e92533a..ab2bb22ccd 100644 --- a/src/state/queries/feed.ts +++ b/src/state/queries/feed.ts @@ -439,7 +439,7 @@ export function usePinnedFeedsInfos() { return [PWI_DISCOVER_FEED_STUB] } - let resolved = new Map() + const resolved = new Map() // Get all feeds. We can do this in a batch. const pinnedFeeds = pinnedItems.filter(feed => feed.type === 'feed') @@ -476,7 +476,7 @@ export function usePinnedFeedsInfos() { // order the feeds/lists in the order they were pinned const result: SavedFeedSourceInfo[] = [] - for (let pinnedItem of pinnedItems) { + for (const pinnedItem of pinnedItems) { const feedInfo = resolved.get(pinnedItem.value) if (feedInfo) { result.push({ @@ -590,7 +590,7 @@ export function useSavedFeeds() { }) const result: SavedFeedItem[] = [] - for (let savedItem of savedItems) { + for (const savedItem of savedItems) { if (savedItem.type === 'timeline') { result.push({ type: 'timeline', diff --git a/src/state/queries/find-contacts.ts b/src/state/queries/find-contacts.ts index b1eb6c9c5e..b548fa30b8 100644 --- a/src/state/queries/find-contacts.ts +++ b/src/state/queries/find-contacts.ts @@ -103,7 +103,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const match of page.matches) { if (match.did === did) { yield match diff --git a/src/state/queries/handle-availability.ts b/src/state/queries/handle-availability.ts index 06fc6eebbe..3b4b9da191 100644 --- a/src/state/queries/handle-availability.ts +++ b/src/state/queries/handle-availability.ts @@ -120,7 +120,9 @@ export async function checkHandleAvailability( logger.metric('signup:handleTaken', {typeahead}, {statsig: true}) return {available: false} as const } - } catch {} + } catch { + // no-op + } logger.metric('signup:handleAvailable', {typeahead}, {statsig: true}) return {available: true} as const } diff --git a/src/state/queries/known-followers.ts b/src/state/queries/known-followers.ts index 05bbd5e67c..a297202960 100644 --- a/src/state/queries/known-followers.ts +++ b/src/state/queries/known-followers.ts @@ -54,7 +54,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const follow of page.followers) { if (follow.did === did) { yield follow diff --git a/src/state/queries/list-members.ts b/src/state/queries/list-members.ts index 152c7a5be8..8876008f42 100644 --- a/src/state/queries/list-members.ts +++ b/src/state/queries/list-members.ts @@ -103,7 +103,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { if (page.list.creator.did === did) { yield page.list.creator } diff --git a/src/state/queries/my-blocked-accounts.ts b/src/state/queries/my-blocked-accounts.ts index a2e29136f5..5510150f30 100644 --- a/src/state/queries/my-blocked-accounts.ts +++ b/src/state/queries/my-blocked-accounts.ts @@ -47,7 +47,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const block of page.blocks) { if (block.did === did) { yield block diff --git a/src/state/queries/my-lists.ts b/src/state/queries/my-lists.ts index aeb9cf4568..672929f307 100644 --- a/src/state/queries/my-lists.ts +++ b/src/state/queries/my-lists.ts @@ -21,7 +21,7 @@ export function useMyListsQuery(filter: MyListsFilter) { staleTime: STALE.MINUTES.ONE, queryKey: RQKEY(filter), async queryFn() { - let lists: AppBskyGraphDefs.ListView[] = [] + const lists: AppBskyGraphDefs.ListView[] = [] const promises = [ accumulate(cursor => agent.app.bsky.graph @@ -66,7 +66,7 @@ export function useMyListsQuery(filter: MyListsFilter) { } const resultset = await Promise.all(promises) for (const res of resultset) { - for (let list of res) { + for (const list of res) { if ( filter === 'curate' && list.purpose !== 'app.bsky.graph.defs#curatelist' diff --git a/src/state/queries/my-muted-accounts.ts b/src/state/queries/my-muted-accounts.ts index bf36b90296..fe95dab4bf 100644 --- a/src/state/queries/my-muted-accounts.ts +++ b/src/state/queries/my-muted-accounts.ts @@ -47,7 +47,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const mute of page.mutes) { if (mute.did === did) { yield mute diff --git a/src/state/queries/notifications/feed.ts b/src/state/queries/notifications/feed.ts index 57d83cb5bb..cd513e71ef 100644 --- a/src/state/queries/notifications/feed.ts +++ b/src/state/queries/notifications/feed.ts @@ -133,7 +133,7 @@ export function useNotificationFeedQuery(opts: { // Keep track of the last run and whether we can reuse // some already selected pages from there. - let reusedPages = [] + const reusedPages = [] if (lastRun.current) { const { data: lastData, @@ -141,8 +141,8 @@ export function useNotificationFeedQuery(opts: { result: lastResult, } = lastRun.current let canReuse = true - for (let key in selectArgs) { - if (selectArgs.hasOwnProperty(key)) { + for (const key in selectArgs) { + if (Object.hasOwn(selectArgs, key)) { if ((selectArgs as any)[key] !== (lastArgs as any)[key]) { // Can't do reuse anything if any input has changed. canReuse = false @@ -287,7 +287,7 @@ export function* findAllPostsInQueryData( continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const item of page.items) { if (item.type !== 'starterpack-joined') { if (item.subject && didOrHandleUriMatches(atUri, item.subject)) { @@ -317,7 +317,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const item of page.items) { if ( (item.type === 'follow' || item.type === 'contact-match') && diff --git a/src/state/queries/notifications/util.ts b/src/state/queries/notifications/util.ts index a8c15e82c0..cafef6a0c7 100644 --- a/src/state/queries/notifications/util.ts +++ b/src/state/queries/notifications/util.ts @@ -71,7 +71,7 @@ export async function fetchPage({ ) // group notifications which are essentially similar (follows, likes on a post) - let notifsGrouped = groupNotifications(notifs) + const notifsGrouped = groupNotifications(notifs) // we fetch subjects of notifications (usually posts) now instead of lazily // in the UI to avoid relayouts diff --git a/src/state/queries/post-feed.ts b/src/state/queries/post-feed.ts index 0a3cfb6b47..49b3d8fb65 100644 --- a/src/state/queries/post-feed.ts +++ b/src/state/queries/post-feed.ts @@ -244,7 +244,7 @@ export function usePostFeedQuery( // Keep track of the last run and whether we can reuse // some already selected pages from there. - let reusedPages = [] + const reusedPages = [] if (lastRun.current) { const { data: lastData, @@ -252,8 +252,8 @@ export function usePostFeedQuery( result: lastResult, } = lastRun.current let canReuse = true - for (let key in selectArgs) { - if (selectArgs.hasOwnProperty(key)) { + for (const key in selectArgs) { + if (Object.hasOwn(selectArgs, key)) { if ((selectArgs as any)[key] !== (lastArgs as any)[key]) { // Can't do reuse anything if any input has changed. canReuse = false @@ -510,7 +510,7 @@ export function* findAllPostsInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const item of page.feed) { if (didOrHandleUriMatches(atUri, item.post)) { yield item.post @@ -563,7 +563,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const item of page.feed) { if (item.post.author.did === did) { yield item.post.author diff --git a/src/state/queries/post-liked-by.ts b/src/state/queries/post-liked-by.ts index e02de61531..67f8bdf37d 100644 --- a/src/state/queries/post-liked-by.ts +++ b/src/state/queries/post-liked-by.ts @@ -52,7 +52,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const like of page.likes) { if (like.actor.did === did) { yield like.actor diff --git a/src/state/queries/post-quotes.ts b/src/state/queries/post-quotes.ts index 1d0fa07e8e..4b5db8111f 100644 --- a/src/state/queries/post-quotes.ts +++ b/src/state/queries/post-quotes.ts @@ -80,7 +80,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const item of page.posts) { if (item.author.did === did) { yield item.author @@ -108,7 +108,7 @@ export function* findAllPostsInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const post of page.posts) { if (didOrHandleUriMatches(atUri, post)) { yield post diff --git a/src/state/queries/post-reposted-by.ts b/src/state/queries/post-reposted-by.ts index 814a815aae..5e4a92e8c4 100644 --- a/src/state/queries/post-reposted-by.ts +++ b/src/state/queries/post-reposted-by.ts @@ -55,7 +55,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const repostedBy of page.repostedBy) { if (repostedBy.did === did) { yield repostedBy diff --git a/src/state/queries/profile-followers.ts b/src/state/queries/profile-followers.ts index 9c4c5182a1..2e437053bf 100644 --- a/src/state/queries/profile-followers.ts +++ b/src/state/queries/profile-followers.ts @@ -54,7 +54,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const follower of page.followers) { if (follower.did === did) { yield follower diff --git a/src/state/queries/profile-follows.ts b/src/state/queries/profile-follows.ts index 1b154793d4..fc35a01223 100644 --- a/src/state/queries/profile-follows.ts +++ b/src/state/queries/profile-follows.ts @@ -63,7 +63,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const follow of page.follows) { if (follow.did === did) { yield follow diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index 94b362657b..a1f57d1f68 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -621,7 +621,7 @@ export function* findAllProfilesInQueryData( if (!queryData) { continue } - for (let profile of queryData.profiles) { + for (const profile of queryData.profiles) { if (profile.did === did) { yield profile } diff --git a/src/state/queries/search-posts.ts b/src/state/queries/search-posts.ts index e7ebae0ec2..36c3fe3f94 100644 --- a/src/state/queries/search-posts.ts +++ b/src/state/queries/search-posts.ts @@ -87,7 +87,7 @@ export function useSearchPostsQuery({ // Keep track of the last run and whether we can reuse // some already selected pages from there. - let reusedPages = [] + const reusedPages = [] if (lastRun.current) { const { data: lastData, @@ -95,8 +95,8 @@ export function useSearchPostsQuery({ result: lastResult, } = lastRun.current let canReuse = true - for (let key in selectArgs) { - if (selectArgs.hasOwnProperty(key)) { + for (const key in selectArgs) { + if (Object.hasOwn(selectArgs, key)) { if ((selectArgs as any)[key] !== (lastArgs as any)[key]) { // Can't do reuse anything if any input has changed. canReuse = false @@ -156,7 +156,7 @@ export function* findAllPostsInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const post of page.posts) { if (didOrHandleUriMatches(atUri, post)) { yield post @@ -184,7 +184,7 @@ export function* findAllProfilesInQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const post of page.posts) { if (post.author.did === did) { yield post.author diff --git a/src/state/queries/starter-packs.ts b/src/state/queries/starter-packs.ts index 74d75814e8..9a4f0515e3 100644 --- a/src/state/queries/starter-packs.ts +++ b/src/state/queries/starter-packs.ts @@ -119,8 +119,7 @@ export function useCreateStarterPackMutation({ descriptionFacets = rt.facets } - let listRes - listRes = await createStarterPackList({ + const listRes = await createStarterPackList({ name, description, profiles, diff --git a/src/state/queries/suggested-follows.ts b/src/state/queries/suggested-follows.ts index c7a6e5f752..fbf0609e86 100644 --- a/src/state/queries/suggested-follows.ts +++ b/src/state/queries/suggested-follows.ts @@ -150,7 +150,7 @@ function* findAllProfilesInSuggestedFollowsQueryData( if (!queryData?.pages) { continue } - for (const page of queryData?.pages) { + for (const page of queryData.pages) { for (const actor of page.actors) { if (actor.did === did) { yield actor diff --git a/src/state/queries/threadgate/util.ts b/src/state/queries/threadgate/util.ts index 807afef76f..073ae6338f 100644 --- a/src/state/queries/threadgate/util.ts +++ b/src/state/queries/threadgate/util.ts @@ -70,7 +70,7 @@ export function threadgateAllowUISettingToAllowRecordValue( return undefined } - let allow: Exclude = [] + const allow: Exclude = [] if (!threadgate.find(v => v.type === 'nobody')) { for (const rule of threadgate) { diff --git a/src/state/queries/usePostThread/queryCache.ts b/src/state/queries/usePostThread/queryCache.ts index 5f9f263280..6ef7ffa6c1 100644 --- a/src/state/queries/usePostThread/queryCache.ts +++ b/src/state/queries/usePostThread/queryCache.ts @@ -202,7 +202,7 @@ export function getThreadPlaceholder( uri: string, ): $Typed | void { let partial - for (let item of getThreadPlaceholderCandidates(queryClient, uri)) { + for (const item of getThreadPlaceholderCandidates(queryClient, uri)) { /* * Currently, the backend doesn't send full post info in some cases (for * example, for quoted posts). We use missing `likeCount` as a way to @@ -246,19 +246,19 @@ export function* getThreadPlaceholderCandidates( * with >0 likes/reposts over a stale version with no metrics in order to * avoid a notification->post scroll jump. */ - for (let post of findAllPostsInNotifsQueryData(queryClient, uri)) { + for (const post of findAllPostsInNotifsQueryData(queryClient, uri)) { yield postViewToThreadPlaceholder(post) } - for (let post of findAllPostsInFeedQueryData(queryClient, uri)) { + for (const post of findAllPostsInFeedQueryData(queryClient, uri)) { yield postViewToThreadPlaceholder(post) } - for (let post of findAllPostsInQuoteQueryData(queryClient, uri)) { + for (const post of findAllPostsInQuoteQueryData(queryClient, uri)) { yield postViewToThreadPlaceholder(post) } - for (let post of findAllPostsInSearchQueryData(queryClient, uri)) { + for (const post of findAllPostsInSearchQueryData(queryClient, uri)) { yield postViewToThreadPlaceholder(post) } - for (let post of findAllPostsInExploreFeedPreviewsQueryData( + for (const post of findAllPostsInExploreFeedPreviewsQueryData( queryClient, uri, )) { diff --git a/src/state/queries/usePostThread/types.ts b/src/state/queries/usePostThread/types.ts index 295fd8bd3e..bfb65a407a 100644 --- a/src/state/queries/usePostThread/types.ts +++ b/src/state/queries/usePostThread/types.ts @@ -128,7 +128,7 @@ export type ThreadItem = * total number of replies, the reply index, etc. * * The idea here is that these values should be objectively true in all cases, - * such that we can use them later — either individually on in composite — to + * such that we can use them later — either individually on in composite — to * drive rendering behaviors. */ export type TraversalMetadata = { diff --git a/src/state/session/__tests__/session-test.ts b/src/state/session/__tests__/session-test.ts index eb56944ba6..85fefd0034 100644 --- a/src/state/session/__tests__/session-test.ts +++ b/src/state/session/__tests__/session-test.ts @@ -1673,7 +1673,7 @@ describe('session', () => { function run(initialState: State, actions: Action[]): State { let state = initialState - for (let action of actions) { + for (const action of actions) { state = reducer(state, action) } return state diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts index 5c8ce3b97f..b2dd441d0d 100644 --- a/src/state/session/agent.ts +++ b/src/state/session/agent.ts @@ -374,7 +374,7 @@ export class Agent extends BaseAgent { // WARN: In the factories above, we _manually set a proxy header_ for the agent after we do whatever it is we are supposed to do. // Ideally, we wouldn't be doing this. However, since there is so much logic that requires making calls to the PDS right now, it // feels safer to just let those run as-is and set the header afterward. -let realFetch = globalThis.fetch +const realFetch = globalThis.fetch class BskyAppAgent extends BskyAgent { persistSessionHandler: ((event: AtpSessionEvent) => void) | undefined = undefined diff --git a/src/state/session/logging.ts b/src/state/session/logging.ts index bf847f08f5..7c0309dbc9 100644 --- a/src/state/session/logging.ts +++ b/src/state/session/logging.ts @@ -123,8 +123,8 @@ export function addSessionDebugLog(log: Log) { } } -let agentIds = new WeakMap() -let realmId = Math.random().toString(36).slice(2) +const agentIds = new WeakMap() +const realmId = Math.random().toString(36).slice(2) let nextAgentId = 1 function getAgentId(agent: object) { diff --git a/src/state/shell/composer/index.tsx b/src/state/shell/composer/index.tsx index 8449847770..56ac13cdc4 100644 --- a/src/state/shell/composer/index.tsx +++ b/src/state/shell/composer/index.tsx @@ -107,7 +107,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { }) const closeComposer = useNonReactiveCallback(() => { - let wasOpen = !!state + const wasOpen = !!state if (wasOpen) { setState(undefined) purgeTemporaryImageFiles() diff --git a/src/state/shell/selected-feed.tsx b/src/state/shell/selected-feed.tsx index 1f7f7a9c60..ac87d456a0 100644 --- a/src/state/shell/selected-feed.tsx +++ b/src/state/shell/selected-feed.tsx @@ -47,7 +47,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) { if (isWeb) { try { sessionStorage.setItem('lastSelectedHomeFeed', feed) - } catch {} + } catch { + // no-op + } } persisted.write('lastSelectedHomeFeed', feed) }, []) diff --git a/src/state/unstable-post-source.tsx b/src/state/unstable-post-source.tsx index c5b7d1c2bf..de90c8b71b 100644 --- a/src/state/unstable-post-source.tsx +++ b/src/state/unstable-post-source.tsx @@ -36,7 +36,7 @@ const consumedSources = new Map() export function setUnstablePostSource(key: string, source: PostSource) { assertValidDevOnly( key, - `setUnstablePostSource key should be a URI containing a handle, received ${key} — use buildPostSourceKey`, + `setUnstablePostSource key should be a URI containing a handle, received ${key} — use buildPostSourceKey`, ) logger.debug('set', {key, source}) transientSources.set(key, source) @@ -53,7 +53,7 @@ export function useUnstablePostSource(key: string) { const [source] = useState(() => { assertValidDevOnly( key, - `consumeUnstablePostSource key should be a URI containing a handle, received ${key} — be sure to use buildPostSourceKey when setting the source`, + `consumeUnstablePostSource key should be a URI containing a handle, received ${key} — be sure to use buildPostSourceKey when setting the source`, true, ) const source = consumedSources.get(id) || transientSources.get(key) diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 2b2eaed64e..43cd7c98e1 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -519,7 +519,7 @@ export const ComposePost = ({ } finally { if (postUri) { let index = 0 - for (let post of thread.posts) { + for (const post of thread.posts) { logEvent('post:create', { imageCount: post.embed.media?.type === 'images' @@ -619,7 +619,7 @@ export const ComposePost = ({ if (publishOnUpload) { let erroredVideos = 0 let uploadingVideos = 0 - for (let post of thread.posts) { + for (const post of thread.posts) { if (post.embed.media?.type === 'video') { const video = post.embed.media.video if (video.status === 'error') { @@ -812,7 +812,7 @@ export const ComposePost = ({ ) } -let ComposerPost = React.memo(function ComposerPost({ +const ComposerPost = React.memo(function ComposerPost({ post, dispatch, textInput, diff --git a/src/view/com/composer/SelectMediaButton.tsx b/src/view/com/composer/SelectMediaButton.tsx index 946ece5b9f..141520e1d1 100644 --- a/src/view/com/composer/SelectMediaButton.tsx +++ b/src/view/com/composer/SelectMediaButton.tsx @@ -413,7 +413,7 @@ export function SelectMediaButton({ msg`You can only select one GIF at a time.`, ), [SelectedAssetError.FileTooBig]: _( - msg`One or more of your selected files are too large. Maximum size is 100 MB.`, + msg`One or more of your selected files are too large. Maximum size is 100 MB.`, ), }[error] }) diff --git a/src/view/com/composer/state/composer.ts b/src/view/com/composer/state/composer.ts index c673f21341..c6bca0d0fd 100644 --- a/src/view/com/composer/state/composer.ts +++ b/src/view/com/composer/state/composer.ts @@ -198,7 +198,7 @@ export function composerReducer( const indexToRemove = state.thread.posts.findIndex( p => p.id === action.postId, ) - let nextPosts = [...state.thread.posts] + const nextPosts = [...state.thread.posts] if (indexToRemove !== -1) { const postToRemove = state.thread.posts[indexToRemove] if (postToRemove.embed.media?.type === 'video') { diff --git a/src/view/com/composer/state/video.ts b/src/view/com/composer/state/video.ts index 011bf42c69..bedd20332c 100644 --- a/src/view/com/composer/state/video.ts +++ b/src/view/com/composer/state/video.ts @@ -392,7 +392,7 @@ function getCompressErrorMessage(e: unknown, _: I18n['_']): string | null { } if (e instanceof VideoTooLargeError) { return _( - msg`The selected video is larger than 100 MB. Please try again with a smaller file.`, + msg`The selected video is larger than 100 MB. Please try again with a smaller file.`, ) } logger.error('Error compressing video', {safeMessage: e}) @@ -431,7 +431,7 @@ function getUploadErrorMessage(e: unknown, _: I18n['_']): string | null { ) case 'file size (100000001 bytes) is larger than the maximum allowed size (100000000 bytes)': return _( - msg`The selected video is larger than 100 MB. Please try again with a smaller file.`, + msg`The selected video is larger than 100 MB. Please try again with a smaller file.`, ) default: return e.message diff --git a/src/view/com/composer/text-input/web/LinkDecorator.ts b/src/view/com/composer/text-input/web/LinkDecorator.ts index 4843f0ddfc..9f443d7df3 100644 --- a/src/view/com/composer/text-input/web/LinkDecorator.ts +++ b/src/view/com/composer/text-input/web/LinkDecorator.ts @@ -90,7 +90,7 @@ function iterateUris(str: string, cb: (from: number, to: number) => void) { } uri = `https://${uri}` } - let from = str.indexOf(match[2], match.index) + const from = str.indexOf(match[2], match.index) let to = from + match[2].length // strip ending puncuation if (/[.,;!?]$/.test(uri)) { diff --git a/src/view/com/composer/text-input/web/useWebPreloadEmoji.ts b/src/view/com/composer/text-input/web/useWebPreloadEmoji.ts index 08f18d94bd..34ab16dbb1 100644 --- a/src/view/com/composer/text-input/web/useWebPreloadEmoji.ts +++ b/src/view/com/composer/text-input/web/useWebPreloadEmoji.ts @@ -17,7 +17,9 @@ export function useWebPreloadEmoji({immediate}: {immediate?: boolean} = {}) { try { const data = (await import('./EmojiPickerData.json')).default init({data}) - } catch (e) {} + } catch (e) { + // no-op + } }, []) if (immediate) preload() return preload diff --git a/src/view/com/feeds/ProfileFeedgens.tsx b/src/view/com/feeds/ProfileFeedgens.tsx index 5b09545f6c..c81c4d3afa 100644 --- a/src/view/com/feeds/ProfileFeedgens.tsx +++ b/src/view/com/feeds/ProfileFeedgens.tsx @@ -95,7 +95,7 @@ export function ProfileFeedgens({ } else if (isEmpty) { items = items.concat([EMPTY]) } else if (data?.pages) { - for (const page of data?.pages) { + for (const page of data.pages) { items = items.concat(page.feeds) } } else if (isError && !isEmpty) { diff --git a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx index 9ce3f52420..ef6a64653d 100644 --- a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx +++ b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.android.tsx @@ -191,7 +191,7 @@ const ImageItem = ({ .onEnd(() => { 'worklet' // Commit just the pinch. - let t = createTransform() + const t = createTransform() prependPinch( t, pinchScale.get(), @@ -220,7 +220,7 @@ const ImageItem = ({ } const nextPanTranslation = {x: e.translationX, y: e.translationY} - let t = createTransform() + const t = createTransform() prependPan(t, nextPanTranslation) prependPinch( t, @@ -239,7 +239,7 @@ const ImageItem = ({ .onEnd(() => { 'worklet' // Commit just the pan. - let t = createTransform() + const t = createTransform() prependPan(t, panTranslation.get()) prependTransform(t, committedTransform.get()) applyRounding(t) @@ -265,7 +265,7 @@ const ImageItem = ({ const [, , committedScale] = readTransform(committedTransform.get()) if (committedScale !== 1) { // Go back to 1:1 using the identity vector. - let t = createTransform() + const t = createTransform() committedTransform.set(withClampedSpring(t)) return } @@ -317,7 +317,7 @@ const ImageItem = ({ const {scaleAndMoveTransform, isHidden} = transforms.get() // Apply the active adjustments on top of the committed transform before the gestures. // This is matrix multiplication, so operations are applied in the reverse order. - let t = createTransform() + const t = createTransform() prependPan(t, panTranslation.get()) prependPinch(t, pinchScale.get(), pinchOrigin.get(), pinchTranslation.get()) prependTransform(t, committedTransform.get()) diff --git a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.ios.tsx b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.ios.tsx index 44907c8075..5052fa94b6 100644 --- a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.ios.tsx +++ b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.ios.tsx @@ -308,8 +308,8 @@ const getZoomRectAfterDoubleTap = ( // Next, we'll be calculating the rectangle to "zoom into" in screen coordinates. // We already know the zoom level, so this gives us the rectangle size. - let rectWidth = screenSize.width / zoom - let rectHeight = screenSize.height / zoom + const rectWidth = screenSize.width / zoom + const rectHeight = screenSize.height / zoom // Before we settle on the zoomed rect, figure out the safe area it has to be inside. // We don't want to introduce new black bars or make existing black bars unbalanced. diff --git a/src/view/com/lists/ProfileLists.tsx b/src/view/com/lists/ProfileLists.tsx index 35ab7b8a85..834198ddaf 100644 --- a/src/view/com/lists/ProfileLists.tsx +++ b/src/view/com/lists/ProfileLists.tsx @@ -95,7 +95,7 @@ export function ProfileLists({ } else if (isEmpty) { items = items.concat([EMPTY]) } else if (data?.pages) { - for (const page of data?.pages) { + for (const page of data.pages) { items = items.concat(page.lists) } } else if (isError && !isEmpty) { diff --git a/src/view/com/notifications/NotificationFeed.tsx b/src/view/com/notifications/NotificationFeed.tsx index 04c470e1c7..6d9c49472a 100644 --- a/src/view/com/notifications/NotificationFeed.tsx +++ b/src/view/com/notifications/NotificationFeed.tsx @@ -76,7 +76,7 @@ export function NotificationFeed({ if (isEmpty) { arr = arr.concat([EMPTY_FEED_ITEM]) } else if (data) { - for (const page of data?.pages) { + for (const page of data.pages) { arr = arr.concat(page.items) } } diff --git a/src/view/com/pager/Pager.web.tsx b/src/view/com/pager/Pager.web.tsx index ebe5432a33..0c9db402cb 100644 --- a/src/view/com/pager/Pager.web.tsx +++ b/src/view/com/pager/Pager.web.tsx @@ -54,7 +54,7 @@ export function Pager({ // case we should preserve and restore scroll), or if it is somewhere below in the // viewport (in which case a scroll jump would be jarring). We determine this by // measuring where the "anchor" element is (which we place just above the tabbar). - let anchorTop = anchorRef.current + const anchorTop = anchorRef.current ? (anchorRef.current as Element).getBoundingClientRect().top : -scrollY // If there's no anchor, treat the top of the page as one. const isSticking = anchorTop <= 5 // This would be 0 if browser scrollTo() was reliable. diff --git a/src/view/com/posts/PostFeed.tsx b/src/view/com/posts/PostFeed.tsx index d7cad9ca58..6ce90d8e3a 100644 --- a/src/view/com/posts/PostFeed.tsx +++ b/src/view/com/posts/PostFeed.tsx @@ -333,14 +333,14 @@ let PostFeed = ({ }, [enabled, isEmpty, disablePoll, checkForNew]) useEffect(() => { - let cleanup1: () => void | undefined, cleanup2: () => void | undefined const subscription = AppState.addEventListener('change', nextAppState => { // check for new on app foreground if (nextAppState === 'active') { checkForNew() } }) - cleanup1 = () => subscription.remove() + const cleanup1 = () => subscription.remove() + let cleanup2: (() => void) | undefined if (pollInterval) { // check for new on interval const i = setInterval(() => { @@ -349,7 +349,7 @@ let PostFeed = ({ cleanup2 = () => clearInterval(i) } return () => { - cleanup1?.() + cleanup1() cleanup2?.() } }, [pollInterval, checkForNew]) @@ -402,7 +402,7 @@ let PostFeed = ({ feedKind = 'profile' } - let arr: FeedRow[] = [] + const arr: FeedRow[] = [] if (KNOWN_SHUTDOWN_FEEDS.includes(feedUriOrActorDid)) { arr.push({ type: 'feedShutdownMsg', @@ -481,7 +481,7 @@ let PostFeed = ({ }) } } else { - for (const page of data?.pages) { + for (const page of data.pages) { for (const slice of page.slices) { sliceIndex++ diff --git a/src/view/com/util/List.web.tsx b/src/view/com/util/List.web.tsx index 584738eea9..79553d0699 100644 --- a/src/view/com/util/List.web.tsx +++ b/src/view/com/util/List.web.tsx @@ -422,7 +422,7 @@ function useResizeObserver( } const resizeObserver = new ResizeObserver(entries => { batchedUpdates(() => { - for (let entry of entries) { + for (const entry of entries) { const rect = entry.contentRect handleResize(rect.width, rect.height) } diff --git a/src/view/com/util/MainScrollProvider.tsx b/src/view/com/util/MainScrollProvider.tsx index e3f45c11c7..1d87e81ff6 100644 --- a/src/view/com/util/MainScrollProvider.tsx +++ b/src/view/com/util/MainScrollProvider.tsx @@ -179,14 +179,18 @@ const emitter = new EventEmitter() if (isWeb) { const originalScroll = window.scroll + window.scroll = function () { emitter.emit('forced-scroll') + // eslint-disable-next-line prefer-rest-params return originalScroll.apply(this, arguments as any) } const originalScrollTo = window.scrollTo + window.scrollTo = function () { emitter.emit('forced-scroll') + // eslint-disable-next-line prefer-rest-params return originalScrollTo.apply(this, arguments as any) } } diff --git a/src/view/com/util/forms/Button.tsx b/src/view/com/util/forms/Button.tsx index 24d478fe54..1827c898aa 100644 --- a/src/view/com/util/forms/Button.tsx +++ b/src/view/com/util/forms/Button.tsx @@ -153,9 +153,13 @@ export function Button({ async (event: GestureResponderEvent) => { event.stopPropagation() event.preventDefault() - withLoading && setIsLoading(true) + if (withLoading) { + setIsLoading(true) + } await onPress?.(event) - withLoading && setIsLoading(false) + if (withLoading) { + setIsLoading(false) + } }, [onPress, withLoading], ) diff --git a/src/view/screens/Lists.tsx b/src/view/screens/Lists.tsx index f443b21736..5fb4c0358a 100644 --- a/src/view/screens/Lists.tsx +++ b/src/view/screens/Lists.tsx @@ -53,7 +53,9 @@ export function ListsScreen({}: Props) { name: urip.hostname, rkey: urip.rkey, }) - } catch {} + } catch { + // no-op + } }, [navigation], ) diff --git a/src/view/screens/ModerationModlists.tsx b/src/view/screens/ModerationModlists.tsx index 1f786d88bc..34a2f7e707 100644 --- a/src/view/screens/ModerationModlists.tsx +++ b/src/view/screens/ModerationModlists.tsx @@ -53,7 +53,9 @@ export function ModerationModlistsScreen({}: Props) { name: urip.hostname, rkey: urip.rkey, }) - } catch {} + } catch { + // no-op + } }, [navigation], ) diff --git a/src/view/shell/createNativeStackNavigatorWithAuth.tsx b/src/view/shell/createNativeStackNavigatorWithAuth.tsx index eff29f39e4..323c9174b1 100644 --- a/src/view/shell/createNativeStackNavigatorWithAuth.tsx +++ b/src/view/shell/createNativeStackNavigatorWithAuth.tsx @@ -128,7 +128,7 @@ function NativeStackNavigator({ return } const newDescriptors: typeof descriptors = {} - for (let key in descriptors) { + for (const key in descriptors) { const descriptor = descriptors[key] const requireAuth = descriptor.options.requireAuth ?? false newDescriptors[key] = { diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index 32b85d0836..aa2c1f5765 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -289,7 +289,7 @@ function SwitcherMenuProfileLink() { } return getCurrentRoute(state) }) - let isCurrent = + const isCurrent = currentRouteInfo.name === 'Profile' ? isTab(currentRouteInfo.name, pathName) && (currentRouteInfo.params as CommonNavigatorParams['Profile']).name === @@ -385,7 +385,7 @@ function NavItem({count, hasNew, href, icon, iconFilled, label}: NavItemProps) { } return getCurrentRoute(state) }) - let isCurrent = + const isCurrent = currentRouteInfo.name === 'Profile' ? isTab(currentRouteInfo.name, pathName) && (currentRouteInfo.params as CommonNavigatorParams['Profile']).name === diff --git a/src/view/shell/desktop/RightNav.tsx b/src/view/shell/desktop/RightNav.tsx index 788df6e64c..768a50889e 100644 --- a/src/view/shell/desktop/RightNav.tsx +++ b/src/view/shell/desktop/RightNav.tsx @@ -33,7 +33,9 @@ function useWebQueryParams() { const {state} = e.data const lastRoute = state.routes[state.routes.length - 1] setParams(lastRoute.params) - } catch (err) {} + } catch (err) { + // no-op + } }) }, [navigation, setParams])