Enable and fix custom eslint rules
This commit is contained in:
parent
ca929a37d1
commit
9f3789e032
8 changed files with 38 additions and 23 deletions
|
|
@ -17,7 +17,7 @@ function mkNote(text: string, ...children: string[]): Note {
|
|||
return note;
|
||||
}
|
||||
|
||||
function createSomeNotes() {
|
||||
function createSomeNotes(): void {
|
||||
notes.clearNotes();
|
||||
|
||||
const n2n1 = mkNote("n2n1");
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@ const { floatingStyles } = useFloating(reference, floating, {
|
|||
],
|
||||
});
|
||||
|
||||
function onAddNewRepo() {
|
||||
function onAddNewRepo(): void {
|
||||
const id = crypto.randomUUID();
|
||||
repos.addRepo({ id, name: id });
|
||||
console.log(repos.selectedRepo);
|
||||
open.value = false;
|
||||
}
|
||||
|
||||
function onSelectRepo(id: string) {
|
||||
function onSelectRepo(id: string): void {
|
||||
repos.selectRepo(id);
|
||||
open.value = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,11 +76,11 @@ watchEffect(() => {
|
|||
if (mode.value) focusOnThis();
|
||||
});
|
||||
|
||||
function focusOnThis() {
|
||||
function focusOnThis(): void {
|
||||
ui.focusPath = props.path;
|
||||
}
|
||||
|
||||
function onClick() {
|
||||
function onClick(): void {
|
||||
if (!focused.value) {
|
||||
focusOnThis();
|
||||
return;
|
||||
|
|
@ -89,36 +89,36 @@ function onClick() {
|
|||
ui.toggleOpen(props.path);
|
||||
}
|
||||
|
||||
function onPinButtonClick() {
|
||||
function onPinButtonClick(): void {
|
||||
if (pinned.value) ui.unsetPinned();
|
||||
else ui.setPinned(props.segment, props.parentId);
|
||||
}
|
||||
|
||||
function onEditButtonClick() {
|
||||
function onEditButtonClick(): void {
|
||||
if (!note.value) return;
|
||||
mode.value = "editing";
|
||||
}
|
||||
|
||||
function onEditEditorClose() {
|
||||
function onEditEditorClose(): void {
|
||||
mode.value = undefined;
|
||||
}
|
||||
|
||||
function onEditEditorFinish(text: string) {
|
||||
function onEditEditorFinish(text: string): void {
|
||||
if (!note.value) return;
|
||||
note.value.text = text;
|
||||
onEditEditorClose();
|
||||
}
|
||||
|
||||
function onCreateButtonClick() {
|
||||
function onCreateButtonClick(): void {
|
||||
if (!note.value) return;
|
||||
mode.value = "creating";
|
||||
}
|
||||
|
||||
function onCreateEditorClose() {
|
||||
function onCreateEditorClose(): void {
|
||||
mode.value = undefined;
|
||||
}
|
||||
|
||||
function onCreateEditorFinish(text: string) {
|
||||
function onCreateEditorFinish(text: string): void {
|
||||
if (!note.value) return;
|
||||
|
||||
const newNote = notes.createNote(text);
|
||||
|
|
|
|||
|
|
@ -20,17 +20,17 @@ onMounted(() => {
|
|||
updateTextareaHeight();
|
||||
});
|
||||
|
||||
function updateTextareaHeight() {
|
||||
function updateTextareaHeight(): void {
|
||||
if (!textarea.value) return;
|
||||
textarea.value.style.height = "0px";
|
||||
textarea.value.style.height = `${textarea.value.scrollHeight.toFixed()}px`;
|
||||
}
|
||||
|
||||
function onInput() {
|
||||
function onInput(): void {
|
||||
updateTextareaHeight();
|
||||
}
|
||||
|
||||
function onKeyPress(ev: KeyboardEvent) {
|
||||
function onKeyPress(ev: KeyboardEvent): void {
|
||||
if (ev.key === "Escape") {
|
||||
emit("close");
|
||||
} else if (ev.key === "Enter" && !ev.shiftKey) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export const useNotesStore = defineStore("notes", () => {
|
|||
return notes.value.get(id)!; // Re-getting so returned Note is reactive
|
||||
}
|
||||
|
||||
function clearNotes() {
|
||||
function clearNotes(): void {
|
||||
notes.value.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ export const useReposStore = defineStore("repos", () => {
|
|||
|
||||
const repoIdsByName = computed<string[]>(() => reposByName.value.map((it) => it.id));
|
||||
|
||||
function addRepo(repo: Repo) {
|
||||
function addRepo(repo: Repo): void {
|
||||
repos.value.set(repo.id, repo);
|
||||
selectedRepoId.value = repo.id;
|
||||
}
|
||||
|
||||
function removeRepo(id: string | undefined) {
|
||||
function removeRepo(id: string | undefined): void {
|
||||
if (id === undefined) return;
|
||||
const i = repoIdsByName.value.indexOf(id);
|
||||
repos.value.delete(id);
|
||||
|
|
@ -38,7 +38,7 @@ export const useReposStore = defineStore("repos", () => {
|
|||
}
|
||||
}
|
||||
|
||||
function selectRepo(id: string | undefined) {
|
||||
function selectRepo(id: string | undefined): void {
|
||||
if (id === undefined) return;
|
||||
if (repos.value.get(id) === undefined) return;
|
||||
selectedRepoId.value = id;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export const useUiStore = defineStore("ui", () => {
|
|||
return openPaths.value.has(path.fmt());
|
||||
}
|
||||
|
||||
function setOpen(path: UiPath, value: boolean) {
|
||||
function setOpen(path: UiPath, value: boolean): void {
|
||||
// Don't update openPaths unnecessarily.
|
||||
// Just in case vue itself doesn't debounce Set operations.
|
||||
if (value && !isOpen(path)) {
|
||||
|
|
@ -33,7 +33,7 @@ export const useUiStore = defineStore("ui", () => {
|
|||
}
|
||||
}
|
||||
|
||||
function toggleOpen(path: UiPath) {
|
||||
function toggleOpen(path: UiPath): void {
|
||||
setOpen(path, !isOpen(path));
|
||||
}
|
||||
|
||||
|
|
@ -42,11 +42,11 @@ export const useUiStore = defineStore("ui", () => {
|
|||
return pinned.value.segment.eq(segment) && pinned.value.parentId === parentId;
|
||||
}
|
||||
|
||||
function setPinned(segment: Segment, parentId?: string) {
|
||||
function setPinned(segment: Segment, parentId?: string): void {
|
||||
pinned.value = { segment, parentId };
|
||||
}
|
||||
|
||||
function unsetPinned() {
|
||||
function unsetPinned(): void {
|
||||
pinned.value = undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue