diff --git a/.eslintrc.js b/.eslintrc.js index fa2c74d9e9..8dab053c24 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -89,7 +89,7 @@ module.exports = { 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': [ 'error', - {argsIgnorePattern: '^_', varsIgnorePattern: '^_'}, + {argsIgnorePattern: '^_', varsIgnorePattern: '^_.+'}, ], '@typescript-eslint/consistent-type-imports': [ 'warn', diff --git a/package.json b/package.json index 6ff8711102..ae45d38f89 100644 --- a/package.json +++ b/package.json @@ -246,7 +246,7 @@ "babel-jest": "^29.7.0", "babel-plugin-macros": "^3.1.0", "babel-plugin-module-resolver": "^5.0.2", - "babel-plugin-react-compiler": "^19.1.0-rc.1", + "babel-plugin-react-compiler": "^19.1.0-rc.3", "babel-preset-expo": "~54.0.0", "eslint": "^8.19.0", "eslint-plugin-bsky-internal": "link:./eslint", @@ -254,7 +254,7 @@ "eslint-plugin-import": "^2.31.0", "eslint-plugin-lingui": "^0.2.0", "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-compiler": "^19.1.0-rc.1", + "eslint-plugin-react-compiler": "^19.1.0-rc.2", "eslint-plugin-react-native-a11y": "^3.3.0", "eslint-plugin-simple-import-sort": "^12.0.0", "file-loader": "6.2.0", diff --git a/src/components/PostControls/ShareMenu/RecentChats.tsx b/src/components/PostControls/ShareMenu/RecentChats.tsx index 28724061fd..0862951b2b 100644 --- a/src/components/PostControls/ShareMenu/RecentChats.tsx +++ b/src/components/PostControls/ShareMenu/RecentChats.tsx @@ -24,7 +24,6 @@ import type * as bsky from '#/types/bsky' export function RecentChats({postUri}: {postUri: string}) { const control = useDialogContext() - const {_} = useLingui() const {currentAccount} = useSession() const {data} = useListConvosQuery({status: 'accepted'}) const convos = data?.pages[0]?.convos?.slice(0, 10) diff --git a/src/components/dialogs/StarterPackDialog.tsx b/src/components/dialogs/StarterPackDialog.tsx index 13b04e2017..78f47b199a 100644 --- a/src/components/dialogs/StarterPackDialog.tsx +++ b/src/components/dialogs/StarterPackDialog.tsx @@ -47,7 +47,6 @@ export function StarterPackDialog({ targetDid, enabled, }: StarterPackDialogProps) { - const {_} = useLingui() const navigation = useNavigation() const requireEmailVerification = useRequireEmailVerification() diff --git a/src/lib/hooks/useIntentHandler.ts b/src/lib/hooks/useIntentHandler.ts index c359b2bd65..0c83970089 100644 --- a/src/lib/hooks/useIntentHandler.ts +++ b/src/lib/hooks/useIntentHandler.ts @@ -51,7 +51,7 @@ export function useIntentHandler() { } const urlp = new URL(url) - const [_, intent, intentType] = urlp.pathname.split('/') + const [__, intent, intentType] = urlp.pathname.split('/') // On native, our links look like bluesky://intent/SomeIntent, so we have to check the hostname for the // intent check. On web, we have to check the first part of the path since we have an actual hostname diff --git a/src/lib/strings/embed-player.ts b/src/lib/strings/embed-player.ts index 0cd0b4921d..a7ce441fcc 100644 --- a/src/lib/strings/embed-player.ts +++ b/src/lib/strings/embed-player.ts @@ -105,7 +105,7 @@ export function parseEmbedPlayerFromUrl( urlp.hostname === 'm.youtube.com' || urlp.hostname === 'music.youtube.com' ) { - const [_, page, shortOrLiveVideoId] = urlp.pathname.split('/') + const [__, page, shortOrLiveVideoId] = urlp.pathname.split('/') const isShorts = page === 'shorts' const isLive = page === 'live' @@ -137,7 +137,7 @@ export function parseEmbedPlayerFromUrl( window.location.hostname : 'localhost' - const [_, channelOrVideo, clipOrId, id] = urlp.pathname.split('/') + const [__, channelOrVideo, clipOrId, id] = urlp.pathname.split('/') if (channelOrVideo === 'videos') { return { @@ -162,7 +162,7 @@ export function parseEmbedPlayerFromUrl( // spotify if (urlp.hostname === 'open.spotify.com') { - const [_, typeOrLocale, idOrType, id] = urlp.pathname.split('/') + const [__, typeOrLocale, idOrType, id] = urlp.pathname.split('/') if (idOrType) { if (typeOrLocale === 'playlist' || idOrType === 'playlist') { @@ -210,7 +210,7 @@ export function parseEmbedPlayerFromUrl( urlp.hostname === 'soundcloud.com' || urlp.hostname === 'www.soundcloud.com' ) { - const [_, user, trackOrSets, set] = urlp.pathname.split('/') + const [__, user, trackOrSets, set] = urlp.pathname.split('/') if (user && trackOrSets) { if (trackOrSets === 'sets' && set) { @@ -270,7 +270,7 @@ export function parseEmbedPlayerFromUrl( } if (urlp.hostname === 'vimeo.com' || urlp.hostname === 'www.vimeo.com') { - const [_, videoId] = urlp.pathname.split('/') + const [__, videoId] = urlp.pathname.split('/') if (videoId) { return { type: 'vimeo_video', @@ -281,7 +281,7 @@ export function parseEmbedPlayerFromUrl( } if (urlp.hostname === 'giphy.com' || urlp.hostname === 'www.giphy.com') { - const [_, gifs, nameAndId] = urlp.pathname.split('/') + const [__, gifs, nameAndId] = urlp.pathname.split('/') /* * nameAndId is a string that consists of the name (dash separated) and the id of the gif (the last part of the name) @@ -309,7 +309,7 @@ export function parseEmbedPlayerFromUrl( // These can include (presumably) a tracking id in the path name, so we have to check for that as well if (giphyRegex.test(urlp.hostname)) { // We can link directly to the gif, if its a proper link - const [_, media, trackingOrId, idOrFilename, filename] = + const [__, media, trackingOrId, idOrFilename, filename] = urlp.pathname.split('/') if (media === 'media') { @@ -338,7 +338,7 @@ export function parseEmbedPlayerFromUrl( // Finally, we should see if it is a link to i.giphy.com. These links don't necessarily end in .gif but can also // be .webp if (urlp.hostname === 'i.giphy.com' || urlp.hostname === 'www.i.giphy.com') { - const [_, mediaOrFilename, filename] = urlp.pathname.split('/') + const [__, mediaOrFilename, filename] = urlp.pathname.split('/') if (mediaOrFilename === 'media' && filename) { const gifId = filename.split('.')[0] @@ -389,7 +389,7 @@ export function parseEmbedPlayerFromUrl( const path_components = urlp.pathname.slice(1, i + 1).split('/') if (path_components.length === 4) { // discard username - it's not relevant - const [photos, _, albums, id] = path_components + const [photos, __, albums, id] = path_components if (photos === 'photos' && albums === 'albums') { // this at least has the shape of a valid photo-album URL! return { @@ -417,7 +417,7 @@ export function parseEmbedPlayerFromUrl( // link shortened flickr path if (urlp.hostname === 'flic.kr') { const b58alph = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ' - let [_, type, idBase58Enc] = urlp.pathname.split('/') + let [__, type, idBase58Enc] = urlp.pathname.split('/') let id = 0n for (const char of idBase58Enc) { const nextIdx = b58alph.indexOf(char) @@ -528,7 +528,7 @@ export function parseTenorGif(urlp: URL): return {success: false} } - let [_, id, filename] = urlp.pathname.split('/') + let [__, id, filename] = urlp.pathname.split('/') if (!id || !filename) { return {success: false} diff --git a/src/lib/strings/helpers.ts b/src/lib/strings/helpers.ts index 3f7c0d4782..9ecbfd38d0 100644 --- a/src/lib/strings/helpers.ts +++ b/src/lib/strings/helpers.ts @@ -62,23 +62,6 @@ export function useWarnMaxGraphemeCount({ }, [splitter, maxCount, text]) } -// https://stackoverflow.com/a/52171480 -export function toHashCode(str: string, seed = 0): number { - let h1 = 0xdeadbeef ^ seed, - h2 = 0x41c6ce57 ^ seed - for (let i = 0, ch; i < str.length; i++) { - ch = str.charCodeAt(i) - h1 = Math.imul(h1 ^ ch, 2654435761) - h2 = Math.imul(h2 ^ ch, 1597334677) - } - h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) - h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909) - h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) - h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909) - - return 4294967296 * (2097151 & h2) + (h1 >>> 0) -} - export function countLines(str: string | undefined): number { if (!str) return 0 return str.match(/\n/g)?.length ?? 0 diff --git a/src/lib/strings/starter-pack.ts b/src/lib/strings/starter-pack.ts index 01e0256b5c..475b000336 100644 --- a/src/lib/strings/starter-pack.ts +++ b/src/lib/strings/starter-pack.ts @@ -46,7 +46,7 @@ export function parseStarterPackUri(uri?: string): { } else { const url = new URL(uri) const parts = url.pathname.split('/') - const [_, path, name, rkey] = parts + const [__, path, name, rkey] = parts if (parts.length !== 4) return null if (path !== 'starter-pack' && path !== 'start') return null diff --git a/src/screens/Onboarding/StepFinished.tsx b/src/screens/Onboarding/StepFinished.tsx index b6d0c0d1ef..3ed268a575 100644 --- a/src/screens/Onboarding/StepFinished.tsx +++ b/src/screens/Onboarding/StepFinished.tsx @@ -69,7 +69,6 @@ import {Text} from '#/components/Typography' import * as bsky from '#/types/bsky' export function StepFinished() { - const {_} = useLingui() const {state, dispatch} = useContext(Context) const onboardDispatch = useOnboardingDispatch() const [saving, setSaving] = useState(false) @@ -495,7 +494,6 @@ function ValueProposition({ function Dot({active}: {active: boolean}) { const t = useTheme() - const {_} = useLingui() return ( { diff --git a/src/screens/Search/modules/ExploreTrendingVideos.tsx b/src/screens/Search/modules/ExploreTrendingVideos.tsx index 54eb73312c..f57cdb08aa 100644 --- a/src/screens/Search/modules/ExploreTrendingVideos.tsx +++ b/src/screens/Search/modules/ExploreTrendingVideos.tsx @@ -31,7 +31,6 @@ const FEED_PARAMS: { } export function ExploreTrendingVideos() { - const {_} = useLingui() const gutters = useGutters([0, 'base']) const {data, isLoading, error} = usePostFeedQuery(FEED_DESC, FEED_PARAMS) diff --git a/src/state/queries/post-feed.ts b/src/state/queries/post-feed.ts index 22e95fcd63..7f95a34e7c 100644 --- a/src/state/queries/post-feed.ts +++ b/src/state/queries/post-feed.ts @@ -492,23 +492,23 @@ function createApi({ } } } else if (feedDesc.startsWith('author')) { - const [_, actor, filter] = feedDesc.split('|') + const [__, actor, filter] = feedDesc.split('|') return new AuthorFeedAPI({agent, feedParams: {actor, filter}}) } else if (feedDesc.startsWith('likes')) { - const [_, actor] = feedDesc.split('|') + const [__, actor] = feedDesc.split('|') return new LikesFeedAPI({agent, feedParams: {actor}}) } else if (feedDesc.startsWith('feedgen')) { - const [_, feed] = feedDesc.split('|') + const [__, feed] = feedDesc.split('|') return new CustomFeedAPI({ agent, feedParams: {feed}, userInterests, }) } else if (feedDesc.startsWith('list')) { - const [_, list] = feedDesc.split('|') + const [__, list] = feedDesc.split('|') return new ListFeedAPI({agent, feedParams: {list}}) } else if (feedDesc.startsWith('posts')) { - const [_, uriList] = feedDesc.split('|') + const [__, uriList] = feedDesc.split('|') return new PostListFeedAPI({agent, feedParams: {uris: uriList.split(',')}}) } else if (feedDesc === 'demo') { return new DemoFeedAPI({agent}) diff --git a/src/state/queries/trending/useGetSuggestedUsersQuery.ts b/src/state/queries/trending/useGetSuggestedUsersQuery.ts index 8980293985..4ecee2986d 100644 --- a/src/state/queries/trending/useGetSuggestedUsersQuery.ts +++ b/src/state/queries/trending/useGetSuggestedUsersQuery.ts @@ -69,7 +69,7 @@ export function* findAllProfilesInQueryData( queryClient.getQueriesData({ queryKey: [getSuggestedUsersQueryKeyRoot], }) - for (const [_, response] of responses) { + for (const [_key, response] of responses) { if (!response) { continue } diff --git a/src/view/com/composer/photos/EditImageDialog.web.tsx b/src/view/com/composer/photos/EditImageDialog.web.tsx index b448fad3a7..6131e30466 100644 --- a/src/view/com/composer/photos/EditImageDialog.web.tsx +++ b/src/view/com/composer/photos/EditImageDialog.web.tsx @@ -116,7 +116,6 @@ function EditImageInner({ }) { const t = useTheme() const [isDragging, setIsDragging] = useState(false) - const {_} = useLingui() const control = Dialog.useDialogContext() const source = image.source diff --git a/src/view/com/composer/text-input/web/TagDecorator.ts b/src/view/com/composer/text-input/web/TagDecorator.ts index 5af70de6db..f1698d8c4e 100644 --- a/src/view/com/composer/text-input/web/TagDecorator.ts +++ b/src/view/com/composer/text-input/web/TagDecorator.ts @@ -30,7 +30,7 @@ function getDecorations(doc: ProsemirrorNode) { let match while ((match = regex.exec(textContent))) { - const [matchedString, _, tag] = match + const [matchedString, __, tag] = match if (!tag || tag.replace(TRAILING_PUNCTUATION_REGEX, '').length > 64) continue diff --git a/src/view/com/posts/PostFeedErrorMessage.tsx b/src/view/com/posts/PostFeedErrorMessage.tsx index 808ef9fff2..5a8cf904b0 100644 --- a/src/view/com/posts/PostFeedErrorMessage.tsx +++ b/src/view/com/posts/PostFeedErrorMessage.tsx @@ -126,7 +126,7 @@ function FeedgenErrorMessage({ })[knownError], [_l, knownError], ) - const [_, uri] = feedDesc.split('|') + const [__, uri] = feedDesc.split('|') const [ownerDid] = safeParseFeedgenUri(uri) const removePromptControl = Prompt.usePromptControl() const {mutateAsync: removeFeed} = useRemoveFeedMutation() diff --git a/src/view/screens/ModerationMutedAccounts.tsx b/src/view/screens/ModerationMutedAccounts.tsx index 11d787ca11..891a379b61 100644 --- a/src/view/screens/ModerationMutedAccounts.tsx +++ b/src/view/screens/ModerationMutedAccounts.tsx @@ -2,7 +2,6 @@ import {useCallback, useMemo, useState} from 'react' import {type StyleProp, View, type ViewStyle} from 'react-native' import {type AppBskyActorDefs as ActorDefs} from '@atproto/api' import {Trans} from '@lingui/macro' -import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' import {type NativeStackScreenProps} from '@react-navigation/native-stack' @@ -27,7 +26,6 @@ type Props = NativeStackScreenProps< export function ModerationMutedAccounts({}: Props) { const t = useTheme() const moderationOpts = useModerationOpts() - const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() const [isPTRing, setIsPTRing] = useState(false) diff --git a/src/view/screens/ProfileFeedLikedBy.tsx b/src/view/screens/ProfileFeedLikedBy.tsx index d26ff61725..56f3978091 100644 --- a/src/view/screens/ProfileFeedLikedBy.tsx +++ b/src/view/screens/ProfileFeedLikedBy.tsx @@ -1,6 +1,5 @@ import {useCallback} from 'react' import {Trans} from '@lingui/macro' -import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' import { @@ -17,7 +16,6 @@ export const ProfileFeedLikedByScreen = ({route}: Props) => { const setMinimalShellMode = useSetMinimalShellMode() const {name, rkey} = route.params const uri = makeRecordUri(name, 'app.bsky.feed.generator', rkey) - const {_} = useLingui() useFocusEffect( useCallback(() => { diff --git a/yarn.lock b/yarn.lock index dfab6f354a..8497bface3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8603,14 +8603,7 @@ babel-plugin-polyfill-regenerator@^0.6.1: dependencies: "@babel/helper-define-polyfill-provider" "^0.6.3" -babel-plugin-react-compiler@^19.1.0-rc.1: - version "19.1.0-rc.1" - resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-19.1.0-rc.1.tgz#99d131be61017e40abbaedd98321069bf8b7e54a" - integrity sha512-M4fpG+Hfq5gWzsJeeMErdRokzg0fdJ8IAk+JDhfB/WLT+U3WwJWR8edphypJrk447/JEvYu6DBFwsTn10bMW4Q== - dependencies: - "@babel/types" "^7.26.0" - -babel-plugin-react-compiler@^19.1.0-rc.2: +babel-plugin-react-compiler@^19.1.0-rc.2, babel-plugin-react-compiler@^19.1.0-rc.3: version "19.1.0-rc.3" resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-19.1.0-rc.3.tgz#45e5a282a2460b3701971e5eb8310a90a7919022" integrity sha512-mjRn69WuTz4adL0bXGx8Rsyk1086zFJeKmes6aK0xPuK3aaXmDJdLHqwKKMrpm6KAI1MCoUK72d2VeqQbu8YIA== @@ -10824,10 +10817,10 @@ eslint-plugin-lingui@^0.2.0: dependencies: "@typescript-eslint/utils" "^5.61.0" -eslint-plugin-react-compiler@^19.1.0-rc.1: - version "19.1.0-rc.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-compiler/-/eslint-plugin-react-compiler-19.1.0-rc.1.tgz#e974ba9541c9a4464d77723e0505b5742bc22e56" - integrity sha512-3umw5eqZXapBl7aQGmvcjheKhUbsElb9jTETxRZg371e1LG4EPs/zCHt2JzP+wNcdaZWzjU/R730zPUJblY2zw== +eslint-plugin-react-compiler@^19.1.0-rc.2: + version "19.1.0-rc.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-compiler/-/eslint-plugin-react-compiler-19.1.0-rc.2.tgz#83343e7422e00fa61e729af8e8468f0ddec37925" + integrity sha512-oKalwDGcD+RX9mf3NEO4zOoUMeLvjSvcbbEOpquzmzqEEM2MQdp7/FY/Hx9NzmUwFzH1W9SKTz5fihfMldpEYw== dependencies: "@babel/core" "^7.24.4" "@babel/parser" "^7.24.4"