Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add `no-extraneous-dependencies` and `no-nodejs-modules` eslint rules (#10151)

authored by

Samuel Newman and committed by
GitHub
68a4d73d eb566c5f

+66 -72
+12
eslint.config.mjs
··· 189 189 */ 190 190 ignore: ['^#\/locale\/locales\/.+\/messages'], 191 191 }], 192 + 'import-x/no-extraneous-dependencies': ['error', { 193 + 'whitelist': [ 194 + // test files only 195 + '@jest/globals', 196 + // we only use a really simple util from this, and we know it will be present 197 + 'expo-modules-core', 198 + // this is a dep for @atproto/api, but we absolutely need them in sync, so just 199 + // rely on the transient version 200 + '@atproto/common-web', 201 + ] 202 + }], 203 + 'import-x/no-nodejs-modules': 'error', 192 204 193 205 /** 194 206 * TypeScript-specific rules
+1
jest/jestSetup.js
··· 9 9 require('@react-native-async-storage/async-storage/jest/async-storage-mock'), 10 10 ) 11 11 jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter', () => { 12 + // eslint-disable-next-line import-x/no-nodejs-modules 12 13 const {EventEmitter} = require('events') 13 14 return { 14 15 __esModule: true,
-23
jest/test-utils.tsx
··· 1 - import {GestureHandlerRootView} from 'react-native-gesture-handler' 2 - import {SafeAreaProvider} from 'react-native-safe-area-context' 3 - import {render} from '@testing-library/react-native' 4 - 5 - import {ThemeProvider} from '../src/lib/ThemeContext' 6 - import {type RootStoreModel, RootStoreProvider} from '../src/state' 7 - 8 - const customRender = (ui: any, rootStore: RootStoreModel) => 9 - render( 10 - <GestureHandlerRootView style={{flex: 1}}> 11 - <RootStoreProvider value={rootStore}> 12 - <ThemeProvider theme="light"> 13 - <SafeAreaProvider>{ui}</SafeAreaProvider> 14 - </ThemeProvider> 15 - </RootStoreProvider> 16 - </GestureHandlerRootView>, 17 - ) 18 - 19 - // re-export everything 20 - export * from '@testing-library/react-native' 21 - 22 - // override render method 23 - export {customRender as render}
+1 -1
package.json
··· 81 81 "icons:optimize": "svgo -f ./assets/icons" 82 82 }, 83 83 "dependencies": { 84 - "@atproto/api": "^0.19.3", 84 + "@atproto/api": "^0.19.5", 85 85 "@bitdrift/react-native": "^0.6.8", 86 86 "@braintree/sanitize-url": "^6.0.2", 87 87 "@bsky.app/alf": "^0.1.7",
+1 -1
src/components/ageAssurance/AgeAssuranceInitDialog.tsx
··· 1 1 import {useState} from 'react' 2 2 import {View} from 'react-native' 3 - import {XRPCError} from '@atproto/xrpc' 3 + import {XRPCError} from '@atproto/api' 4 4 import {msg} from '@lingui/core/macro' 5 5 import {useLingui} from '@lingui/react' 6 6 import {Trans} from '@lingui/react/macro'
+1 -1
src/components/dialogs/EmailDialog/events.ts
··· 1 1 import {useEffect} from 'react' 2 - import EventEmitter from 'eventemitter3' 2 + import {EventEmitter} from 'eventemitter3' 3 3 4 4 const events = new EventEmitter<{ 5 5 emailVerified: void
+1 -1
src/components/moderation/LabelsOnMeDialog.tsx
··· 1 1 import {useCallback, useMemo, useState} from 'react' 2 2 import {View} from 'react-native' 3 3 import {type ComAtprotoLabelDefs, ToolsOzoneReportDefs} from '@atproto/api' 4 - import {XRPCError} from '@atproto/xrpc' 4 + import {XRPCError} from '@atproto/api' 5 5 import {msg} from '@lingui/core/macro' 6 6 import {useLingui} from '@lingui/react' 7 7 import {Trans} from '@lingui/react/macro'
+1 -1
src/geolocation/service.ts
··· 1 1 import {useEffect, useState} from 'react' 2 - import EventEmitter from 'eventemitter3' 2 + import {EventEmitter} from 'eventemitter3' 3 3 4 4 import {networkRetry} from '#/lib/async/retry' 5 5 import {
+1 -1
src/lib/hooks/useNavigationDeduped.ts
··· 1 1 import {useMemo} from 'react' 2 - import {useNavigation} from '@react-navigation/core' 2 + import {useNavigation} from '@react-navigation/native' 3 3 4 4 import {useDedupe} from '#/lib/hooks/useDedupe' 5 5 import {type NavigationProp} from '#/lib/routes/types'
+1 -1
src/lib/hooks/useWebScrollRestoration.ts
··· 1 1 import {useEffect, useMemo, useState} from 'react' 2 - import {type EventArg, useNavigation} from '@react-navigation/core' 2 + import {type EventArg, useNavigation} from '@react-navigation/native' 3 3 4 4 if ('scrollRestoration' in history) { 5 5 // Tell the brower not to mess with the scroll.
+6 -2
src/lib/media/manip.ts
··· 15 15 import {manipulateAsync, SaveFormat} from 'expo-image-manipulator' 16 16 import * as MediaLibrary from 'expo-media-library' 17 17 import * as Sharing from 'expo-sharing' 18 - import {Buffer} from 'buffer' 19 18 20 19 import {POST_IMG_MAX} from '#/lib/constants' 21 20 import {logger} from '#/logger' ··· 322 321 bytes: Uint8Array, 323 322 type: string, 324 323 ) { 325 - const encoded = Buffer.from(bytes).toString('base64') 324 + // ideally we'd use `bytes.toBase64()`, but that's only baseline newly available 325 + let binary = '' 326 + for (const byte of bytes) { 327 + binary += String.fromCharCode(byte) 328 + } 329 + const encoded = btoa(binary) 326 330 return await saveToDevice(filename, encoded, type) 327 331 } 328 332
+1 -1
src/lib/strings/errors.ts
··· 1 - import {XRPCError} from '@atproto/xrpc' 1 + import {XRPCError} from '@atproto/api' 2 2 import {t} from '@lingui/core/macro' 3 3 4 4 export function cleanError(str: any): string {
+1 -1
src/state/cache/post-shadow.ts
··· 5 5 type AppBskyFeedDefs, 6 6 } from '@atproto/api' 7 7 import {type QueryClient} from '@tanstack/react-query' 8 - import EventEmitter from 'eventemitter3' 8 + import {EventEmitter} from 'eventemitter3' 9 9 10 10 import {batchedUpdates} from '#/lib/batchedUpdates' 11 11 import {findAllPostsInQueryData as findAllPostsInBookmarksQueryData} from '#/state/queries/bookmarks/useBookmarksQuery'
+1 -1
src/state/cache/profile-shadow.ts
··· 1 1 import {useEffect, useMemo, useState} from 'react' 2 2 import {type AppBskyActorDefs, type AppBskyNotificationDefs} from '@atproto/api' 3 3 import {type QueryClient} from '@tanstack/react-query' 4 - import EventEmitter from 'eventemitter3' 4 + import {EventEmitter} from 'eventemitter3' 5 5 6 6 import {batchedUpdates} from '#/lib/batchedUpdates' 7 7 import {findAllProfilesInQueryData as findAllProfilesInActivitySubscriptionsQueryData} from '#/state/queries/activity-subscriptions'
+1 -1
src/state/events.ts
··· 1 - import EventEmitter from 'eventemitter3' 1 + import {EventEmitter} from 'eventemitter3' 2 2 3 3 type UnlistenFn = () => void 4 4
+1 -1
src/state/global-gesture-events/index.tsx
··· 7 7 type GestureUpdateEvent, 8 8 type PanGestureHandlerEventPayload, 9 9 } from 'react-native-gesture-handler' 10 - import EventEmitter from 'eventemitter3' 10 + import {EventEmitter} from 'eventemitter3' 11 11 12 12 export type GlobalGestureEvents = { 13 13 begin: GestureStateChangeEvent<PanGestureHandlerEventPayload>
+2 -2
src/state/messages/convo/agent.ts
··· 5 5 type ChatBskyConvoGetLog, 6 6 type ChatBskyConvoSendMessage, 7 7 } from '@atproto/api' 8 - import {XRPCError} from '@atproto/xrpc' 9 - import EventEmitter from 'eventemitter3' 8 + import {XRPCError} from '@atproto/api' 9 + import {EventEmitter} from 'eventemitter3' 10 10 import {nanoid} from 'nanoid/non-secure' 11 11 12 12 import {networkRetry} from '#/lib/async/retry'
+1 -1
src/state/messages/events/agent.ts
··· 1 1 import {type BskyAgent, type ChatBskyConvoGetLog} from '@atproto/api' 2 - import EventEmitter from 'eventemitter3' 2 + import {EventEmitter} from 'eventemitter3' 3 3 import {nanoid} from 'nanoid/non-secure' 4 4 5 5 import {networkRetry} from '#/lib/async/retry'
+1 -1
src/state/persisted/index.web.ts
··· 1 - import EventEmitter from 'eventemitter3' 1 + import {EventEmitter} from 'eventemitter3' 2 2 3 3 import BroadcastChannel from '#/lib/broadcast' 4 4 import {logger} from '#/logger'
+1 -1
src/state/queries/notifications/unread.tsx
··· 12 12 } from 'react' 13 13 import {AppState} from 'react-native' 14 14 import {useQueryClient} from '@tanstack/react-query' 15 - import EventEmitter from 'eventemitter3' 15 + import {EventEmitter} from 'eventemitter3' 16 16 17 17 import BroadcastChannel from '#/lib/broadcast' 18 18 import {resetBadgeCount} from '#/lib/notifications/notifications'
+1 -1
src/view/com/composer/text-input/textInputWebEmitter.ts
··· 1 - import EventEmitter from 'eventemitter3' 1 + import {EventEmitter} from 'eventemitter3' 2 2 3 3 export const textInputWebEmitter = new EventEmitter()
+1 -1
src/view/com/util/MainScrollProvider.tsx
··· 7 7 withSpring, 8 8 } from 'react-native-reanimated' 9 9 import {useSafeAreaInsets} from 'react-native-safe-area-context' 10 - import EventEmitter from 'eventemitter3' 10 + import {EventEmitter} from 'eventemitter3' 11 11 12 12 import {ScrollProvider} from '#/lib/ScrollContext' 13 13 import {useMinimalShellMode} from '#/state/shell'
+1 -1
src/view/shell/desktop/RightNav.tsx
··· 3 3 import {msg} from '@lingui/core/macro' 4 4 import {useLingui} from '@lingui/react' 5 5 import {Trans} from '@lingui/react/macro' 6 - import {useNavigation} from '@react-navigation/core' 6 + import {useNavigation} from '@react-navigation/native' 7 7 8 8 import {FEEDBACK_FORM_URL, HELP_DESK_URL} from '#/lib/constants' 9 9 import {useKawaiiMode} from '#/state/preferences/kawaii'
+1 -1
src/view/shell/index.web.tsx
··· 36 36 import {RedirectOverlay} from '#/ageAssurance/components/RedirectOverlay' 37 37 import {PassiveAnalytics} from '#/analytics/PassiveAnalytics' 38 38 import {FlatNavigator, RoutesContainer} from '#/Navigation' 39 - import {Composer} from './Composer.web' 39 + import {Composer} from './Composer' 40 40 import {DrawerContent} from './Drawer' 41 41 42 42 function ShellInner() {
+26 -26
yarn.lock
··· 20 20 "@jridgewell/gen-mapping" "^0.3.0" 21 21 "@jridgewell/trace-mapping" "^0.3.9" 22 22 23 - "@atproto/api@^0.19.3": 24 - version "0.19.3" 25 - resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.19.3.tgz#61de8d2e31abe9eb2b4c8f4ad124ed79d4a77e89" 26 - integrity sha512-G8YpBpRouHdTAIagi/QQIUZOhGd1jfBQWkJy9QfxAzjjEpPvaVOSk4e1S85QzGLm/xbzVONzGkmdtiOSfP6wVg== 23 + "@atproto/api@^0.19.5": 24 + version "0.19.5" 25 + resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.19.5.tgz#6388e5d6d3a1693fe04b5f37c705682bac8601d3" 26 + integrity sha512-u6R5TecYJDO8l8QFN09AMuJASYnUkJ4HhYE5hg4/dha/z14a+OAil2/dli/208uM5AHPFLtlnB8kIK9XU5GgQQ== 27 27 dependencies: 28 - "@atproto/common-web" "^0.4.18" 28 + "@atproto/common-web" "^0.4.19" 29 29 "@atproto/lexicon" "^0.6.2" 30 - "@atproto/syntax" "^0.5.0" 30 + "@atproto/syntax" "^0.5.2" 31 31 "@atproto/xrpc" "^0.7.7" 32 32 await-lock "^2.2.2" 33 33 multiformats "^9.9.0" 34 34 tlds "^1.234.0" 35 35 zod "^3.23.8" 36 36 37 - "@atproto/common-web@^0.4.18": 38 - version "0.4.18" 39 - resolved "https://registry.yarnpkg.com/@atproto/common-web/-/common-web-0.4.18.tgz#832976340457afd3d29345ad2c6f0ac0bff087dd" 40 - integrity sha512-ilImzP+9N/mtse440kN60pGrEzG7wi4xsV13nGeLrS+Zocybc/ISOpKlbZM13o+twPJ+Q7veGLw9CtGg0GAFoQ== 37 + "@atproto/common-web@^0.4.18", "@atproto/common-web@^0.4.19": 38 + version "0.4.19" 39 + resolved "https://registry.yarnpkg.com/@atproto/common-web/-/common-web-0.4.19.tgz#bbd7f84f545ebe73ca3bc00314ccf4ee66e7069e" 40 + integrity sha512-3BTi58p5WpT+9/zb6UZrdsXcfPo5P45UJm0E4iwHLILr+jc37CuBj9JReDSZ4U0i9RTrI3ZkfySyZ9bd+LnMsw== 41 41 dependencies: 42 - "@atproto/lex-data" "^0.0.13" 43 - "@atproto/lex-json" "^0.0.13" 44 - "@atproto/syntax" "^0.5.0" 42 + "@atproto/lex-data" "^0.0.14" 43 + "@atproto/lex-json" "^0.0.14" 44 + "@atproto/syntax" "^0.5.1" 45 45 zod "^3.23.8" 46 46 47 - "@atproto/lex-data@^0.0.13": 48 - version "0.0.13" 49 - resolved "https://registry.yarnpkg.com/@atproto/lex-data/-/lex-data-0.0.13.tgz#db1bcfa12d5056210f6eb7f3b8bac909909d6b9c" 50 - integrity sha512-7Z7RwZ1Y/JzBF/Tcn/I4UJ/vIGfh5zn1zjv0KX+flke2JtgFkSE8uh2hOtqgBQMNqE3zdJFM+dcSWln86hR3MQ== 47 + "@atproto/lex-data@^0.0.14": 48 + version "0.0.14" 49 + resolved "https://registry.yarnpkg.com/@atproto/lex-data/-/lex-data-0.0.14.tgz#2f2f3c64699925a0d4785e5afd0e7731ba1d46c0" 50 + integrity sha512-53DUa9664SS76nGAMYopWsO10OH0AAdf7P/HSKB6Wzx3iqe6lk/K61QZnKxOG1LreYl5CfvIJU6eNf4txI6GlQ== 51 51 dependencies: 52 52 multiformats "^9.9.0" 53 53 tslib "^2.8.1" 54 54 uint8arrays "3.0.0" 55 55 unicode-segmenter "^0.14.0" 56 56 57 - "@atproto/lex-json@^0.0.13": 58 - version "0.0.13" 59 - resolved "https://registry.yarnpkg.com/@atproto/lex-json/-/lex-json-0.0.13.tgz#b0081f786aeeb1707087318fb03c928e75c19059" 60 - integrity sha512-hwLhkKaIHulGJpt0EfXAEWdrxqM2L1tV/tvilzhMp3QxPqYgXchFnrfVmLsyFDx6P6qkH1GsX/XC2V36U0UlPQ== 57 + "@atproto/lex-json@^0.0.14": 58 + version "0.0.14" 59 + resolved "https://registry.yarnpkg.com/@atproto/lex-json/-/lex-json-0.0.14.tgz#717e533ab583aa5f580acb2a77d9aa3e7eddaa17" 60 + integrity sha512-6lPkDKqe7teEu4WrN5q7400cvZKgYS3uwUMvzG3F9XkgVYhOwSDCtouV/nSLBbpvo3l9OP0kiigtclcNcyekww== 61 61 dependencies: 62 - "@atproto/lex-data" "^0.0.13" 62 + "@atproto/lex-data" "^0.0.14" 63 63 tslib "^2.8.1" 64 64 65 65 "@atproto/lexicon@^0.6.0", "@atproto/lexicon@^0.6.2": ··· 73 73 multiformats "^9.9.0" 74 74 zod "^3.23.8" 75 75 76 - "@atproto/syntax@^0.5.0": 77 - version "0.5.0" 78 - resolved "https://registry.yarnpkg.com/@atproto/syntax/-/syntax-0.5.0.tgz#061ef538aee784f8e5fa1ea50a7f5beb4c276c9b" 79 - integrity sha512-UA2DSpGdOQzUQ4gi5SH+NEJz/YR3a3Fg3y2oh+xETDSiTRmA4VhHRCojhXAVsBxUT6EnItw190C/KN+DWW90kw== 76 + "@atproto/syntax@^0.5.0", "@atproto/syntax@^0.5.1", "@atproto/syntax@^0.5.2": 77 + version "0.5.2" 78 + resolved "https://registry.yarnpkg.com/@atproto/syntax/-/syntax-0.5.2.tgz#d4b32c9feb421ceeb5ade1fa80bc42764d51e52e" 79 + integrity sha512-W41szOnkppoHr0iCUrzL8gy3OD6qmDyp1UvUgmTx2oFQfgbudpz51T/gznesiCcqiUT5obfHdx4PJ+WdlEOE7Q== 80 80 dependencies: 81 81 tslib "^2.8.1" 82 82