obsidian-plugin-dev-kit 0.0.0-stage → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +223 -2
  3. package/bin/opdk.js +34 -0
  4. package/dist/build/args.d.ts +10 -0
  5. package/dist/build/args.js +45 -0
  6. package/dist/build/bundle-check.d.ts +17 -0
  7. package/dist/build/bundle-check.js +42 -0
  8. package/dist/build/bundle-file.d.ts +4 -0
  9. package/dist/build/bundle-file.js +29 -0
  10. package/dist/build/commands.d.ts +5 -0
  11. package/dist/build/commands.js +109 -0
  12. package/dist/build/config.d.ts +3 -0
  13. package/dist/build/config.js +103 -0
  14. package/dist/build/css-imports.d.ts +23 -0
  15. package/dist/build/css-imports.js +50 -0
  16. package/dist/build/css-step.d.ts +10 -0
  17. package/dist/build/css-step.js +27 -0
  18. package/dist/build/css.d.ts +24 -0
  19. package/dist/build/css.js +47 -0
  20. package/dist/build/options.d.ts +55 -0
  21. package/dist/build/options.js +70 -0
  22. package/dist/build/release.d.ts +5 -0
  23. package/dist/build/release.js +34 -0
  24. package/dist/build/report.d.ts +7 -0
  25. package/dist/build/report.js +16 -0
  26. package/dist/build/vault.d.ts +26 -0
  27. package/dist/build/vault.js +290 -0
  28. package/dist/build-info.json +1 -0
  29. package/dist/cli/argv.d.ts +14 -0
  30. package/dist/cli/argv.js +18 -0
  31. package/dist/cli/commands.d.ts +3 -0
  32. package/dist/cli/commands.js +7 -0
  33. package/dist/cli/main.d.ts +2 -0
  34. package/dist/cli/main.js +23 -0
  35. package/dist/cli/process-reporter.d.ts +5 -0
  36. package/dist/cli/process-reporter.js +15 -0
  37. package/dist/cli/registry.d.ts +4 -0
  38. package/dist/cli/registry.js +15 -0
  39. package/dist/cli/reporter.d.ts +53 -0
  40. package/dist/cli/reporter.js +100 -0
  41. package/dist/cli/run.d.ts +9 -0
  42. package/dist/cli/run.js +61 -0
  43. package/dist/cli/types.d.ts +27 -0
  44. package/dist/cli/types.js +1 -0
  45. package/dist/cli/version.d.ts +13 -0
  46. package/dist/cli/version.js +61 -0
  47. package/dist/config/define-config.d.ts +3 -0
  48. package/dist/config/define-config.js +4 -0
  49. package/dist/config/load-config.d.ts +6 -0
  50. package/dist/config/load-config.js +70 -0
  51. package/dist/config/manifest.d.ts +3 -0
  52. package/dist/config/manifest.js +72 -0
  53. package/dist/config/types.d.ts +146 -0
  54. package/dist/config/types.js +23 -0
  55. package/dist/demo/args.d.ts +4 -0
  56. package/dist/demo/args.js +13 -0
  57. package/dist/demo/checks.d.ts +56 -0
  58. package/dist/demo/checks.js +124 -0
  59. package/dist/demo/commands.d.ts +3 -0
  60. package/dist/demo/commands.js +65 -0
  61. package/dist/demo/config.d.ts +57 -0
  62. package/dist/demo/config.js +337 -0
  63. package/dist/demo/ffmpeg-run.d.ts +18 -0
  64. package/dist/demo/ffmpeg-run.js +59 -0
  65. package/dist/demo/ffmpeg.d.ts +63 -0
  66. package/dist/demo/ffmpeg.js +111 -0
  67. package/dist/demo/films.d.ts +46 -0
  68. package/dist/demo/films.js +134 -0
  69. package/dist/demo/phone-layout.d.ts +38 -0
  70. package/dist/demo/phone-layout.js +98 -0
  71. package/dist/demo/phone-render.d.ts +28 -0
  72. package/dist/demo/phone-render.js +124 -0
  73. package/dist/demo/published.d.ts +16 -0
  74. package/dist/demo/published.js +72 -0
  75. package/dist/demo/run.d.ts +31 -0
  76. package/dist/demo/run.js +397 -0
  77. package/dist/demo/stills.d.ts +21 -0
  78. package/dist/demo/stills.js +62 -0
  79. package/dist/e2e/artifacts.d.ts +27 -0
  80. package/dist/e2e/artifacts.js +90 -0
  81. package/dist/e2e/cleanup.d.ts +54 -0
  82. package/dist/e2e/cleanup.js +109 -0
  83. package/dist/e2e/config.d.ts +9 -0
  84. package/dist/e2e/config.js +42 -0
  85. package/dist/e2e/create-test.d.ts +37 -0
  86. package/dist/e2e/create-test.js +109 -0
  87. package/dist/e2e/demo/clip.d.ts +21 -0
  88. package/dist/e2e/demo/clip.js +44 -0
  89. package/dist/e2e/demo/create-demo.d.ts +42 -0
  90. package/dist/e2e/demo/create-demo.js +439 -0
  91. package/dist/e2e/demo/manifest.d.ts +76 -0
  92. package/dist/e2e/demo/manifest.js +168 -0
  93. package/dist/e2e/demo/names.d.ts +18 -0
  94. package/dist/e2e/demo/names.js +44 -0
  95. package/dist/e2e/demo/options.d.ts +22 -0
  96. package/dist/e2e/demo/options.js +59 -0
  97. package/dist/e2e/demo/ownership.d.ts +27 -0
  98. package/dist/e2e/demo/ownership.js +65 -0
  99. package/dist/e2e/demo/page-scripts.d.ts +82 -0
  100. package/dist/e2e/demo/page-scripts.js +250 -0
  101. package/dist/e2e/demo/png.d.ts +8 -0
  102. package/dist/e2e/demo/png.js +23 -0
  103. package/dist/e2e/demo/presets.d.ts +43 -0
  104. package/dist/e2e/demo/presets.js +20 -0
  105. package/dist/e2e/demo/privacy.d.ts +18 -0
  106. package/dist/e2e/demo/privacy.js +30 -0
  107. package/dist/e2e/demo/still-options.d.ts +22 -0
  108. package/dist/e2e/demo/still-options.js +68 -0
  109. package/dist/e2e/demo/types.d.ts +184 -0
  110. package/dist/e2e/demo/types.js +1 -0
  111. package/dist/e2e/electron-binary.d.ts +15 -0
  112. package/dist/e2e/electron-binary.js +30 -0
  113. package/dist/e2e/fixtures.d.ts +62 -0
  114. package/dist/e2e/fixtures.js +68 -0
  115. package/dist/e2e/gate.d.ts +4 -0
  116. package/dist/e2e/gate.js +8 -0
  117. package/dist/e2e/global-setup.d.ts +11 -0
  118. package/dist/e2e/global-setup.js +17 -0
  119. package/dist/e2e/helpers/commands.d.ts +14 -0
  120. package/dist/e2e/helpers/commands.js +56 -0
  121. package/dist/e2e/helpers/create-helpers.d.ts +24 -0
  122. package/dist/e2e/helpers/create-helpers.js +582 -0
  123. package/dist/e2e/helpers/device-metrics.d.ts +21 -0
  124. package/dist/e2e/helpers/device-metrics.js +25 -0
  125. package/dist/e2e/helpers/ime.d.ts +13 -0
  126. package/dist/e2e/helpers/ime.js +19 -0
  127. package/dist/e2e/helpers/layout-page-scripts.d.ts +103 -0
  128. package/dist/e2e/helpers/layout-page-scripts.js +224 -0
  129. package/dist/e2e/helpers/layout.d.ts +83 -0
  130. package/dist/e2e/helpers/layout.js +148 -0
  131. package/dist/e2e/helpers/mobile.d.ts +31 -0
  132. package/dist/e2e/helpers/mobile.js +26 -0
  133. package/dist/e2e/helpers/page-scripts.d.ts +194 -0
  134. package/dist/e2e/helpers/page-scripts.js +467 -0
  135. package/dist/e2e/helpers/settings.d.ts +8 -0
  136. package/dist/e2e/helpers/settings.js +16 -0
  137. package/dist/e2e/helpers/settle.d.ts +28 -0
  138. package/dist/e2e/helpers/settle.js +33 -0
  139. package/dist/e2e/helpers/types.d.ts +193 -0
  140. package/dist/e2e/helpers/types.js +1 -0
  141. package/dist/e2e/helpers/view-mode.d.ts +23 -0
  142. package/dist/e2e/helpers/view-mode.js +35 -0
  143. package/dist/e2e/index.d.ts +14 -0
  144. package/dist/e2e/index.js +4 -0
  145. package/dist/e2e/internals.d.ts +155 -0
  146. package/dist/e2e/internals.js +8 -0
  147. package/dist/e2e/obsidian-path.d.ts +17 -0
  148. package/dist/e2e/obsidian-path.js +31 -0
  149. package/dist/e2e/options.d.ts +123 -0
  150. package/dist/e2e/options.js +244 -0
  151. package/dist/e2e/page-scripts.d.ts +45 -0
  152. package/dist/e2e/page-scripts.js +53 -0
  153. package/dist/e2e/peers.d.ts +9 -0
  154. package/dist/e2e/peers.js +19 -0
  155. package/dist/e2e/plugins.d.ts +32 -0
  156. package/dist/e2e/plugins.js +119 -0
  157. package/dist/e2e/process-tree.d.ts +33 -0
  158. package/dist/e2e/process-tree.js +133 -0
  159. package/dist/e2e/readiness.d.ts +23 -0
  160. package/dist/e2e/readiness.js +63 -0
  161. package/dist/e2e/seed.d.ts +34 -0
  162. package/dist/e2e/seed.js +122 -0
  163. package/dist/e2e/session.d.ts +71 -0
  164. package/dist/e2e/session.js +266 -0
  165. package/dist/e2e/vault.d.ts +52 -0
  166. package/dist/e2e/vault.js +146 -0
  167. package/dist/e2e/version.d.ts +25 -0
  168. package/dist/e2e/version.js +40 -0
  169. package/dist/eslint/index.d.ts +2 -0
  170. package/dist/eslint/index.js +1 -0
  171. package/dist/eslint/obsidian-plugin.d.ts +49 -0
  172. package/dist/eslint/obsidian-plugin.js +115 -0
  173. package/dist/index.d.ts +3 -0
  174. package/dist/index.js +1 -0
  175. package/dist/kit/args.d.ts +7 -0
  176. package/dist/kit/args.js +21 -0
  177. package/dist/kit/commands.d.ts +3 -0
  178. package/dist/kit/commands.js +52 -0
  179. package/dist/kit/files.d.ts +3 -0
  180. package/dist/kit/files.js +24 -0
  181. package/dist/kit/pins.d.ts +89 -0
  182. package/dist/kit/pins.js +178 -0
  183. package/dist/kit/remote.d.ts +13 -0
  184. package/dist/kit/remote.js +33 -0
  185. package/dist/kit/runners.d.ts +11 -0
  186. package/dist/kit/runners.js +53 -0
  187. package/dist/kit/terminal-text.d.ts +6 -0
  188. package/dist/kit/terminal-text.js +20 -0
  189. package/dist/kit/upgrade.d.ts +26 -0
  190. package/dist/kit/upgrade.js +162 -0
  191. package/dist/peers/resolve.d.ts +8 -0
  192. package/dist/peers/resolve.js +28 -0
  193. package/dist/peers/versions.d.ts +30 -0
  194. package/dist/peers/versions.js +32 -0
  195. package/dist/release/api-check.d.ts +27 -0
  196. package/dist/release/api-check.js +119 -0
  197. package/dist/release/args.d.ts +40 -0
  198. package/dist/release/args.js +120 -0
  199. package/dist/release/assets.d.ts +21 -0
  200. package/dist/release/assets.js +35 -0
  201. package/dist/release/build-check.d.ts +43 -0
  202. package/dist/release/build-check.js +184 -0
  203. package/dist/release/build-script.d.ts +12 -0
  204. package/dist/release/build-script.js +30 -0
  205. package/dist/release/build-tagged.d.ts +26 -0
  206. package/dist/release/build-tagged.js +52 -0
  207. package/dist/release/bump.d.ts +24 -0
  208. package/dist/release/bump.js +58 -0
  209. package/dist/release/changelog.d.ts +25 -0
  210. package/dist/release/changelog.js +148 -0
  211. package/dist/release/check.d.ts +38 -0
  212. package/dist/release/check.js +150 -0
  213. package/dist/release/commands.d.ts +3 -0
  214. package/dist/release/commands.js +154 -0
  215. package/dist/release/committed-tree.d.ts +63 -0
  216. package/dist/release/committed-tree.js +118 -0
  217. package/dist/release/config.d.ts +3 -0
  218. package/dist/release/config.js +28 -0
  219. package/dist/release/gh-access.d.ts +14 -0
  220. package/dist/release/gh-access.js +45 -0
  221. package/dist/release/gh.d.ts +10 -0
  222. package/dist/release/gh.js +33 -0
  223. package/dist/release/git.d.ts +49 -0
  224. package/dist/release/git.js +111 -0
  225. package/dist/release/interrupt.d.ts +30 -0
  226. package/dist/release/interrupt.js +60 -0
  227. package/dist/release/json.d.ts +33 -0
  228. package/dist/release/json.js +81 -0
  229. package/dist/release/kit-check.d.ts +8 -0
  230. package/dist/release/kit-check.js +51 -0
  231. package/dist/release/manifest-rules.d.ts +23 -0
  232. package/dist/release/manifest-rules.js +255 -0
  233. package/dist/release/preflight.d.ts +10 -0
  234. package/dist/release/preflight.js +65 -0
  235. package/dist/release/problems.d.ts +24 -0
  236. package/dist/release/problems.js +11 -0
  237. package/dist/release/project-files.d.ts +14 -0
  238. package/dist/release/project-files.js +16 -0
  239. package/dist/release/publish-command.d.ts +21 -0
  240. package/dist/release/publish-command.js +83 -0
  241. package/dist/release/publish-git.d.ts +37 -0
  242. package/dist/release/publish-git.js +108 -0
  243. package/dist/release/publish-state.d.ts +29 -0
  244. package/dist/release/publish-state.js +70 -0
  245. package/dist/release/publish-verify.d.ts +41 -0
  246. package/dist/release/publish-verify.js +112 -0
  247. package/dist/release/publish-wait.d.ts +25 -0
  248. package/dist/release/publish-wait.js +56 -0
  249. package/dist/release/publish.d.ts +35 -0
  250. package/dist/release/publish.js +181 -0
  251. package/dist/release/release-assets.d.ts +39 -0
  252. package/dist/release/release-assets.js +68 -0
  253. package/dist/release/release.d.ts +37 -0
  254. package/dist/release/release.js +179 -0
  255. package/dist/release/remote.d.ts +12 -0
  256. package/dist/release/remote.js +15 -0
  257. package/dist/release/reproducible.d.ts +16 -0
  258. package/dist/release/reproducible.js +34 -0
  259. package/dist/release/run-tests.d.ts +5 -0
  260. package/dist/release/run-tests.js +17 -0
  261. package/dist/release/semver.d.ts +8 -0
  262. package/dist/release/semver.js +60 -0
  263. package/dist/release/version-rules.d.ts +28 -0
  264. package/dist/release/version-rules.js +63 -0
  265. package/dist/release/versions-json.d.ts +15 -0
  266. package/dist/release/versions-json.js +88 -0
  267. package/dist/release/workflow-run.d.ts +44 -0
  268. package/dist/release/workflow-run.js +71 -0
  269. package/dist/scanner/code-checks.d.ts +41 -0
  270. package/dist/scanner/code-checks.js +82 -0
  271. package/dist/scanner/commands.d.ts +3 -0
  272. package/dist/scanner/commands.js +43 -0
  273. package/dist/scanner/config.d.ts +7 -0
  274. package/dist/scanner/config.js +25 -0
  275. package/dist/scanner/css-check.d.ts +26 -0
  276. package/dist/scanner/css-check.js +63 -0
  277. package/dist/scanner/eslint-nesting.d.ts +16 -0
  278. package/dist/scanner/eslint-nesting.js +45 -0
  279. package/dist/scanner/findings.d.ts +23 -0
  280. package/dist/scanner/findings.js +21 -0
  281. package/dist/scanner/git-files.d.ts +16 -0
  282. package/dist/scanner/git-files.js +73 -0
  283. package/dist/scanner/lint.d.ts +47 -0
  284. package/dist/scanner/lint.js +163 -0
  285. package/dist/scanner/meta-checks.d.ts +8 -0
  286. package/dist/scanner/meta-checks.js +22 -0
  287. package/dist/scanner/outside-project.d.ts +19 -0
  288. package/dist/scanner/outside-project.js +20 -0
  289. package/dist/scanner/run.d.ts +19 -0
  290. package/dist/scanner/run.js +78 -0
  291. package/dist/scanner/scanner-config.d.ts +114 -0
  292. package/dist/scanner/scanner-config.js +207 -0
  293. package/dist/scanner/typescript-gate.d.ts +30 -0
  294. package/dist/scanner/typescript-gate.js +73 -0
  295. package/dist/vitest/build-config.d.ts +17 -0
  296. package/dist/vitest/build-config.js +106 -0
  297. package/dist/vitest/define-unit-config.d.ts +27 -0
  298. package/dist/vitest/define-unit-config.js +45 -0
  299. package/dist/vitest/dom/elements.d.ts +87 -0
  300. package/dist/vitest/dom/elements.js +291 -0
  301. package/dist/vitest/dom/index.d.ts +1 -0
  302. package/dist/vitest/dom/index.js +1 -0
  303. package/dist/vitest/dom/install.d.ts +8 -0
  304. package/dist/vitest/dom/install.js +261 -0
  305. package/dist/vitest/dom/setup.d.ts +1 -0
  306. package/dist/vitest/dom/setup.js +3 -0
  307. package/dist/vitest/index.d.ts +3 -0
  308. package/dist/vitest/index.js +2 -0
  309. package/dist/vitest/options.d.ts +92 -0
  310. package/dist/vitest/options.js +136 -0
  311. package/dist/vitest/peers.d.ts +10 -0
  312. package/dist/vitest/peers.js +51 -0
  313. package/dist/vitest/workspace-root.d.ts +7 -0
  314. package/dist/vitest/workspace-root.js +39 -0
  315. package/docs/build.md +232 -0
  316. package/docs/ci.md +182 -0
  317. package/docs/demo.md +364 -0
  318. package/docs/e2e.md +563 -0
  319. package/docs/release.md +374 -0
  320. package/docs/scanner.md +204 -0
  321. package/docs/unit.md +291 -0
  322. package/package.json +100 -4
  323. package/plugins/opdk/skills/audit/SKILL.md +81 -0
  324. package/plugins/opdk/skills/build/SKILL.md +79 -0
  325. package/plugins/opdk/skills/demo/SKILL.md +102 -0
  326. package/plugins/opdk/skills/e2e/SKILL.md +132 -0
  327. package/plugins/opdk/skills/release/SKILL.md +84 -0
  328. package/plugins/opdk/skills/scanner/SKILL.md +60 -0
  329. package/plugins/opdk/skills/unit/SKILL.md +90 -0
