build: modernize TypeScript and esbuild configuration

Set compile and bundle target to ES2021 since Obsidian runs on modern Electron.
Replace individual strict flags with strict: true and add noFallthroughCasesInSwitch, skipLibCheck and forceConsistentCasingInFileNames.
Switch module resolution to bundler, removing the need for deprecation workarounds on TypeScript 6.
Drop baseUrl, allowJs and importHelpers; tests now import sources via relative paths.
Aligns the project with the modernized obsidian-sample-plugin configuration.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Lukas Wolfsteiner 2026-07-06 11:20:56 +02:00
parent d0b6c6e4b3
commit c22dc1f969
7 changed files with 13 additions and 29 deletions

View file

@ -33,7 +33,7 @@ const context = await esbuild.context({
"@lezer/lr",
...builtinModules],
format: "cjs",
target: "es2018",
target: "es2021",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,

View file

@ -1,7 +1,6 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
moduleDirectories: ["node_modules", "src"],
moduleNameMapper: {
"^obsidian$": "<rootDir>/tests/__mocks__/obsidian.ts",
},

View file

@ -1,4 +1,4 @@
import { extractFirstRaindropBlock, parseRaindropBlock } from "block-parser";
import { extractFirstRaindropBlock, parseRaindropBlock } from "../src/block-parser";
describe("parseRaindropBlock", () => {
it("parses supported key-value options", () => {

View file

@ -1,5 +1,5 @@
import type { CachedMetadata } from "obsidian";
import { getNoteRaindropReferences, getUrlKey } from "note-parser";
import { getNoteRaindropReferences, getUrlKey } from "../src/note-parser";
describe("getNoteRaindropReferences", () => {
it("extracts unique tags and urls from a note", () => {

View file

@ -1,5 +1,5 @@
import type { CachedMetadata } from "obsidian";
import { buildNoteRaindropSearch } from "note-search";
import { buildNoteRaindropSearch } from "../src/note-search";
describe("buildNoteRaindropSearch", () => {
it("builds an OR query from note tags and urls", () => {

View file

@ -1,4 +1,4 @@
import { buildRaindropSearchQuery, buildRaindropTagSearch, formatRaindropTagFilter } from "raindrop-search";
import { buildRaindropSearchQuery, buildRaindropTagSearch, formatRaindropTagFilter } from "../src/raindrop-search";
describe("formatRaindropTagFilter", () => {
it("formats simple tags without quotes", () => {

View file

@ -1,35 +1,20 @@
{
"compilerOptions": {
"ignoreDeprecations": "6.0",
"rootDir": ".",
"baseUrl": "src",
"inlineSourceMap": true,
"inlineSources": true,
"module": "ESNext",
"target": "ES6",
"allowJs": true,
"noImplicitAny": true,
"noImplicitThis": true,
"target": "ES2021",
"strict": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"importHelpers": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"moduleResolution": "bundler",
"isolatedModules": true,
"strictNullChecks": true,
"strictBindCallApply": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"useUnknownInCatchVariables": true,
"types": ["jest"],
"lib": [
"DOM",
"ES5",
"ES6",
"ES7",
"ES2020"
]
"lib": ["ES2021", "DOM"]
},
"include": [
"src/**/*.ts",
"tests/**/*.ts"
]
"include": ["src/**/*.ts", "tests/**/*.ts"]
}