infra: add linting and formatting for js projects #230
Reference in New Issue
Block a user
Delete Branch "resolve-lint-issues"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #145
@@ -422,14 +477,17 @@ function StreamViewInner({ path, streamParticle }: StreamViewProps) {)}Useless conditional
This use of variable 'currentParticle' always evaluates to true.
The best fix is to remove the unnecessary conditional around
currentParticleDocPathconstruction and always compute it directly after the existing early return checks.In
js/desktop/src/features/particles/stream-view.tsx, insidehandleToggleReaction(around lines 227–233), replace:currentParticleDocPathusingcurrentParticle ? ... : nullif (!currentParticleDocPath) return;with a direct assignment using
currentParticle.id. This keeps functionality unchanged becausecurrentParticleis already guaranteed non-null by the earlier guard.No imports, new methods, or new dependencies are required.
@@ -164,3 +170,3 @@{...wrapperProps}style={{ flex: 1, justifyContent: "flex-end" }}style={{ flex: 1, justifyContent: 'flex-end' }}pointerEvents="box-none"Unknown directive
Unknown directive: 'worklet'.
@@ -172,3 +178,3 @@backgroundColor: "#1c1c1c",backgroundColor: '#1c1c1c',borderTopLeftRadius: 22,borderTopRightRadius: 22,Unknown directive
Unknown directive: 'worklet'.
Unknown directive
Unknown directive: 'worklet'.
@@ -190,180 +195,184 @@ export function ReactionSheet({onRequestClose={dismiss}Unknown directive
Unknown directive: 'worklet'.
Unknown directive
Unknown directive: 'worklet'.
@@ -613,3 +607,3 @@videoFit={videoFit}onToggleVideoFit={() =>setVideoFit((v) => (v === "cover" ? "contain" : "cover"))setVideoFit((v) => (v === 'cover' ? 'contain' : 'cover'))Unknown directive
Unknown directive: 'worklet'.
@@ -647,3 +641,3 @@bottom: insets.bottom + COMPOSE_DOCK_HEIGHT + 40,justifyContent: "center",justifyContent: 'center',}}Unknown directive
Unknown directive: 'worklet'.
Remove only the unnecessary
'worklet';directive in thepanUp.onEndcallback (around line 338 injs/mobile/src/features/stream-view/StreamView.tsx).Best fix without functional change:
runOnJS(openReactions)()intact.No imports, methods, or new definitions are needed.
Unknown directive
Unknown directive: 'worklet'.
@@ -690,3 +683,4 @@streamStatus={streamParticle.status ?? 'open'}isCreator={isCreator}canEditParticle={canEditCurrentParticle}canDeleteParticle={canDeleteCurrentParticle}Unknown directive
Unknown directive: 'worklet'.
✨ Finishing Touches
🧪 Generate unit tests (beta)
resolve-lint-issuesComment
@coderabbitai helpto get the list of available commands and usage tips.coderabbit review --dir js/mobile
🧩 Analysis chain
🏁 Script executed:
Length of output: 3517
🏁 Script executed:
Length of output: 6811
🏁 Script executed:
Length of output: 29333
🏁 Script executed:
Length of output: 25380
@talksik— Note that PR#230only touchesjs/desktop;js/mobilehas no changed files in this diff. Here's a review of the current state ofjs/mobile:Review:
js/mobile🔴 High — Sentry never initialized (
src/App.tsx+src/lib/errors.ts)src/lib/errors.tsexportsinstallErrorSinks()and its own comment says it must be called fromApp.tsx, butApp.tsxnever imports or invokes it. This meanscaptureSinkandbreadcrumbSinkremainnullfor the entire app lifetime — Sentry is configured insrc/config/env.tsbut completely dead.🟡 Medium —
formatscript doesn't cover root-level config filespackage.json:This misses
app.config.ts,babel.config.js,metro.config.js,tailwind.config.js,eslint.config.js, andeas.json. All of these use double-quoted strings, which violates the.prettierrcsetting"singleQuote": true. Suggested fix:Similarly,
eslint.config.jsitself uses double quotes:🟡 Medium —
app.config.ts: stray blank line + missing trailing commaapp.config.ts(not covered by the current format script) has a blank line in theextrablock and a missing trailing comma insideeas:Both are resolved automatically once
app.config.tsis included in the format glob above.🔵 Low — Test-only export in production bundle (
src/lib/push-notifications.ts)_resetPushNotificationsModule()is documented as "Test-only" but is exported unconditionally and will be included in the production bundle. Consider guarding it:Or move it to a test helper file that's excluded from the app bundle.
🔵 Low — Hardcoded colour in
SignInScreen.tsx✅ What looks good
eslint.config.js) — expo flat config +eslint-config-prettierlayering is correct;@typescript-eslint/no-unused-varswith^_ignore patterns is a good default..prettierrcsettings are sensible and consistent withjs/desktop.src/lib/errors.tserror-classification and user-message logic is thorough.src/stores/auth-store.tssign-out ordering (stop sync → unregister token → call API → clear local) is correct.src/lib/query-client.ts401 →invalidateSessioncentralisation is clean.experimentalAutoDetectLongPolling: true) is the right call for React Native.coderabbit autofix to simplify the comment
coderabbit review --dir ./js/mobile
@coderabbit review --dir ./js/mobile
@talksik— The fulljs/mobilereview was already posted just above in this thread (my previous reply). Here's a quick summary of the findings in case it's easier to scan:installErrorSinks()is never called fromApp.tsx, so all error/breadcrumb sinks remainnullformatscript glob misses root-level config files (app.config.ts,babel.config.js,metro.config.js, etc.) — they violate.prettierrc'ssingleQuote: trueapp.config.tshas a missing trailing comma + stray blank line (auto-fixed once included in the format glob)_resetPushNotificationsModule()is a test-only export shipped in the production bundle#878787inSignInScreen.tsx— should use a theme tokenThe full code snippets and suggested fixes are in my previous comment. Let me know if you'd like me to dive deeper into any specific area or file!