chore: import oxfmt sorting

This commit is contained in:
Jacobtread 2026-03-28 15:29:31 +13:00
parent 3199fbd67a
commit 87de57bde0
101 changed files with 235 additions and 111 deletions

View file

@ -5,5 +5,24 @@
"semi": true,
"singleQuote": false,
"bracketSameLine": true,
"ignorePatterns": ["dist/**", "*.min.js", "README.md", "types/**"]
"ignorePatterns": ["dist/**", "*.min.js", "README.md", "types/**"],
"sortImports": {
"newlinesBetween": true,
"customGroups": [
{
"groupName": "fonts",
"elementNamePattern": ["@/fonts/**"]
}
],
"groups": [
"type-import",
["value-builtin", "value-external"],
"type-internal",
"value-internal",
["type-parent", "type-sibling", "type-index"],
["value-parent", "value-sibling", "value-index"],
"fonts",
"unknown"
]
}
}

View file

@ -1,7 +1,7 @@
import path from "path";
import fs from "fs/promises";
import { build } from "vite";
import path from "path";
import { fileURLToPath } from "url";
import { build } from "vite";
async function buildPlugin() {
const __filename = fileURLToPath(import.meta.url);

View file

@ -1,7 +1,7 @@
import path from "path";
import fs from "fs/promises";
import { build } from "vite";
import path from "path";
import { fileURLToPath } from "url";
import { build } from "vite";
async function dev() {
const __filename = fileURLToPath(import.meta.url);

View file

@ -1,4 +1,5 @@
import type { TFile, Vault } from "obsidian";
import { vi } from "vitest";
function createTFile(vault: Vault, path: string): TFile {

View file

@ -1,9 +1,9 @@
import moment from "moment";
import fs from "node:fs/promises";
import { expect, it, describe } from "vitest";
import { MockVault } from "./__mocks__/obsidian";
import { stopAllTimekeeps } from "./stopAllTimekeeps";
import { expect, it, describe } from "vitest";
describe("stopAllTimekeeps", () => {
it("should stop nothing when no markdown files", async () => {

View file

@ -1,9 +1,9 @@
import moment from "moment";
import fs from "node:fs/promises";
import { expect, it, describe } from "vitest";
import { MockVault } from "./__mocks__/obsidian";
import { stopFileTimekeeps } from "./stopFileTimekeeps";
import { expect, it, describe } from "vitest";
describe("stopFileTimekeeps", () => {
it("nothing should change if the file has no timekeeps", async () => {

View file

@ -1,8 +1,9 @@
import { Moment } from "moment";
import { TFile, Vault } from "obsidian";
import { Timekeep } from "@/timekeep/schema";
import { getRunningEntry, stopRunningEntries } from "@/timekeep";
import { replaceTimekeepCodeblock, extractTimekeepCodeblocksWithPosition } from "@/timekeep/parser";
import { Timekeep } from "@/timekeep/schema";
/**
* Stops all timekeeps in the provided file if there are any running.

View file

@ -1,8 +1,4 @@
import type { TimeEntry, Timekeep } from "@/timekeep/schema";
import type { TimekeepSettings } from "@/settings";
import type { Moment } from "moment";
import pdfMake from "pdfmake";
import type {
DynamicContent,
TableCell,
@ -10,14 +6,20 @@ import type {
TFontDictionary,
} from "pdfmake/interfaces";
// Embedded fonts
import RobotoBold from "@/fonts/Roboto-Bold.ttf";
import RubikRegular from "@/fonts/Rubik-Regular.ttf";
import RubikBold from "@/fonts/Rubik-Bold.ttf";
import RobotoRegular from "@/fonts/Roboto-Regular.ttf";
import pdfMake from "pdfmake";
import type { TimekeepSettings } from "@/settings";
import type { TimeEntry, Timekeep } from "@/timekeep/schema";
import { getEntryDuration, getTotalDuration } from "@/timekeep";
import { formatDurationLong, formatDurationShort, formatPdfDate, formatPdfRowDate } from "@/utils";
// Embedded fonts
import RobotoBold from "@/fonts/Roboto-Bold.ttf";
import RobotoRegular from "@/fonts/Roboto-Regular.ttf";
import RubikBold from "@/fonts/Rubik-Bold.ttf";
import RubikRegular from "@/fonts/Rubik-Regular.ttf";
const fonts: TFontDictionary = {
Roboto: {
normal: "Roboto-Regular.ttf",

View file

@ -1,8 +1,10 @@
import { App, Component } from "obsidian";
import { CustomOutputFormat } from "@/output";
import { TimekeepSettings } from "@/settings";
import { Store } from "@/store";
import { Timekeep } from "@/timekeep/schema";
import { App, Component } from "obsidian";
import { TimesheetApp } from "./timesheetApp";
import { TimesheetSaveError } from "./timesheetSaveError";

View file

@ -1,12 +1,14 @@
import { App, Component } from "obsidian";
import { CustomOutputFormat } from "@/output";
import { TimekeepSettings } from "@/settings";
import { Store } from "@/store";
import { Timekeep } from "@/timekeep/schema";
import { App, Component } from "obsidian";
import { TimesheetCounters } from "./timesheetCounters";
import { TimesheetExportActions } from "./timesheetExportActions";
import { TimesheetStart } from "./timesheetStart";
import { TimesheetTable } from "./timesheetTable";
import { TimesheetExportActions } from "./timesheetExportActions";
/**
* View component for the timesheet app as a whole

View file

@ -1,10 +1,13 @@
import moment from "moment";
import { Component } from "obsidian";
import type { TimekeepSettings } from "@/settings";
import type { Store } from "@/store";
import type { Timekeep } from "@/timekeep/schema";
import { Component } from "obsidian";
import moment from "moment";
import { getEntryDuration, getRunningEntry, getTotalDuration, isKeepRunning } from "@/timekeep";
import { formatDuration } from "@/utils";
import { TimesheetTimer } from "./timesheetTimer";
/**

View file

@ -1,11 +1,12 @@
import moment from "moment";
import { type App, Component, Notice } from "obsidian";
import { createCSV, createMarkdownTable } from "@/export";
import { exportPdf } from "@/export/pdf";
import { CustomOutputFormat } from "@/output";
import { TimekeepSettings } from "@/settings";
import { Store } from "@/store";
import { stripTimekeepRuntimeData, Timekeep } from "@/timekeep/schema";
import { type App, Component, Notice } from "obsidian";
import moment from "moment";
import { createCSV, createMarkdownTable } from "@/export";
import { exportPdf } from "@/export/pdf";
/**
* Export actions section component

View file

@ -1,3 +1,5 @@
import { App, Component } from "obsidian";
import {
NameSegment,
NameSegmentLink,
@ -5,7 +7,6 @@ import {
NameSegmentType,
parseNameSegments,
} from "@/utils/name";
import { App, Component } from "obsidian";
/**
* Component for rendering the name of a timekeep entry, this

View file

@ -1,9 +1,11 @@
import type { TimeEntry, Timekeep } from "@/timekeep/schema";
import { type App, Component } from "obsidian";
import type { TimekeepSettings } from "@/settings";
import type { Store } from "@/store";
import { type App, Component } from "obsidian";
import { TimesheetRowContentEditing } from "./timesheetRowContentEditing";
import type { TimeEntry, Timekeep } from "@/timekeep/schema";
import { TimesheetRowContent } from "./timesheetRowContent";
import { TimesheetRowContentEditing } from "./timesheetRowContentEditing";
/**
* This container allows a entry to switch between the default and

View file

@ -1,3 +1,8 @@
import moment from "moment";
import { App, Component } from "obsidian";
import { TimekeepSettings } from "@/settings";
import { Store } from "@/store";
import {
getRunningEntry,
isEntryRunning,
@ -6,14 +11,11 @@ import {
updateEntry,
} from "@/timekeep";
import { TimeEntry, Timekeep } from "@/timekeep/schema";
import { App, Component } from "obsidian";
import { formatTimestamp } from "@/utils";
import { createObsidianIcon } from "./obsidianIcon";
import { TimekeepName } from "./timesheetName";
import { formatTimestamp } from "@/utils";
import { Store } from "@/store";
import { TimekeepSettings } from "@/settings";
import { TimesheetRowDurationComponent } from "./timesheetRowDuration";
import moment from "moment";
/**
* Component for the contents of a timesheet row

View file

@ -1,12 +1,14 @@
import { App, Component } from "obsidian";
import { TimekeepSettings } from "@/settings";
import { Store } from "@/store";
import { removeEntry, updateEntry } from "@/timekeep";
import { TimeEntry, Timekeep } from "@/timekeep/schema";
import { App, Component } from "obsidian";
import { createObsidianIcon } from "./obsidianIcon";
import { formatEditableTimestamp, parseEditableTimestamp } from "@/utils";
import { Store } from "@/store";
import { TimekeepSettings } from "@/settings";
import { ConfirmModal } from "@/utils/confirm-modal";
import { createObsidianIcon } from "./obsidianIcon";
/**
* Component for a timesheet row entry that is currently
* being edited

View file

@ -1,7 +1,8 @@
import { TimeEntry } from "@/timekeep/schema";
import { Component } from "obsidian";
import moment from "moment";
import { Component } from "obsidian";
import { getEntryDuration, isEntryRunning } from "@/timekeep";
import { TimeEntry } from "@/timekeep/schema";
import { formatDurationLong } from "@/utils";
/**

View file

@ -1,7 +1,9 @@
import type { Store } from "@/store";
import { stripTimekeepRuntimeData, type Timekeep } from "@/timekeep/schema";
import { Component } from "obsidian";
import type { Store } from "@/store";
import { stripTimekeepRuntimeData, type Timekeep } from "@/timekeep/schema";
type HandleSaveTimekeep = (value: Timekeep) => Promise<void>;
/**

View file

@ -1,10 +1,12 @@
import type { TimekeepSettings } from "@/settings";
import type { Timekeep } from "@/timekeep/schema";
import type { Store } from "@/store";
import moment from "moment";
import { type App, Component } from "obsidian";
import type { TimekeepSettings } from "@/settings";
import type { Store } from "@/store";
import type { Timekeep } from "@/timekeep/schema";
import { getRunningEntry, startNewEntry } from "@/timekeep";
import moment from "moment";
import { createObsidianIcon } from "./obsidianIcon";
import { TimekeepStartEditing } from "./timesheetStartEditing";
import { TimesheetStartRunning } from "./timesheetStartRunning";

View file

@ -1,8 +1,11 @@
import type { TimekeepSettings } from "@/settings";
import type { Timekeep } from "@/timekeep/schema";
import type { Store } from "@/store";
import { type App, Component } from "obsidian";
import type { TimekeepSettings } from "@/settings";
import type { Store } from "@/store";
import type { Timekeep } from "@/timekeep/schema";
import { getRunningEntry, updateEntry } from "@/timekeep";
import { createObsidianIcon } from "./obsidianIcon";
/**

View file

@ -1,13 +1,15 @@
import type { TimeEntry, Timekeep } from "@/timekeep/schema";
import type { TimekeepSettings } from "@/settings";
import type { Store } from "@/store";
import moment from "moment";
import { type App, Component } from "obsidian";
import type { TimekeepSettings } from "@/settings";
import type { Store } from "@/store";
import type { TimeEntry, Timekeep } from "@/timekeep/schema";
import { getPathToEntry, stopRunningEntries } from "@/timekeep";
import moment from "moment";
import { createObsidianIcon } from "./obsidianIcon";
import { formatTimestamp } from "@/utils";
import { createObsidianIcon } from "./obsidianIcon";
/**
* The "Running" timer section of the timesheet start are
*/

View file

@ -1,10 +1,13 @@
import { type App, Component } from "obsidian";
import type { TimekeepSettings } from "@/settings";
import type { Store } from "@/store";
import type { Timekeep } from "@/timekeep/schema";
import { type App, Component } from "obsidian";
import { TimesheetRowContainer } from "./timesheetRowContainer";
import { getEntriesSorted } from "@/timekeep";
import { TimesheetRowContainer } from "./timesheetRowContainer";
/**
* Table component for rendering the contents of the timekeep
*/

View file

@ -1,7 +1,8 @@
import type { Moment } from "moment";
import { Timekeep } from "@/timekeep/schema";
import { TimekeepSettings } from "@/settings";
import { RawTableRow, createRawTable } from "@/export";
import { TimekeepSettings } from "@/settings";
import { Timekeep } from "@/timekeep/schema";
/**
* Creates the CSV header row

View file

@ -1,8 +1,9 @@
import type { Moment } from "moment";
import { TimeEntry } from "@/timekeep/schema";
import { TimekeepSettings } from "@/settings";
import { formatDuration, formatTimestamp } from "@/utils";
import { getEntryDuration, getEntriesSorted } from "@/timekeep";
import { TimeEntry } from "@/timekeep/schema";
import { formatDuration, formatTimestamp } from "@/utils";
export { createCSV } from "./csv";
export { createMarkdownTable } from "./markdown-table";

View file

@ -1,9 +1,10 @@
import type { Moment } from "moment";
import { formatDuration } from "@/utils";
import { RawTableRow, TOTAL_COLUMNS, createRawTable } from "@/export";
import { DurationFormat, TimekeepSettings } from "@/settings";
import { getTotalDuration } from "@/timekeep";
import { Timekeep, TimeEntry } from "@/timekeep/schema";
import { DurationFormat, TimekeepSettings } from "@/settings";
import { RawTableRow, TOTAL_COLUMNS, createRawTable } from "@/export";
import { formatDuration } from "@/utils";
/**
* Creates the table header row

View file

@ -1,8 +1,9 @@
import moment from "moment";
import { App, Notice, Platform } from "obsidian";
import { Timekeep } from "@/timekeep/schema";
import { TimekeepSettings, PdfExportBehavior } from "@/settings";
import { createPdfExport, createPdfExportBlob } from "@/components/pdf/renderer";
import { TimekeepSettings, PdfExportBehavior } from "@/settings";
import { Timekeep } from "@/timekeep/schema";
import { pickFileName } from "@/utils/file-name-prompt-modal";
export async function exportPdf(app: App, timekeep: Timekeep, settings: TimekeepSettings) {

View file

@ -1,15 +1,4 @@
import moment, { Moment } from "moment";
import { Store, createStore } from "@/store";
import { TimekeepSettingsTab } from "@/settings-tab";
import { defaultSettings, TimekeepSettings, legacySettingsCompatibility } from "@/settings";
import { load, replaceTimekeepCodeblock, extractTimekeepCodeblocks } from "@/timekeep/parser";
import {
isKeepRunning,
isEntryRunning,
getRunningEntry,
getEntryDuration,
getTotalDuration,
} from "@/timekeep";
import {
Vault,
TFile,
@ -20,13 +9,25 @@ import {
MarkdownPostProcessorContext,
} from "obsidian";
import { CustomOutputFormat } from "./output";
import { Timekeep, TimeEntry } from "./timekeep/schema";
import { defaultSettings, TimekeepSettings, legacySettingsCompatibility } from "@/settings";
import { TimekeepSettingsTab } from "@/settings-tab";
import { Store, createStore } from "@/store";
import {
isKeepRunning,
isEntryRunning,
getRunningEntry,
getEntryDuration,
getTotalDuration,
} from "@/timekeep";
import { load, replaceTimekeepCodeblock, extractTimekeepCodeblocks } from "@/timekeep/parser";
import { stopAllTimekeeps } from "./commands/stopAllTimekeeps";
import { stopFileTimekeeps } from "./commands/stopFileTimekeeps";
import { TimekeepMergerModal } from "./views/timekeep-merger-modal";
import { CustomOutputFormat } from "./output";
import { Timekeep, TimeEntry } from "./timekeep/schema";
import { TimekeepLocatorModal } from "./views/timekeep-locator-modal";
import { TimekeepMarkdownView } from "./views/timekeep-markdown-view";
import { TimekeepMergerModal } from "./views/timekeep-merger-modal";
export default class TimekeepPlugin extends Plugin {
settingsStore: Store<TimekeepSettings>;

View file

@ -1,7 +1,7 @@
import { Moment } from "moment";
import { Timekeep } from "./timekeep/schema";
import { TimekeepSettings } from "./settings";
import { Timekeep } from "./timekeep/schema";
export interface CustomOutputFormat {
/**

View file

@ -1,6 +1,6 @@
import { Store } from "@/store";
import TimekeepPlugin from "@/main";
import { App, Setting, PluginSettingTab } from "obsidian";
import TimekeepPlugin from "@/main";
import {
SortOrder,
FontFamily,
@ -10,6 +10,7 @@ import {
TimekeepSettings,
PdfExportBehavior,
} from "@/settings";
import { Store } from "@/store";
export class TimekeepSettingsTab extends PluginSettingTab {
settingsStore: Store<TimekeepSettings>;

View file

@ -1,3 +1,5 @@
import { expect, test, describe } from "vitest";
import {
SortOrder,
DurationFormat,
@ -5,7 +7,6 @@ import {
TimekeepSettings,
legacySettingsCompatibility,
} from "./settings";
import { expect, test, describe } from "vitest";
describe("legacy settings compatibility conversion", () => {
test("Empty setting", () => {

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { Timekeep, TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { Timekeep } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { Timekeep } from "@/timekeep/schema";
import { createCodeBlock } from "./createCodeBlock";

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { Timekeep } from "@/timekeep/schema";
import { createCodeBlock } from "./createCodeBlock";

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntryGroup } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntryGroup } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,4 +1,5 @@
import moment from "moment";
import { TimeEntry } from "@/timekeep/schema";
export const currentTime = moment();

View file

@ -1,8 +1,8 @@
import moment from "moment";
import { expect, it, describe } from "vitest";
import { withEntry, createEntry, withSubEntry } from "./create";
import { stripEntryRuntimeData, stripEntriesRuntimeData } from "./schema";
import { expect, it, describe } from "vitest";
describe("createEntry", () => {
it("creating entry should use current time", () => {

View file

@ -1,7 +1,9 @@
import { v4 as uuid } from "uuid";
import type { Moment } from "moment";
import { isEmptyString } from "@/utils";
import { v4 as uuid } from "uuid";
import { TimeEntry, TimeEntryGroup } from "@/timekeep/schema";
import { isEmptyString } from "@/utils";
/**
* Creates a new entry that has just started

View file

@ -1,6 +1,6 @@
import moment from "moment";
import { expect, it, describe, vi } from "vitest";
import { Timekeep, stripTimekeepRuntimeData } from "./schema";
import {
load,
LoadError,
@ -8,7 +8,7 @@ import {
replaceTimekeepCodeblock,
extractTimekeepCodeblocks,
} from "./parser";
import { expect, it, describe, vi } from "vitest";
import { Timekeep, stripTimekeepRuntimeData } from "./schema";
/**
* Generates a code block surrounding the provided JSON

View file

@ -1,5 +1,5 @@
import { isEmptyString } from "@/utils";
import { TIMEKEEP, Timekeep, stripTimekeepRuntimeData } from "@/timekeep/schema";
import { isEmptyString } from "@/utils";
export type LoadResult = LoadSuccess | LoadError;

View file

@ -1,3 +1,5 @@
import { expect, it, describe } from "vitest";
import {
getEntryById,
isKeepRunning,
@ -7,7 +9,6 @@ import {
getEntryDuration,
getTotalDuration,
} from "./queries";
import { expect, it, describe } from "vitest";
describe("getEntryById", () => {
it("find top level entry", async () => {

View file

@ -1,4 +1,5 @@
import type { Moment } from "moment";
import { Timekeep, TimeEntry } from "@/timekeep/schema";
/**

View file

@ -1,8 +1,9 @@
import moment from "moment";
import { v4 as uuid } from "uuid";
import { TIMEKEEP } from "@/timekeep/schema";
import { expect, it, describe, vi } from "vitest";
import { TIMEKEEP } from "@/timekeep/schema";
vi.mock(import("uuid"), async (importOriginal) => {
return {
...(await importOriginal()),

View file

@ -1,6 +1,6 @@
import { z } from "zod";
import moment from "moment";
import { v4 as uuid } from "uuid";
import { z } from "zod";
/*
* This file contains the strict schema for parsing timekeep data

View file

@ -1,5 +1,7 @@
import { SortOrder, UnstartedOrder, defaultSettings, TimekeepSettings } from "@/settings";
import { expect, it, describe } from "vitest";
import { SortOrder, UnstartedOrder, defaultSettings, TimekeepSettings } from "@/settings";
import { getEntriesSorted } from "./sort";
describe("getEntriesSorted", () => {

View file

@ -1,5 +1,5 @@
import { TimeEntry } from "@/timekeep/schema";
import { SortOrder, UnstartedOrder, TimekeepSettings } from "@/settings";
import { TimeEntry } from "@/timekeep/schema";
import { getStartTime } from "./queries";

View file

@ -1,6 +1,7 @@
import { expect, it, describe } from "vitest";
import { stripEntriesRuntimeData } from "./schema";
import { startNewEntry, startNewNestedEntry } from "./start";
import { expect, it, describe } from "vitest";
describe("startNewEntry", () => {
it("starting a new entry should stop any running entries", async () => {

View file

@ -1,9 +1,10 @@
import type { Moment } from "moment";
import { TimeEntry } from "@/timekeep/schema";
import { withEntry, createEntry, withSubEntry } from "./create";
import { getEntryById } from "./queries";
import { updateEntry, stopRunningEntries } from "./update";
import { withEntry, createEntry, withSubEntry } from "./create";
/**
* Start a new entry in the provided set of entires

View file

@ -1,3 +1,5 @@
import { expect, it, describe } from "vitest";
import { TimeEntryGroup } from "./schema";
import {
updateEntry,
@ -6,7 +8,6 @@ import {
setEntryCollapsed,
stopRunningEntries,
} from "./update";
import { expect, it, describe } from "vitest";
describe("updateEntry", () => {
it("updating existing entry should succeed", async () => {

View file

@ -1,4 +1,5 @@
import type { Moment } from "moment";
import { TimeEntry } from "@/timekeep/schema";
/**

View file

@ -1,6 +1,7 @@
import { NameSegmentType, parseNameSegments } from "./name";
import { expect, it, describe } from "vitest";
import { NameSegmentType, parseNameSegments } from "./name";
describe("parseNameSegments", () => {
it("should parse plain text without modification", () => {
const input = "Hello World";

View file

@ -1,4 +1,6 @@
import moment from "moment";
import { expect, it, test, describe } from "vitest";
import { DurationFormat, defaultSettings, TimekeepSettings } from "@/settings";
import {
@ -13,8 +15,6 @@ import {
formatEditableTimestamp,
} from "./time";
import { expect, it, test, describe } from "vitest";
it("should format time", () => {
const input = moment("2024-03-31T02:34:45.413Z").utc();
const expected = "24-03-31 02:34:45";

View file

@ -1,4 +1,5 @@
import moment, { Moment } from "moment";
import { DurationFormat, TimekeepSettings } from "@/settings";
/**

View file

@ -1,7 +1,8 @@
import { getRunningEntry } from "@/timekeep";
import { App, TFile, SuggestModal } from "obsidian";
import { Timekeep, TimeEntry } from "@/timekeep/schema";
import { getRunningEntry } from "@/timekeep";
import { extractTimekeepCodeblocks } from "@/timekeep/parser";
import { Timekeep, TimeEntry } from "@/timekeep/schema";
interface TimekeepResult {
timekeep: Timekeep;

View file

@ -1,13 +1,14 @@
import moment from "moment";
import { Store, createStore } from "@/store";
import { App as ObsidianApp } from "obsidian";
import { TimekeepSettings } from "@/settings";
import { CustomOutputFormat } from "@/output";
import { Timekeep, stripTimekeepRuntimeData } from "@/timekeep/schema";
import { LoadResult, replaceTimekeepCodeblock } from "@/timekeep/parser";
import { TFile, TAbstractFile, MarkdownRenderChild, MarkdownPostProcessorContext } from "obsidian";
import { Timesheet } from "@/components/timesheet";
import { TimesheetLoadError } from "@/components/timesheetLoadError";
import { CustomOutputFormat } from "@/output";
import { TimekeepSettings } from "@/settings";
import { Store, createStore } from "@/store";
import { LoadResult, replaceTimekeepCodeblock } from "@/timekeep/parser";
import { Timekeep, stripTimekeepRuntimeData } from "@/timekeep/schema";
export class TimekeepMarkdownView extends MarkdownRenderChild {
// Obsidian app instance

View file

@ -1,10 +1,11 @@
import { Store } from "@/store";
import { App, TFile, Modal, TextComponent, ButtonComponent } from "obsidian";
import { v4 as uuid } from "uuid";
import { exportPdf } from "@/export/pdf";
import { TimekeepSettings } from "@/settings";
import { Store } from "@/store";
import { extractTimekeepCodeblocks } from "@/timekeep/parser";
import { Timekeep, stripTimekeepRuntimeData } from "@/timekeep/schema";
import { App, TFile, Modal, TextComponent, ButtonComponent } from "obsidian";
interface TimekeepResult {
timekeep: Timekeep;

Some files were not shown because too many files have changed in this diff Show more