Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions app/web/eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ export default defineConfigWithVueTs(
// dont want this
"@typescript-eslint/consistent-type-imports": 0,
"import/named": 0,

// warning on this because we have some shenanigans where it is a promise but a literal `await` is not present
"@typescript-eslint/require-await": "warn",
"@typescript-eslint/require-await": 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is the only one I'm curious about. We don't want this to be "error" (2)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both in the pinia stores, and in the web worker ... basically, we know that with Comlink, things return a promise, so its an async function, even if there isn't an await inside of it... and the same goes to the pinia store... there isn't an await, but the funcs have to be async for the plugin that we wrote to work


// "prettier/prettier": "warn",
"@typescript-eslint/quotes": 0,
Expand All @@ -103,10 +101,11 @@ export default defineConfigWithVueTs(
"no-await-in-loop": 0,
"no-lonely-if": 0,
"@typescript-eslint/no-unused-vars": [
"warn",
"error",
{
argsIgnorePattern: "^_|^(response)$",
varsIgnorePattern: "^_|^(props|emit)$",
caughtErrorsIgnorePattern: "^_",
},
],
"@typescript-eslint/return-await": 0,
Expand All @@ -116,7 +115,7 @@ export default defineConfigWithVueTs(
// curly: ["error", "multi-line"],
// "brace-style": "error",
"max-len": [
"warn", // just a warning since prettier will enforce
"off", // prettier will enforce
120,
2,
{
Expand Down Expand Up @@ -167,9 +166,9 @@ export default defineConfigWithVueTs(
"@typescript-eslint/no-shadow": 0,
"guard-for-in": 0,

"no-console": "error",
// some rules to downgrade to warning while developing --------------------
// useful so things dont crash when code is temporarily commented out
"no-console": "warn",
"@typescript-eslint/no-empty-function": "warn",
"no-debugger": "warn",
"no-alert": "warn",
Expand All @@ -192,6 +191,12 @@ export default defineConfigWithVueTs(
// useful while debugging and commenting things out, otherwise gets automatically changed from let to const
// "no-autofix/prefer-const": "warn",

// not clear to me why we have these problems
"import/no-named-as-default": 0,
"import/no-named-as-default-member": 0,

"@typescript-eslint/no-empty-function": 0,

"vue/block-order": [
"error",
{
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/components/CachedAppNotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function check() {
if (runningHash && latestHash !== runningHash) {
openModal();
}
} catch (err) {
} catch (_err) {
// local dev errors here because the manifest file doesn't exist
stopInterval();
}
Expand Down
6 changes: 3 additions & 3 deletions app/web/src/newhotness/FuncRunDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const functionCode = computed<string>(() => {
try {
const decodedCode = atob(funcRun.value.functionCodeBase64);
return decodedCode;
} catch (e) {
} catch (_e) {
return "// Error decoding function code";
}
});
Expand All @@ -300,7 +300,7 @@ const argsJson = computed<string>(() => {

try {
return JSON.stringify(funcRun.value.functionArgs, null, 2);
} catch (e) {
} catch (_e) {
return "// Error formatting arguments";
}
});
Expand All @@ -311,7 +311,7 @@ const resultJson = computed<string>(() => {

try {
return JSON.stringify(funcRun.value.resultValue, null, 2);
} catch (e) {
} catch (_e) {
return "// Error formatting result";
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/newhotness/LatestFuncRunDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const functionCode = computed(() => actionDetailQuery.data.value?.code);
const argsJson = computed(() => {
try {
return JSON.stringify(actionDetailQuery.data.value?.args, null, 2);
} catch (e) {
} catch (_e) {
return "// Error formatting arguments";
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/newhotness/Review.vue
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ const restoreComponent = async () => {
await sleep(1000);
const result = await restoreComponents([selectedComponent.value.id]);
restoreComponentStatus.value = result.success ? "succeeded" : undefined;
} catch (e) {
} catch (_e) {
restoreComponentStatus.value = undefined;
}
};
Expand Down
8 changes: 4 additions & 4 deletions app/web/src/newhotness/StatusPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const STATUS_PANEL_KEY = "statusPanel";
realtimeStore.subscribe(STATUS_PANEL_KEY, `workspace/${ctx.workspacePk.value}`, [
{
eventType: "ChangeSetStatusChanged",
callback: async (data) => {
callback: (data) => {
if (
[ChangeSetStatus.Abandoned, ChangeSetStatus.Applied, ChangeSetStatus.Closed].includes(data.changeSet.status) &&
data.changeSet.id !== ctx.headChangeSetId.value
Expand All @@ -102,7 +102,7 @@ realtimeStore.subscribe(STATUS_PANEL_KEY, `workspace/${ctx.workspacePk.value}`,
},
{
eventType: "ManagementOperationsComplete",
callback: async (payload, meta) => {
callback: (payload, meta) => {
if (!payload.requestUlid) return;
const key = `management-${payload.requestUlid}`;
if (superBucket[meta.change_set_id]?.[key]) {
Expand All @@ -113,7 +113,7 @@ realtimeStore.subscribe(STATUS_PANEL_KEY, `workspace/${ctx.workspacePk.value}`,
},
{
eventType: "ManagementOperationsFailed",
callback: async (payload, meta) => {
callback: (payload, meta) => {
// BUCKET ITEM -- ADD -- MANAGEMENT FUNCS
const key = `management-${payload.requestUlid}`;
let bucket = superBucket[meta.change_set_id];
Expand All @@ -126,7 +126,7 @@ realtimeStore.subscribe(STATUS_PANEL_KEY, `workspace/${ctx.workspacePk.value}`,
},
{
eventType: "ManagementOperationsInProgress",
callback: async (payload, meta) => {
callback: (payload, meta) => {
// BUCKET ITEM -- ADD -- MANAGEMENT FUNCS
const key = `management-${payload.requestUlid}`;
let bucket = superBucket[meta.change_set_id];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const useRainbow = (changeSetId: ComputedRef<ChangeSetId>) => {
* When its > 0 the system is waiting for data
*/
return { count: computed(() => queue?.size ?? 0) };
} catch (err) {
} catch (_err) {
return { count: 0 };
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/newhotness/logic_composables/watched_form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const useWatchedForm = <Data extends Record<string, string>>(label: strin
try {
await onSubmit(props);
hasSubmitted = true;
} catch (e) {
} catch (_e) {
// TODO report errors and display on caller forms
// Cancel the spinner and bifrosting on failure
markComplete();
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/store/auth.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export const useAuthStore = () => {
},
});
}
} catch (error) {
} catch (_error) {
// Silently fail - logout will still clear local state
}

Expand Down
10 changes: 3 additions & 7 deletions app/web/src/store/realtime/heimdall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,17 +320,13 @@ db.getConnections().then((conns) => {
});
});

const updateConnectionStatus: ConnStatusFn = async (
workspaceId: WorkspacePk,
connected: boolean,
noBroadcast?: boolean,
) => {
const updateConnectionStatus: ConnStatusFn = (workspaceId: WorkspacePk, connected: boolean, noBroadcast?: boolean) => {
_wsConnections.value[workspaceId] = connected;

// always update to connected
if (connected) wsConnections.value[workspaceId] = connected;

await db.setConnections({ ..._wsConnections.value });
db.setConnections({ ..._wsConnections.value });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that we don't await non-async things! Is this enforced by require-await? Seems like a hidden feature of that rule.


// prevent blips in the UI from quick disconnect -> connect flips
setTimeout(() => {
Expand Down Expand Up @@ -691,7 +687,7 @@ const fetchOpenChangeSets = async (workspaceId: WorkspacePk): Promise<WorkspaceM
url: `v2/workspaces/${workspaceId}/change-sets`,
});
return resp.data;
} catch (err) {
} catch (_err) {
return {
name: "",
id: "",
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/store/realtime/realtime.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export const useRealtimeStore = defineStore("realtime", () => {
// toRebaseChangeSetId is HEAD / where merges are going into
try {
topics.push(`changeset/${eventData.toRebaseChangeSetId}`);
} catch (err) {
} catch (_err) {
// do nothing
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/workers/types/dbinterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export type UpdateFn = (
noBroadcast?: boolean,
) => void;
export type RainbowFn = (changeSetId: ChangeSetId, label: string, noBroadcast?: boolean) => void;
export type LobbyExitFn = (workspacePk: string, changeSetId: string, noBroadcast?: boolean) => void;
export type LobbyExitFn = (workspacePk: string, changeSetId: string, noBroadcast?: boolean) => Promise<void>;

export type MjolnirBulk = Array<{
kind: EntityKind;
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/workers/webworker.mess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ async function go() {
db.addListenerInFlight(Comlink.proxy(() => {}));
db.addListenerReturned(Comlink.proxy(() => {}));
db.addAtomUpdated(Comlink.proxy(() => {}));
db.addListenerLobbyExit(Comlink.proxy(() => {}));
db.addListenerLobbyExit(Comlink.proxy(async () => {}));
db.addConnStatusFn(Comlink.proxy(() => {}));
await db.initDB(true);
await db.migrate(true);
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/workers/webworker.perf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ async function go() {
db.addListenerInFlight(Comlink.proxy(() => {}));
db.addListenerReturned(Comlink.proxy(() => {}));
db.addAtomUpdated(Comlink.proxy(() => {}));
db.addListenerLobbyExit(Comlink.proxy(() => {}));
db.addListenerLobbyExit(Comlink.proxy(async () => {}));
db.addConnStatusFn(Comlink.proxy(() => {}));
await db.initDB(true);
await db.migrate(true);
Expand Down
3 changes: 1 addition & 2 deletions app/web/src/workers/webworker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
NOROW,
WorkspacePatchBatch,
AtomDocument,
OutgoingConnections,
WorkspaceIndexUpdate,
MessageKind,
} from "@/workers/types/dbinterface";
Expand Down Expand Up @@ -5422,7 +5421,7 @@ async function go() {
db.addListenerInFlight(Comlink.proxy(() => {}));
db.addListenerReturned(Comlink.proxy(() => {}));
db.addAtomUpdated(Comlink.proxy(() => {}));
db.addListenerLobbyExit(Comlink.proxy(() => {}));
db.addListenerLobbyExit(Comlink.proxy(async () => {}));
db.addConnStatusFn(Comlink.proxy(() => {}));
await db.initDB(true);
await db.migrate(true);
Expand Down
4 changes: 2 additions & 2 deletions app/web/src/workers/webworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ const handleWorkspacePatchMessage = async (db: Database, data: WorkspacePatchBat
try {
await initIndexAndChangeSet(db, data.meta, span);
await updateChangeSetWithNewIndex(db, data.meta);
} catch (err) {
} catch (_err) {
error("Failed to handle empty patch", data);
}
span.end();
Expand Down Expand Up @@ -1455,7 +1455,7 @@ const handlePatchOperations = async (
for (const atom of atomsToInsert) {
try {
await postProcess(db, workspaceId, changeSetId, atom.kind, atom.doc, atom.id, indexChecksum, false, true);
} catch (err) {
} catch (_err) {
error("Failed to post process atom", atom, error);
}
}
Expand Down