@@ -0,0 +1,266 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { shouldKeep, shouldRecord } from "./artifacts.js";
4
+ import { CleanupStack, createTempDir, removeDir } from "./cleanup.js";
5
+ import { assertElectronInstalled } from "./electron-binary.js";
6
+ import { findObsidianAsar } from "./obsidian-path.js";
7
+ import { applyTrust, readRunningVersion, resizeMainWindow } from "./page-scripts.js";
8
+ import { assertBuildFresh, assertDataIdsInstalled, assertUniqueIds, installPlugin, readPluginSource, writeCommunityPlugins, writePluginData, } from "./plugins.js";
9
+ import { terminateTree } from "./process-tree.js";
10
+ import { waitForReady } from "./readiness.js";
11
+ import { applySeed } from "./seed.js";
12
+ import { copySeedVault, createVaultHandle, generateVaultId, trustKey, writeAppDefaults, writeUserData, } from "./vault.js";
13
+ import { compareObsidianVersions } from "./version.js";
14
+ /** The trace is written under this name in the test's output folder. */
15
+ export const TRACE_FILE = "obsidian-trace.zip";
16
+ /** The environment Obsidian starts with: ours minus the variables that break it or aim it at the wrong vault. */
17
+ export function buildLaunchEnv(env) {
18
+ const result = {};
19
+ for (const [key, value] of Object.entries(env)) {
20
+ // ELECTRON_RUN_AS_NODE forces the local electron binary to run as plain Node, which rejects Chromium flags
21
+ // such as the debugging port Playwright passes. VAULT_PLUGIN is the dev-vault of `opdk build --vault`; it has
22
+ // no business in a test and must never reach a process that writes files.
23
+ if (value !== undefined && key !== "ELECTRON_RUN_AS_NODE" && key !== "VAULT_PLUGIN") {
24
+ result[key] = value;
25
+ }
26
+ }
27
+ return result;
28
+ }
29
+ /**
30
+ * Checks everything that can be checked without creating anything: the Obsidian install, the build output of every
31
+ * plugin, the `data` ids. A problem here leaves nothing behind.
32
+ */
33
+ export function prepareSession(options, deps, platform = process.platform) {
34
+ const asar = findObsidianAsar({
35
+ option: options.obsidianPath,
36
+ env: deps.env,
37
+ platform,
38
+ exists: fs.existsSync,
39
+ cwd: options.cwd,
40
+ });
41
+ const sources = options.pluginDirs.map((dir) => readPluginSource(dir));
42
+ assertUniqueIds(sources);
43
+ assertDataIdsInstalled(options.data, sources);
44
+ for (const source of sources) {
45
+ if (options.staleCheckDirs.includes(source.dir)) {
46
+ assertBuildFresh(source);
47
+ }
48
+ }
49
+ return { asar, sources };
50
+ }
51
+ /**
52
+ * Starts Obsidian on a fresh copy of the seed vault. If any step throws, everything created so far is torn down
53
+ * before the error reaches the caller.
54
+ */
55
+ export async function startSession(options, deps, context) {
56
+ const { asar, sources } = prepareSession(options, deps);
57
+ // Before any folder is created: a missing Electron binary would otherwise surface as a launch timeout.
58
+ assertElectronInstalled(options.cwd, deps.electron);
59
+ const stack = new CleanupStack();
60
+ try {
61
+ return await open(options, deps, context, asar, sources, stack);
62
+ }
63
+ catch (error) {
64
+ try {
65
+ await stack.run();
66
+ }
67
+ catch (cleanupError) {
68
+ const reason = error instanceof Error ? error.message : String(error);
69
+ const cleanup = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
70
+ throw new Error(`${reason}\n\n${cleanup}`, { cause: cleanupError });
71
+ }
72
+ throw error;
73
+ }
74
+ }
75
+ async function open(options, deps, context, asar, sources, stack) {
76
+ const now = deps.now ?? Date.now;
77
+ // A session that fails while starting never reaches `teardown(outcome)`; it has failed by definition.
78
+ const outcome = { failed: true };
79
+ const plan = context.artifacts;
80
+ const videoDir = plan !== undefined && shouldRecord(plan.video.mode, plan.retry) ? plan.outputPath("video") : undefined;
81
+ const vaultRoot = createTempDir("vault", context.label, deps.tmpRoot);
82
+ stack.add(`remove ${vaultRoot}`, () => {
83
+ removeDir(vaultRoot);
84
+ });
85
+ const userDataDir = createTempDir("userdata", "", deps.tmpRoot);
86
+ stack.add(`remove ${userDataDir}`, () => {
87
+ removeDir(userDataDir);
88
+ });
89
+ const vaultPath = path.join(vaultRoot, "vault");
90
+ const vaultId = generateVaultId();
91
+ copySeedVault(options.seedVault, vaultPath);
92
+ writeAppDefaults(vaultPath);
93
+ for (const source of sources) {
94
+ installPlugin(vaultPath, source);
95
+ }
96
+ writeCommunityPlugins(vaultPath, sources.map((source) => source.id));
97
+ for (const [id, data] of Object.entries(options.data)) {
98
+ writePluginData(vaultPath, id, data);
99
+ }
100
+ if (context.seed !== undefined) {
101
+ applySeed(vaultPath, context.seed, sources.map((source) => source.id));
102
+ }
103
+ writeUserData({ userDataDir, vaultId, vaultPath, now: now() });
104
+ // No `executablePath` on purpose: Playwright then resolves `electron` from `cwd` (the plugin's node_modules) and
105
+ // injects its loader, which holds back the app's `ready` event until Playwright is attached. With an
106
+ // `executablePath` the loader is skipped and the attachment can miss early events.
107
+ const launchStartedAt = now();
108
+ const app = await deps.launch({
109
+ args: [asar, `--user-data-dir=${userDataDir}`, ...options.electronArgs],
110
+ env: buildLaunchEnv(deps.env),
111
+ cwd: options.cwd,
112
+ timeout: options.timeouts.launch,
113
+ // Playwright's `use.video` does not reach this window (see artifacts.ts), so the recording is asked for here.
114
+ ...(videoDir === undefined ? {} : { recordVideo: { dir: videoDir, ...(plan?.video.size === undefined ? {} : { size: plan.video.size }) } }),
115
+ });
116
+ // Undo steps run newest first. Registration order is therefore: the video (finished after the close), the close,
117
+ // the trace (stopped before the close). The video file only exists once the app has closed.
118
+ const recorded = {};
119
+ if (plan !== undefined && videoDir !== undefined) {
120
+ stack.add("finish the video of the Obsidian window", () => finishVideo(recorded.video, plan, outcome.failed, options.timeouts.close));
121
+ }
122
+ // Registered before anything else touches `app`, so every later failure closes it. The pid is read right after
123
+ // registering, not inside the step: once `app.close()` has run, Playwright disposes the object and
124
+ // `app.process()` throws (seen in the first live run, Playwright 1.65). A pid that cannot be read is kept as an
125
+ // error and reported after the close attempt.
126
+ const processId = {};
127
+ stack.add("close Obsidian and its process tree", () => shutdown(app, processId, deps.io, options.timeouts.close));
128
+ try {
129
+ processId.pid = app.process().pid;
130
+ }
131
+ catch (error) {
132
+ processId.error = error;
133
+ }
134
+ if (plan !== undefined && shouldRecord(plan.trace.mode, plan.retry)) {
135
+ const { trace } = plan;
136
+ // Before the readiness wait, so the startup is in the trace. A failure here is a failure of the start: the
137
+ // stack closes the app.
138
+ await app.context().tracing.start({
139
+ screenshots: trace.screenshots,
140
+ snapshots: trace.snapshots,
141
+ sources: trace.sources,
142
+ title: context.label,
143
+ });
144
+ stack.add("stop the trace of the Obsidian window", () => stopTrace(app, plan, outcome.failed, options.timeouts.trace));
145
+ }
146
+ // The vault id is the key Obsidian stores the trust flag under; the kit chose it when it wrote obsidian.json.
147
+ // Set before the window's scripts run, so the trust dialog never appears (no dialog to find, click or wait for).
148
+ await app.context().addInitScript(applyTrust, trustKey(vaultId));
149
+ const win = await app.firstWindow();
150
+ if (videoDir !== undefined) {
151
+ recorded.video = win.video();
152
+ }
153
+ // Auto-dismiss native JS dialogs (alert/confirm/prompt): the playwright-electron teardown sometimes synthesises
154
+ // a dialog-handle call that hangs without a handler. A failed dismiss only means the dialog is already gone.
155
+ win.on("dialog", (dialog) => {
156
+ dialog.dismiss().catch(() => undefined);
157
+ });
158
+ if (options.window !== undefined) {
159
+ await app.evaluate(resizeMainWindow, options.window);
160
+ }
161
+ await waitForReady(win, sources.map((source) => source.id), options.timeouts.ready);
162
+ // The session fixture runs with its own timeout, so Playwright counts its time in a separate slot and the reported
163
+ // test duration covers the test body only; this note carries the launch time.
164
+ context.annotate("obsidian-launch-ms", String(now() - launchStartedAt));
165
+ await checkVersion(win, options.expectedVersion, context);
166
+ return {
167
+ app,
168
+ win,
169
+ vault: createVaultHandle(vaultPath),
170
+ teardown: (result) => {
171
+ outcome.failed = result?.failed ?? false;
172
+ return stack.run();
173
+ },
174
+ };
175
+ }
176
+ /** Reads the running version, records it in the report and fails when it is not the one the run asked for. */
177
+ async function checkVersion(win, expected, context) {
178
+ let running = null;
179
+ let readError;
180
+ try {
181
+ running = await win.evaluate(readRunningVersion);
182
+ }
183
+ catch (error) {
184
+ readError = error instanceof Error ? error.message : String(error);
185
+ }
186
+ context.annotate("obsidian-version", running ?? "unknown");
187
+ context.annotate("launch-mode", "electron");
188
+ if (expected === null) {
189
+ return;
190
+ }
191
+ context.annotate("obsidian-expected-version", expected);
192
+ const verdict = compareObsidianVersions(expected, running);
193
+ if (verdict.status === "mismatch") {
194
+ throw new Error(verdict.message);
195
+ }
196
+ if (verdict.status === "unknown") {
197
+ throw new Error(`Cannot verify OBSIDIAN_VERSION=${expected}: ${verdict.message}${readError === undefined ? "" : ` (${readError})`}.`);
198
+ }
199
+ }
200
+ /** Rejects with `message` when `work` takes longer than `ms`; the work itself is left running. */
201
+ async function within(work, ms, message) {
202
+ let timer;
203
+ const timeout = new Promise((_resolve, reject) => {
204
+ timer = setTimeout(() => {
205
+ reject(new Error(message));
206
+ }, ms);
207
+ });
208
+ try {
209
+ return await Promise.race([work, timeout]);
210
+ }
211
+ finally {
212
+ clearTimeout(timer);
213
+ }
214
+ }
215
+ /** Stops the trace while the app is still open. The zip is written (and attached) only when the mode keeps it. */
216
+ async function stopTrace(app, plan, failed, ms) {
217
+ const keep = shouldKeep(plan.trace.mode, failed, plan.retry);
218
+ const file = keep ? plan.outputPath(TRACE_FILE) : undefined;
219
+ await within(app.context().tracing.stop(file === undefined ? undefined : { path: file }), ms, `Stopping the Obsidian trace took longer than ${String(ms)} ms (timeouts.trace). Obsidian is probably hung, or the test recorded a lot: raise timeouts.trace for a long traced test. The app is closed next.`);
220
+ if (file !== undefined) {
221
+ plan.attach("trace", file, "application/zip");
222
+ }
223
+ }
224
+ /** Runs after the app has closed: keeps the video as an attachment or deletes the file, per the mode. */
225
+ async function finishVideo(video, plan, failed, ms) {
226
+ if (video === undefined || video === null) {
227
+ // The window never opened (or recording did not start), so there is no file to keep or delete.
228
+ return;
229
+ }
230
+ const file = await within(video.path(), ms, `Playwright did not finish the Obsidian video within ${String(ms)} ms. Look for a stray .webm in the test-results folder.`);
231
+ if (!shouldKeep(plan.video.mode, failed, plan.retry)) {
232
+ fs.rmSync(file, { force: true });
233
+ return;
234
+ }
235
+ if (!fs.existsSync(file)) {
236
+ throw new Error(`The Obsidian video was expected at ${file} but is not there. The test result is not affected.`);
237
+ }
238
+ plan.attach("video", file, "video/webm");
239
+ }
240
+ async function shutdown(app, processId, io, closeMs) {
241
+ // Obsidian sometimes refuses to exit cleanly (a workspace-save prompt, or a listener that blocks `before-quit`)
242
+ // and `app.close()` then never resolves. Race it against a timeout; what matters is that the process tree is
243
+ // gone, and that is verified below, so a failing `close()` itself is not worth a failure.
244
+ let timer;
245
+ const timeout = new Promise((resolve) => {
246
+ timer = setTimeout(resolve, closeMs);
247
+ });
248
+ try {
249
+ await Promise.race([app.close().catch(() => undefined), timeout]);
250
+ }
251
+ finally {
252
+ clearTimeout(timer);
253
+ }
254
+ const { pid } = processId;
255
+ if (pid === undefined) {
256
+ const reason = processId.error === undefined ? "" : ` (${errorText(processId.error)})`;
257
+ throw new Error(`Playwright gave no process id for Obsidian${reason}, so the process tree could not be checked. Look for stray Obsidian processes.`, { cause: processId.error });
258
+ }
259
+ await terminateTree(pid, io);
260
+ }
261
+ function errorText(error) {
262
+ if (error instanceof Error) {
263
+ return error.message;
264
+ }
265
+ return typeof error === "string" ? error : JSON.stringify(error);
266
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Defaults merged into the vault's `.obsidian/app.json` under what the seed vault already sets, so a test never
3
+ * has to answer a prompt that nobody is there to click.
4
+ * - `settingsPopoutWindow: false`: Settings otherwise opens in a second window on some Obsidian versions, and the
5
+ * page Playwright drives (and screenshots) does not show it.
6
+ * - `alwaysUpdateLinks: true`: otherwise renaming a file shows an "Update links?" modal that blocks the file
7
+ * manager's update queue forever.
8
+ */
9
+ export declare const APP_JSON_DEFAULTS: {
10
+ readonly settingsPopoutWindow: false;
11
+ readonly alwaysUpdateLinks: true;
12
+ };
13
+ /** A random vault id in the shape Obsidian uses (16 hex digits). */
14
+ export declare function generateVaultId(): string;
15
+ /** The localStorage key that marks community plugins as trusted for one vault. */
16
+ export declare function trustKey(vaultId: string): string;
17
+ /**
18
+ * The `obsidian.json` of a fresh user-data folder. Without a registered vault Obsidian opens the vault picker and
19
+ * no workspace is ever visible. Both auto-open markers are written (`open: true` on the vault entry for current
20
+ * versions, top-level `last_open` for older ones) and `updateDisabled` stops a self-update during the run.
21
+ */
22
+ export declare function buildObsidianJson(params: {
23
+ vaultId: string;
24
+ vaultPath: string;
25
+ now: number;
26
+ }): Record<string, unknown>;
27
+ /** Seed settings win; only keys the seed does not set get the default. */
28
+ export declare function mergeAppJson(existing: Readonly<Record<string, unknown>>): Record<string, unknown>;
29
+ /** Copies the seed vault, resolving symlinks, so test mutations cannot reach the repository or a linked build. */
30
+ export declare function copySeedVault(seedVault: string, destination: string): void;
31
+ export declare function writeJson(file: string, value: unknown): void;
32
+ /** Reads a JSON object file; `{}` when it does not exist. Throws with the path when it is not a JSON object. */
33
+ export declare function readJsonObject(file: string): Record<string, unknown>;
34
+ export declare function writeUserData(params: {
35
+ userDataDir: string;
36
+ vaultId: string;
37
+ vaultPath: string;
38
+ now: number;
39
+ }): void;
40
+ export declare function writeAppDefaults(vaultPath: string): void;
41
+ /** Read and write access to files inside the test vault, by vault-relative path. */
42
+ export interface VaultHandle {
43
+ /** Absolute path of the per-test vault copy. */
44
+ readonly path: string;
45
+ /** Absolute path for a vault-relative one. Throws when it would leave the vault. */
46
+ resolve(relativePath: string): string;
47
+ exists(relativePath: string): boolean;
48
+ read(relativePath: string): string;
49
+ /** Writes the file, creating folders. */
50
+ write(relativePath: string, content: string): void;
51
+ }
52
+ export declare function createVaultHandle(vaultPath: string): VaultHandle;
@@ -0,0 +1,146 @@
1
+ import crypto from "node:crypto";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ /**
5
+ * Defaults merged into the vault's `.obsidian/app.json` under what the seed vault already sets, so a test never
6
+ * has to answer a prompt that nobody is there to click.
7
+ * - `settingsPopoutWindow: false`: Settings otherwise opens in a second window on some Obsidian versions, and the
8
+ * page Playwright drives (and screenshots) does not show it.
9
+ * - `alwaysUpdateLinks: true`: otherwise renaming a file shows an "Update links?" modal that blocks the file
10
+ * manager's update queue forever.
11
+ */
12
+ export const APP_JSON_DEFAULTS = { settingsPopoutWindow: false, alwaysUpdateLinks: true };
13
+ /** A random vault id in the shape Obsidian uses (16 hex digits). */
14
+ export function generateVaultId() {
15
+ return crypto.randomBytes(8).toString("hex");
16
+ }
17
+ /** The localStorage key that marks community plugins as trusted for one vault. */
18
+ export function trustKey(vaultId) {
19
+ return `enable-plugin-${vaultId}`;
20
+ }
21
+ /**
22
+ * The `obsidian.json` of a fresh user-data folder. Without a registered vault Obsidian opens the vault picker and
23
+ * no workspace is ever visible. Both auto-open markers are written (`open: true` on the vault entry for current
24
+ * versions, top-level `last_open` for older ones) and `updateDisabled` stops a self-update during the run.
25
+ */
26
+ export function buildObsidianJson(params) {
27
+ return {
28
+ updateDisabled: true,
29
+ last_open: params.vaultId,
30
+ vaults: { [params.vaultId]: { path: params.vaultPath, ts: params.now, open: true } },
31
+ };
32
+ }
33
+ /** Seed settings win; only keys the seed does not set get the default. */
34
+ export function mergeAppJson(existing) {
35
+ return { ...APP_JSON_DEFAULTS, ...existing };
36
+ }
37
+ /** Copies the seed vault, resolving symlinks, so test mutations cannot reach the repository or a linked build. */
38
+ export function copySeedVault(seedVault, destination) {
39
+ let stat;
40
+ try {
41
+ stat = fs.statSync(seedVault);
42
+ }
43
+ catch (error) {
44
+ throw new Error(`Seed vault ${seedVault} does not exist. Set the seedVault option (or OPDK_E2E_VAULT) to a vault folder.`, { cause: error });
45
+ }
46
+ if (!stat.isDirectory()) {
47
+ throw new Error(`Seed vault ${seedVault} is not a folder.`);
48
+ }
49
+ copyTreeResolveLinks(seedVault, destination, seedVault);
50
+ }
51
+ /**
52
+ * Recursive copy that follows symlinks, so the test vault gets real copies of the plugin build and not links back
53
+ * to the repo (which would let test mutations contaminate it). Written by hand because `fs.cpSync` with
54
+ * `dereference: true` leaves file symlinks as links on Node 22.
55
+ *
56
+ * `chain` holds the real paths of the folders being copied right now. A link back to one of them would recurse
57
+ * until the path is too long, so it is refused naming the link. A link to nothing is refused naming the seed vault.
58
+ */
59
+ function copyTreeResolveLinks(source, destination, seedVault, chain = []) {
60
+ const here = fs.realpathSync(source);
61
+ const inProgress = [...chain, here];
62
+ fs.mkdirSync(destination, { recursive: true });
63
+ for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
64
+ const from = path.join(source, entry.name);
65
+ const to = path.join(destination, entry.name);
66
+ const real = entry.isSymbolicLink() ? resolveLink(from, seedVault) : from;
67
+ if (fs.statSync(real).isDirectory()) {
68
+ if (inProgress.includes(fs.realpathSync(real))) {
69
+ throw new Error(`Seed vault ${seedVault} contains a symlink loop: ${from} points back to ${real}, which is already being copied. Remove the link.`);
70
+ }
71
+ copyTreeResolveLinks(real, to, seedVault, inProgress);
72
+ }
73
+ else {
74
+ fs.copyFileSync(real, to);
75
+ }
76
+ }
77
+ }
78
+ function resolveLink(link, seedVault) {
79
+ try {
80
+ return fs.realpathSync(link);
81
+ }
82
+ catch (error) {
83
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
84
+ throw new Error(`Seed vault ${seedVault} contains a symlink that points to nothing: ${link}. Fix or remove the link.`, { cause: error });
85
+ }
86
+ throw error;
87
+ }
88
+ }
89
+ export function writeJson(file, value) {
90
+ fs.mkdirSync(path.dirname(file), { recursive: true });
91
+ fs.writeFileSync(file, JSON.stringify(value, null, 2));
92
+ }
93
+ /** Reads a JSON object file; `{}` when it does not exist. Throws with the path when it is not a JSON object. */
94
+ export function readJsonObject(file) {
95
+ let text;
96
+ try {
97
+ text = fs.readFileSync(file, "utf8");
98
+ }
99
+ catch (error) {
100
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
101
+ return {};
102
+ }
103
+ throw error;
104
+ }
105
+ let parsed;
106
+ try {
107
+ parsed = JSON.parse(text);
108
+ }
109
+ catch (error) {
110
+ throw new Error(`${file} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`, {
111
+ cause: error,
112
+ });
113
+ }
114
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
115
+ throw new Error(`${file} must contain a JSON object.`);
116
+ }
117
+ return Object.fromEntries(Object.entries(parsed));
118
+ }
119
+ export function writeUserData(params) {
120
+ writeJson(path.join(params.userDataDir, "obsidian.json"), buildObsidianJson(params));
121
+ }
122
+ export function writeAppDefaults(vaultPath) {
123
+ const file = path.join(vaultPath, ".obsidian", "app.json");
124
+ writeJson(file, mergeAppJson(readJsonObject(file)));
125
+ }
126
+ export function createVaultHandle(vaultPath) {
127
+ const root = path.resolve(vaultPath);
128
+ const resolve = (relativePath) => {
129
+ const target = path.resolve(root, relativePath);
130
+ if (target !== root && !target.startsWith(root + path.sep)) {
131
+ throw new Error(`"${relativePath}" is outside the vault (${root}). Use a path relative to the vault.`);
132
+ }
133
+ return target;
134
+ };
135
+ return {
136
+ path: root,
137
+ resolve,
138
+ exists: (relativePath) => fs.existsSync(resolve(relativePath)),
139
+ read: (relativePath) => fs.readFileSync(resolve(relativePath), "utf8"),
140
+ write: (relativePath, content) => {
141
+ const target = resolve(relativePath);
142
+ fs.mkdirSync(path.dirname(target), { recursive: true });
143
+ fs.writeFileSync(target, content);
144
+ },
145
+ };
146
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Pure helpers for the "which Obsidian did this run actually test?" check. No Node or Playwright imports on
3
+ * purpose: the comparison is unit tested without touching Obsidian.
4
+ */
5
+ /** Outcome of comparing the version a run was meant to test with the one that is actually running. */
6
+ export interface VersionVerdict {
7
+ /**
8
+ * `match`: same x.y.z. `mismatch`: the run is testing the wrong build. `unknown`: one side could not be
9
+ * determined, so nothing is claimed.
10
+ */
11
+ readonly status: "match" | "mismatch" | "unknown";
12
+ /** Human-readable line for the failure message and the test annotation. */
13
+ readonly message: string;
14
+ }
15
+ /** True for a plain `x.y.z` string. Channel aliases such as `latest` are not accepted: the kit only checks, it never downloads. */
16
+ export declare function isExplicitVersion(value: string): boolean;
17
+ /** Trims a version read from an env var or the renderer. Returns `null` when nothing usable is left. */
18
+ export declare function normalizeVersion(raw: string | null | undefined): string | null;
19
+ /**
20
+ * Compares the expected and the running Obsidian version.
21
+ *
22
+ * Equality is on the trimmed string: Obsidian reports `x.y.z` for `ipcRenderer.sendSync("version")`, so no semver
23
+ * range logic is wanted (a "close enough" match would defeat the check).
24
+ */
25
+ export declare function compareObsidianVersions(expected: string | null | undefined, actual: string | null | undefined): VersionVerdict;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Pure helpers for the "which Obsidian did this run actually test?" check. No Node or Playwright imports on
3
+ * purpose: the comparison is unit tested without touching Obsidian.
4
+ */
5
+ const EXPLICIT_VERSION = /^\d+\.\d+\.\d+$/;
6
+ /** True for a plain `x.y.z` string. Channel aliases such as `latest` are not accepted: the kit only checks, it never downloads. */
7
+ export function isExplicitVersion(value) {
8
+ return EXPLICIT_VERSION.test(value);
9
+ }
10
+ /** Trims a version read from an env var or the renderer. Returns `null` when nothing usable is left. */
11
+ export function normalizeVersion(raw) {
12
+ const trimmed = raw?.trim();
13
+ return trimmed === undefined || trimmed === "" ? null : trimmed;
14
+ }
15
+ /**
16
+ * Compares the expected and the running Obsidian version.
17
+ *
18
+ * Equality is on the trimmed string: Obsidian reports `x.y.z` for `ipcRenderer.sendSync("version")`, so no semver
19
+ * range logic is wanted (a "close enough" match would defeat the check).
20
+ */
21
+ export function compareObsidianVersions(expected, actual) {
22
+ const want = normalizeVersion(expected);
23
+ const got = normalizeVersion(actual);
24
+ if (got === null) {
25
+ return { status: "unknown", message: "could not read the running Obsidian version from the renderer" };
26
+ }
27
+ if (want === null) {
28
+ return { status: "unknown", message: `running Obsidian ${got}; no expected version to compare against` };
29
+ }
30
+ if (want === got) {
31
+ return { status: "match", message: `Obsidian ${got}` };
32
+ }
33
+ return {
34
+ status: "mismatch",
35
+ message: `Obsidian version mismatch: expected ${want}, but ${got} is running. ` +
36
+ `The run is not testing the build you asked for. Check OBSIDIAN_VERSION ` +
37
+ `and the installed Obsidian (a newer obsidian-<version>.asar in the user-data ` +
38
+ `dir, or an auto-update, can override the bundled one).`,
39
+ };
40
+ }
@@ -0,0 +1,2 @@
1
+ export { BARE_WINDOW_SELECTOR, DEFAULT_IGNORES, obsidianPlugin } from "./obsidian-plugin.js";
2
+ export type { ObsidianPluginOptions } from "./obsidian-plugin.js";
@@ -0,0 +1 @@
1
+ export { BARE_WINDOW_SELECTOR, DEFAULT_IGNORES, obsidianPlugin } from "./obsidian-plugin.js";
@@ -0,0 +1,49 @@
1
+ import type { Linter } from "eslint";
2
+ /** Settings of `obsidianPlugin()`. Every key is optional. */
3
+ export interface ObsidianPluginOptions {
4
+ /**
5
+ * Folder the tsconfig is looked up from. Default `process.cwd()`, which is the plugin root when ESLint runs
6
+ * from there; pass `import.meta.dirname` so an editor that starts ESLint elsewhere finds it too.
7
+ */
8
+ readonly rootDir?: string;
9
+ /** tsconfig for the type-aware rules, relative to `rootDir`. Default `"./tsconfig.json"`. */
10
+ readonly tsconfig?: string;
11
+ /** Added to {@link DEFAULT_IGNORES}. Patterns are ESLint globs relative to the plugin root. */
12
+ readonly ignores?: readonly string[];
13
+ }
14
+ /**
15
+ * What every plugin on the kit leaves out of linting (the intersection of their lists, not the union): dependencies and build output, unit-test files, e2e folders, scripts, and the config files of the test
16
+ * runners (they are not in the tsconfig). Paths only some plugins have (`site/**`, `.preview/**`,
17
+ * `src/test/**`, `tools/**`, `integration/**`) belong in that plugin's `ignores` option.
18
+ */
19
+ export declare const DEFAULT_IGNORES: readonly string[];
20
+ export interface ResolvedPluginOptions {
21
+ readonly rootDir: string;
22
+ readonly tsconfig: string;
23
+ readonly ignores: string[];
24
+ }
25
+ /** Applies the defaults and rejects values of the wrong type, naming the option. */
26
+ export declare function resolveOptions(options: ObsidianPluginOptions, cwd: string): ResolvedPluginOptions;
27
+ /** Selector of `no-restricted-syntax` below. A computed access (`window["x"]`) has no `property.name`, so it is reported. */
28
+ export declare const BARE_WINDOW_SELECTOR = "MemberExpression[object.name='window']:not([property.name=/^(open|setTimeout|clearTimeout|setInterval|clearInterval|requestAnimationFrame|cancelAnimationFrame)$/])";
29
+ /**
30
+ * The lint setup the kit's plugins share, as a flat config to spread into the plugin's own
31
+ * `eslint.config.js`:
32
+ *
33
+ * ```js
34
+ * import { obsidianPlugin } from "obsidian-plugin-dev-kit/eslint";
35
+ * export default [...obsidianPlugin({ rootDir: import.meta.dirname })];
36
+ * ```
37
+ *
38
+ * It is eslint-plugin-obsidianmd's `recommended` preset as is (that carries ESLint's core rules and
39
+ * typescript-eslint's `recommendedTypeChecked` for TypeScript), plus the three things all three plugins add:
40
+ * timers on `window` and a settings tab that declares its settings are errors rather than warnings, and unused
41
+ * arguments, variables and caught errors are errors unless they start with `_`. On top of that comes one rule of
42
+ * the kit's own: a bare `window.<member>` is an error (use `activeWindow`; `window.open` and the timer functions
43
+ * are exempt). Turn it off with `"no-restricted-syntax": "off"` in a block after the preset; setting
44
+ * `no-restricted-syntax` yourself replaces it.
45
+ *
46
+ * Do not enable `@typescript-eslint/no-misused-promises` next to it: the preset replaces it with
47
+ * `obsidianmd/no-misused-promises`, which does not count Obsidian's chaining `then` as a Promise.
48
+ */
49
+ export declare function obsidianPlugin(options?: ObsidianPluginOptions): Linter.Config[];