mirror of
https://github.com/quartz-community/description.git
synced 2026-07-22 02:50:28 +00:00
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:
parent
84a4e4da48
commit
79fbb22ea2
4 changed files with 49 additions and 2 deletions
|
|
@ -22,5 +22,13 @@
|
|||
"caughtErrorsIgnorePattern": "^_"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["types/**/*.d.ts"],
|
||||
"rules": {
|
||||
"@typescript-eslint/triple-slash-reference": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
1
.prettierignore
Normal file
1
.prettierignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
dist
|
||||
|
|
@ -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
36
types/globals.d.ts
vendored
Normal 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>>;
|
||||
Loading…
Reference in a new issue