Skip to content

Commit 773f400

Browse files
author
Evie Gauthier
committed
fix: resolve quality check issues after rebase
- Fix debugLogger.ts: reorder atoms to avoid use-before-define - Fix slidingSync.ts: replace ++ with += 1 for no-plusplus rule - Fix instrument.ts: add eslint-disable for param reassigns and console - Fix index.tsx: correct import order and add button type attribute - Fix formatting with prettier on all files - Rebased on latest origin/dev
1 parent f19db78 commit 773f400

File tree

10 files changed

+32
-31
lines changed

10 files changed

+32
-31
lines changed

.github/workflows/sync-fork.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
run: |
4848
echo "Current ref: ${{ github.ref }}"
4949
echo "Event name: ${{ github.event_name }}"
50-
50+
5151
# Check if this was triggered by a feature branch push
5252
if [[ "${{ github.ref }}" =~ ^refs/heads/(feat|fix|perf|chore|docs|style|refactor|test)/ ]]; then
5353
echo "FEATURE_PUSH=true" >> $GITHUB_ENV
@@ -131,12 +131,12 @@ jobs:
131131
if: env.SHOULD_UPDATE_INTEGRATION == 'true'
132132
run: |
133133
echo "Recreating integration/all-features from dev"
134-
134+
135135
# Delete and recreate integration branch (create if doesn't exist)
136136
git checkout dev
137137
git branch -D integration/all-features 2>/dev/null || true
138138
git checkout -b integration/all-features origin/dev
139-
139+
140140
# Merge all feature branches into integration
141141
BRANCHES=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin/ | \
142142
grep -E '^origin/(feat|fix|perf|chore|docs|style|refactor|test)/' | \
@@ -160,7 +160,7 @@ jobs:
160160
echo ""
161161
done
162162
fi
163-
163+
164164
# Force push integration branch (it's a working branch)
165165
git push origin integration/all-features --force
166166

src/app/features/create-room/CreateRoom.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ import {
4141
import { RoomType } from '$types/matrix/room';
4242
import { CreateRoomTypeSelector } from '$components/create-room/CreateRoomTypeSelector';
4343
import { getRoomIconSrc } from '$utils/room';
44-
import { ErrorCode } from '../../cs-errorcode';
4544
import { createDebugLogger } from '$utils/debugLogger';
45+
import { ErrorCode } from '../../cs-errorcode';
4646

4747
const debugLog = createDebugLogger('CreateRoom');
4848

src/app/features/room/Room.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import { useRoomMembers } from '$hooks/useRoomMembers';
1515
import { CallView } from '$features/call/CallView';
1616
import { WidgetsDrawer } from '$features/widgets/WidgetsDrawer';
1717
import { callChatAtom } from '$state/callEmbed';
18+
import { createDebugLogger } from '$utils/debugLogger';
1819
import { RoomViewHeader } from './RoomViewHeader';
1920
import { MembersDrawer } from './MembersDrawer';
2021
import { RoomView } from './RoomView';
2122
import { CallChatView } from './CallChatView';
22-
import { createDebugLogger } from '$utils/debugLogger';
2323

2424
const debugLog = createDebugLogger('Room');
2525

src/app/features/settings/notifications/PushNotifications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { MatrixClient } from '$types/matrix-sdk';
2-
import { ClientConfig } from '../../../hooks/useClientConfig';
32
import { createDebugLogger } from '$utils/debugLogger';
3+
import { ClientConfig } from '../../../hooks/useClientConfig';
44

55
const debugLog = createDebugLogger('PushNotifications');
66

src/app/state/debugLogger.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
*/
44
import { atom } from 'jotai';
55
import { atomWithRefresh } from 'jotai/utils';
6-
import { getDebugLogger, LogEntry } from '$utils/debugLogger';
6+
import { getDebugLogger } from '$utils/debugLogger';
77

88
const debugLogger = getDebugLogger();
99

10+
/**
11+
* Atom for retrieving debug logs with refresh capability
12+
*/
13+
export const debugLogsAtom = atomWithRefresh(() => debugLogger.getLogs());
14+
1015
/**
1116
* Atom for enabling/disabling debug logging
1217
*/
@@ -19,21 +24,10 @@ export const debugLoggerEnabledAtom = atom(
1924
}
2025
);
2126

22-
/**
23-
* Atom for retrieving debug logs with refresh capability
24-
*/
25-
export const debugLogsAtom = atomWithRefresh(() => debugLogger.getLogs());
26-
2727
/**
2828
* Atom for filtered logs
2929
*/
30-
export const filteredDebugLogsAtom = atom(
31-
(get) => get(debugLogsAtom),
32-
(get, set, filters?: { level?: string; category?: string; since?: number }) => {
33-
const allLogs = get(debugLogsAtom);
34-
return allLogs; // Can be extended with filtering logic
35-
}
36-
);
30+
export const filteredDebugLogsAtom = atom((get) => get(debugLogsAtom));
3731

