From 4554cfbe1b713739e83aaa1f8c22c8dccf65ab71 Mon Sep 17 00:00:00 2001 From: JBot4400 <140723341+jbot4400@users.noreply.github.com> Date: Mon, 27 Apr 2026 19:01:37 -0600 Subject: [PATCH] chore(deps): update dependency typescript to v6 (#210) Co-authored-by: Renovate Bot Co-authored-by: Claude Opus 4.6 (1M context) --- eslint.config.mjs | 13 +++++++++++-- package-lock.json | 8 ++++---- package.json | 2 +- src/engine.ts | 12 +++++++++--- src/main.ts | 6 +++--- tsconfig.json | 6 +++--- 6 files changed, 31 insertions(+), 16 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index de0f386..e35e825 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,11 +3,19 @@ import { defineConfig } from "eslint/config"; import obsidianmd from "eslint-plugin-obsidianmd"; import globals from "globals"; +// Disable all obsidianmd rules for non-TS files. Several rules in the +// plugin's recommended config call getParserServices() but are applied +// globally (no files filter), which crashes on package.json and other +// non-TypeScript files that lack type information. +const obsidianmdOff = Object.fromEntries( + Object.keys(obsidianmd.rules ?? {}).map((name) => [`obsidianmd/${name}`, "off"]) +); + export default defineConfig([ - ...obsidianmd.configs.recommended, { - ignores: ["main.js", "dist/**", "node_modules/**", "*.d.ts"], + ignores: ["main.js", "dist/**", "node_modules/**", "*.d.ts", "*.mjs"], }, + ...obsidianmd.configs.recommended, { files: ["**/*.ts", "**/*.tsx"], languageOptions: { @@ -25,6 +33,7 @@ export default defineConfig([ { files: ["package.json"], rules: { + ...obsidianmdOff, "depend/ban-dependencies": "off", }, }, diff --git a/package-lock.json b/package-lock.json index ff10d57..0e51478 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "obsidian": "latest", "prettier": "^3.8.3", "tslib": "2.8.1", - "typescript": "5.9.3" + "typescript": "6.0.3" } }, "node_modules/@codemirror/state": { @@ -6451,9 +6451,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/package.json b/package.json index e440a66..3b0273b 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "obsidian": "latest", "prettier": "^3.8.3", "tslib": "2.8.1", - "typescript": "5.9.3" + "typescript": "6.0.3" }, "lint-staged": { "*.{js,jsx,ts,tsx,json,css,scss,md}": [ diff --git a/src/engine.ts b/src/engine.ts index 6a35f57..a76a3bb 100644 --- a/src/engine.ts +++ b/src/engine.ts @@ -94,8 +94,14 @@ export class ScrollEngine { pixelsPerFrame: number, totalFrames: number ): Promise { + if (!this.activeElement) { + throw new Error("No active element"); + } + + const element = this.activeElement; + return new Promise((resolve) => { - let currentPosition = this.activeElement.scrollTop; + let currentPosition = element.scrollTop; let framesProcessed = 0; const startTime = performance.now(); @@ -110,7 +116,7 @@ export class ScrollEngine { }; const animate = () => { - const previousPosition = this.activeElement.scrollTop; + const previousPosition = element.scrollTop; const nextPosition = currentPosition + pixelsPerFrame; this.logger.debug( @@ -121,7 +127,7 @@ export class ScrollEngine { this.directScroll(currentPosition); // check if we've reached a document limit - const actualPosition = this.activeElement.scrollTop; + const actualPosition = element.scrollTop; if (actualPosition === previousPosition) { finalize(`Scroll stopped @ ${actualPosition}`); return; diff --git a/src/main.ts b/src/main.ts index f902c53..0a4bbd9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -53,9 +53,9 @@ const config = new PluginConfig({ }); export default class StompPlugin extends Plugin { - settings: StompPluginSettings; + settings!: StompPluginSettings; - private controller: ScrollController; + private controller!: ScrollController; private logger: Logger = Logger.getLogger("main"); @@ -124,6 +124,6 @@ export default class StompPlugin extends Plugin { hasActiveView(): boolean { const activeView = this.app.workspace.getActiveViewOfType(MarkdownView); - return activeView && activeView.currentMode instanceof MarkdownPreviewView; + return activeView !== null && activeView.currentMode instanceof MarkdownPreviewView; } } diff --git a/tsconfig.json b/tsconfig.json index ab12f9b..b1d2072 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,18 @@ { "compilerOptions": { - "baseUrl": ".", "inlineSourceMap": true, "inlineSources": true, "module": "ESNext", "target": "ES6", "allowJs": true, "noImplicitAny": true, - "moduleResolution": "node", + "moduleResolution": "bundler", "importHelpers": true, "declaration": true, "outDir": "./dist", + "types": ["node"], "typeRoots": ["node_modules/@types"], - "lib": ["DOM", "ES6"] + "lib": ["DOM", "ES2017"] }, "include": ["**/*.ts"] }