Skip to content

Commit

Permalink
fix(eslint): add JSON rule for unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
ksenia_subbotina committed Aug 11, 2024
1 parent 5670634 commit 59879ca
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/application/services/useNote.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { onMounted, ref, type Ref, type MaybeRefOrGetter, computed, toValue, watch } from 'vue';
import { onMounted, ref, type Ref, type MaybeRefOrGetter, computed, toValue, watch, type ComputedRef } from 'vue';
import { noteService, editorToolsService } from '@/domain';
import type { Note, NoteContent, NoteId } from '@/domain/entities/Note';
import type { NoteTool } from '@/domain/entities/Note';
Expand Down Expand Up @@ -139,15 +139,15 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt
/**
* Note Title identifier
*/
const noteTitle = computed(() => {
const noteTitle: ComputedRef<string> = computed(() => {
const noteContent = lastUpdateContent.value ?? note.value?.content;

const firstNoteBlock = noteContent?.blocks[0];

if (!firstNoteBlock || !Boolean(firstNoteBlock.data.text)) {
return 'Note';
} else {
return firstNoteBlock.data.text.slice(0, limitCharsForNoteTitle);
return firstNoteBlock.data.text.slice(0, limitCharsForNoteTitle) as string;
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/infrastructure/storage/abstract/persistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class PersistantStore<StoreData extends Record<string, unknown>> extends
}
},

set: (target, prop, value, receiver) => {
set: (target, prop, value: StoreData, receiver) => {
/**
* Set new property value for proxy usage
*/
Expand Down Expand Up @@ -88,7 +88,7 @@ export class PersistantStore<StoreData extends Record<string, unknown>> extends

if (storedValue !== null) {
try {
this.data[key as keyof StoreData] = JSON.parse(storedValue);
this.data[key as keyof StoreData] = JSON.parse(storedValue) as StoreData[keyof StoreData];
} catch {
console.warn(`Persistant store: Cannot parse ${storedValue}`);

Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/storage/abstract/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class SessionStore<StoreData extends Record<string, unknown>> extends Sub
*/
protected get _data(): ProxyHandler<StoreData> {
return {
set: (target, prop, value, receiver) => {
set: (target, prop, value: StoreData, receiver) => {
Reflect.set(target, prop, value, receiver);

this.onDataChange([{ prop: prop as keyof StoreData,
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/utils/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getTitle(content: OutputData): string {
const firstNoteBlock = content.blocks[0];
const { t } = useI18n();

const text: string | undefined = firstNoteBlock.data.text;
const text = firstNoteBlock.data.text as string | undefined;

/**
* If the heading is empty, return 'Untitled'
Expand Down
2 changes: 1 addition & 1 deletion src/presentation/pages/HistoryVersion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async function useThisVersion() {
/**
* Get html element with note
*/
const editorElement = editor.value ? editor.value.element : null;
const editorElement = editor.value ? editor.value.element as HTMLElement : null;
if (historyContent.value !== undefined) {
await save(historyContent.value, undefined);
Expand Down
4 changes: 2 additions & 2 deletions src/presentation/pages/Note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ const editor = ref<typeof Editor | undefined>(undefined);
* @param data - editor data
*/
async function noteChanged(data: NoteContent): Promise<void> {
const isEmpty = editor.value?.isEmpty();
const isEmpty = editor.value?.isEmpty() as boolean;
let updatedNoteCover: Blob | null = null;
/**
* Get html element with note
*/
const editorElement = editor.value ? editor.value.element : null;
const editorElement = editor.value ? editor.value.element as HTMLElement : null;
if (!isEmpty) {
await save(data, props.parentId);
Expand Down

0 comments on commit 59879ca

Please sign in to comment.