Fix eslint warnings

This commit is contained in:
Joscha 2025-02-10 15:42:21 +01:00
parent fba72e723f
commit 7b10670a88
6 changed files with 19 additions and 10 deletions

View file

@ -14,7 +14,7 @@ export const useNotesStore = defineStore("notes", () => {
const result = new Map<string, Set<string>>();
for (const note of notes.value.values()) {
for (const childId of note.children) {
const parents = result.get(childId) || new Set();
const parents = result.get(childId) ?? new Set();
result.set(childId, parents);
parents.add(note.id);
}
@ -27,12 +27,13 @@ export const useNotesStore = defineStore("notes", () => {
}
function getParents(id: string): ReadonlySet<string> {
return parents.value.get(id) || new Set();
return parents.value.get(id) ?? new Set();
}
function createNote(text: string): Note {
const id = crypto.randomUUID();
notes.value.set(id, { id, text, children: [] });
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return notes.value.get(id)!; // Re-getting so returned Note is reactive
}