3832
/**
3933
* Action to clear all debug logs
@@ -46,6 +40,4 @@ export const clearDebugLogsAtom = atom(null, (_, set) => {
4640
/**
4741
* Action to export debug logs
4842
*/
49-
export const exportDebugLogsAtom = atom(null, () => {
50-
return debugLogger.exportLogs();
51-
});
43+
export const exportDebugLogsAtom = atom(null, () => debugLogger.exportLogs());

src/app/utils/debugLogger.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ type LogListener = (entry: LogEntry) => void;
3131

3232
class DebugLoggerService {
3333
private logs: LogEntry[] = [];
34+
3435
private maxLogs = 1000; // Circular buffer size
36+
3537
private enabled = false;
38+
3639
private listeners: Set<LogListener> = new Set();
3740

3841
constructor() {
@@ -123,7 +126,7 @@ class DebugLoggerService {
123126
}
124127

125128
if (filters?.since) {
126-
const since = filters.since;
129+
const { since } = filters;
127130
filtered = filtered.filter((log) => log.timestamp >= since);
128131
}
129132

src/client/initMatrix.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,8 @@ const disposeSlidingSync = (mx: MatrixClient): void => {
354354
slidingSyncByClient.delete(mx);
355355
};
356356

357-
export const getSlidingSyncManager = (mx: MatrixClient): SlidingSyncManager | undefined => {
358-
return slidingSyncByClient.get(mx);
359-
};
357+
export const getSlidingSyncManager = (mx: MatrixClient): SlidingSyncManager | undefined =>
358+
slidingSyncByClient.get(mx);
360359

361360
export const startClient = async (mx: MatrixClient, config?: StartClientConfig): Promise<void> => {
362361
debugLog.info('sync', 'Starting Matrix client', { userId: mx.getUserId() });

src/client/slidingSync.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
MSC3575_STATE_KEY_ME,
1515
EventType,
1616
User,
17-
SlidingSyncEventHandlerMap,
1817
} from '$types/matrix-sdk';
1918
import { createLogger } from '$utils/debug';
2019
import { createDebugLogger } from '$utils/debugLogger';
@@ -369,7 +368,7 @@ export class SlidingSyncManager {
369368

370369
this.onLifecycle = (state, resp, err) => {
371370
const syncStartTime = performance.now();
372-
this.syncCount++;
371+
this.syncCount += 1;
373372

374373
debugLog.info('sync', `Sliding sync lifecycle: ${state} (cycle #${this.syncCount})`, {
375374
state,

src/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import '@fontsource/space-mono/400-italic.css';
1111
import '@fontsource/space-mono/700-italic.css';
1212
import 'folds/dist/style.css';
1313
import { configClass, varsClass } from 'folds';
14+
import * as Sentry from '@sentry/react';
1415
import { trimTrailingSlash } from './app/utils/common';
1516
import App from './app/pages/App';
1617
import './app/i18n';
17-
import * as Sentry from '@sentry/react';
1818

1919
import './index.css';
2020
import './app/styles/themes.css';
@@ -157,7 +157,9 @@ const mountApp = () => {
157157
<div style={{ padding: '2rem', textAlign: 'center' }}>
158158
<h1>Something went wrong</h1>
159159
<p>{error instanceof Error ? error.message : 'An unexpected error occurred'}</p>
160-
<button onClick={resetError}>Try again</button>
160+
<button type="button" onClick={resetError}>
161+
Try again
162+
</button>
161163
</div>
162164
)}
163165
showDialog

src/instrument.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ if (dsn) {
9090
event.message.includes('token')
9191
) {
9292
// You can choose to drop the event entirely or redact it
93+
// eslint-disable-next-line no-param-reassign
9394
event.message = event.message.replace(/access_token=[^&\s]+/g, 'access_token=[REDACTED]');
95+
// eslint-disable-next-line no-param-reassign
9496
event.message = event.message.replace(/password=[^&\s]+/g, 'password=[REDACTED]');
9597
}
9698
}
@@ -99,10 +101,12 @@ if (dsn) {
99101
if (event.exception?.values) {
100102
event.exception.values.forEach((exception) => {
101103
if (exception.value) {
104+
// eslint-disable-next-line no-param-reassign
102105
exception.value = exception.value.replace(
103106
/access_token=[^&\s]+/g,
104107
'access_token=[REDACTED]'
105108
);
109+
// eslint-disable-next-line no-param-reassign
106110
exception.value = exception.value.replace(/password=[^&\s]+/g, 'password=[REDACTED]');
107111
}
108112
});
@@ -112,7 +116,9 @@ if (dsn) {
112116
},
113117
});
114118

119+
// eslint-disable-next-line no-console
115120
console.info(`[Sentry] Initialized for ${environment} environment`);
116121
} else {
122+
// eslint-disable-next-line no-console
117123
console.info('[Sentry] Disabled - no DSN provided');
118124
}

0 commit comments

Comments
 (0)