fix: centralize type declarations and fix formatting

- Update types/globals.d.ts with centralized type declarations
- Fix prettier formatting in src/transformer.ts
- Add .prettierignore, update .eslintrc.json with triple-slash-reference override
This commit is contained in:
saberzero1 2026-03-16 18:54:54 +01:00
parent 84a4e4da48
commit 79fbb22ea2
No known key found for this signature in database
4 changed files with 49 additions and 2 deletions

View file

@ -22,5 +22,13 @@
"caughtErrorsIgnorePattern": "^_"
}
]
}
},
"overrides": [
{
"files": ["types/**/*.d.ts"],
"rules": {
"@typescript-eslint/triple-slash-reference": "off"
}
}
]
}

1
.prettierignore Normal file
View file

@ -0,0 +1 @@
dist

View file

@ -29,7 +29,9 @@ export const Description: QuartzTransformerPlugin<Partial<DescriptionOptions>> =
return [
() => {
return async (tree: HTMLRoot, file: VFile) => {
let frontMatterDescription = (file.data.frontmatter as Record<string, unknown> | undefined)?.description as string | undefined;
let frontMatterDescription = (
file.data.frontmatter as Record<string, unknown> | undefined
)?.description as string | undefined;
let text = escapeHTML(toString(tree));
if (opts.replaceExternalLinks) {

36
types/globals.d.ts vendored Normal file
View file

@ -0,0 +1,36 @@
declare module "*.scss" {
const content: string;
export default content;
}
declare module "*.inline.ts" {
const content: string;
export default content;
}
interface CustomEventMap {
nav: CustomEvent<{ url: string }>;
prenav: CustomEvent<undefined>;
themechange: CustomEvent<{ theme: "light" | "dark" }>;
readermodechange: CustomEvent<{ mode: "on" | "off" }>;
render: CustomEvent<object>;
}
interface Document {
addEventListener<K extends keyof CustomEventMap>(
type: K,
listener: (this: Document, ev: CustomEventMap[K]) => void,
): void;
removeEventListener<K extends keyof CustomEventMap>(
type: K,
listener: (this: Document, ev: CustomEventMap[K]) => void,
): void;
dispatchEvent<K extends keyof CustomEventMap>(ev: CustomEventMap[K] | UIEvent): void;
}
interface Window {
addCleanup(fn: (...args: unknown[]) => void): void;
spaNavigate?(url: URL, isBack: boolean): Promise<void>;
}
declare const fetchData: Promise<Record<string, unknown>>;