mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-09-04 01:37:05 +00:00
(chore): tidied tsconfig and eslint, and some incorrect imports
This commit is contained in:
+41
-30
@@ -6,37 +6,41 @@ import * as sveltePlugin from "eslint-plugin-svelte";
|
|||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
globalIgnores([
|
globalIgnores([
|
||||||
"**/node_modules/*",
|
// Build outputs and legacy files
|
||||||
"**/jest.config.js",
|
"**/build",
|
||||||
|
"**/main.js",
|
||||||
|
"**/.eslintrc.js.bak",
|
||||||
|
// Files from linked dependencies (those files should not exist for most people).
|
||||||
|
"modules/octagonal-wheels/dist/**/*",
|
||||||
|
|
||||||
|
// Sub-projects (Exclude from root linting as they have different environments)
|
||||||
|
"src/apps/**/*",
|
||||||
|
|
||||||
|
// Specific exclusions from common library (src/lib)
|
||||||
"src/lib/coverage",
|
"src/lib/coverage",
|
||||||
"src/lib/browsertest",
|
"src/lib/browsertest",
|
||||||
"**/test.ts",
|
|
||||||
"**/tests.ts",
|
|
||||||
"**/**test.ts",
|
|
||||||
"**/**.test.ts",
|
|
||||||
"**/*.unit.spec.ts",
|
|
||||||
"**/esbuild.*.mjs",
|
|
||||||
"**/terser.*.mjs",
|
|
||||||
"**/node_modules",
|
|
||||||
"**/build",
|
|
||||||
"**/.eslintrc.js.bak",
|
|
||||||
"src/lib/src/patches/pouchdb-utils",
|
|
||||||
"**/esbuild.config.mjs",
|
|
||||||
"**/rollup.config.js",
|
|
||||||
"modules/octagonal-wheels/rollup.config.js",
|
|
||||||
"modules/octagonal-wheels/dist/**/*",
|
|
||||||
"src/lib/test",
|
"src/lib/test",
|
||||||
"src/lib/_tools",
|
"src/lib/_tools",
|
||||||
|
"src/lib/src/patches/pouchdb-utils",
|
||||||
"src/lib/src/cli",
|
"src/lib/src/cli",
|
||||||
"**/main.js",
|
|
||||||
"src/apps/**/*",
|
|
||||||
".prettierrc.*.mjs",
|
|
||||||
".prettierrc.mjs",
|
|
||||||
"*.config.mjs",
|
|
||||||
"src/apps/**/*",
|
|
||||||
"src/lib/src/services/implements/browser/**",
|
"src/lib/src/services/implements/browser/**",
|
||||||
"src/lib/src/services/implements/headless/**",
|
"src/lib/src/services/implements/headless/**",
|
||||||
"src/lib/src/API",
|
"src/lib/src/API",
|
||||||
|
|
||||||
|
// Config files and build scripts
|
||||||
|
"**/jest.config.js",
|
||||||
|
"**/rollup.config.js",
|
||||||
|
"**/esbuild.config.mjs",
|
||||||
|
"**/terser.*.mjs",
|
||||||
|
".prettierrc.*.mjs",
|
||||||
|
".prettierrc.mjs",
|
||||||
|
"*.config.mjs",
|
||||||
|
|
||||||
|
// Testing files (Simplified patterns)
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.unit.spec.ts",
|
||||||
|
"**/test.ts",
|
||||||
|
"**/tests.ts",
|
||||||
]),
|
]),
|
||||||
...sveltePlugin.configs["flat/base"],
|
...sveltePlugin.configs["flat/base"],
|
||||||
...obsidianmd.configs.recommended,
|
...obsidianmd.configs.recommended,
|
||||||
@@ -50,22 +54,29 @@ export default defineConfig([
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
|
// Base rules (turned off in favour of TS specific versions or explicitly disabled).
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"@typescript-eslint/no-unused-vars": ["error", { args: "none" }],
|
|
||||||
"no-unused-labels": "off",
|
"no-unused-labels": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
|
||||||
"no-prototype-builtins": "off",
|
"no-prototype-builtins": "off",
|
||||||
|
"require-await": "off",
|
||||||
|
|
||||||
|
// TypeScript specific rules
|
||||||
|
"@typescript-eslint/no-unused-vars": ["error", { args: "none" }],
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/no-empty-function": "off",
|
"@typescript-eslint/no-empty-function": "off",
|
||||||
"require-await": "error",
|
|
||||||
"obsidianmd/rule-custom-message": "off", // Temporary
|
|
||||||
"obsidianmd/ui/sentence-case": "off", // Temporary
|
|
||||||
"@typescript-eslint/require-await": "warn",
|
"@typescript-eslint/require-await": "warn",
|
||||||
"@typescript-eslint/no-misused-promises": "warn",
|
"@typescript-eslint/no-misused-promises": "warn",
|
||||||
"@typescript-eslint/no-floating-promises": "warn",
|
"@typescript-eslint/no-floating-promises": "warn",
|
||||||
"no-async-promise-executor": "warn",
|
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||||
|
|
||||||
|
// General rules
|
||||||
|
"no-async-promise-executor": "warn",
|
||||||
"no-constant-condition": ["error", { checkLoops: false }],
|
"no-constant-condition": ["error", { checkLoops: false }],
|
||||||
|
|
||||||
|
// Plugin specific overrides (Pending review)
|
||||||
|
"obsidianmd/rule-custom-message": "off",
|
||||||
|
"obsidianmd/ui/sentence-case": "off",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -77,7 +88,7 @@ export default defineConfig([
|
|||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
|
"no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
|
||||||
"obsidianmd/no-plugin-as-component": "off", // Temporary
|
"obsidianmd/no-plugin-as-component": "off",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ import { ConflictResolveModal } from "../../modules/features/InteractiveConflict
|
|||||||
import { Semaphore } from "octagonal-wheels/concurrency/semaphore";
|
import { Semaphore } from "octagonal-wheels/concurrency/semaphore";
|
||||||
import { EVENT_REQUEST_OPEN_PLUGIN_SYNC_DIALOG, eventHub } from "../../common/events.ts";
|
import { EVENT_REQUEST_OPEN_PLUGIN_SYNC_DIALOG, eventHub } from "../../common/events.ts";
|
||||||
import { PluginDialogModal } from "./PluginDialogModal.ts";
|
import { PluginDialogModal } from "./PluginDialogModal.ts";
|
||||||
import { $msg } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "@/lib/src/common/i18n.ts";
|
||||||
import type { InjectableServiceHub } from "../../lib/src/services/InjectableServices.ts";
|
import type { InjectableServiceHub } from "../../lib/src/services/InjectableServices.ts";
|
||||||
import type { LiveSyncCore } from "../../main.ts";
|
import type { LiveSyncCore } from "../../main.ts";
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { WorkspaceLeaf } from "@/deps.ts";
|
|||||||
import LogPaneComponent from "./LogPane.svelte";
|
import LogPaneComponent from "./LogPane.svelte";
|
||||||
import type ObsidianLiveSyncPlugin from "../../../main.ts";
|
import type ObsidianLiveSyncPlugin from "../../../main.ts";
|
||||||
import { SvelteItemView } from "../../../common/SvelteItemView.ts";
|
import { SvelteItemView } from "../../../common/SvelteItemView.ts";
|
||||||
import { $msg } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "@lib/common/i18n.ts";
|
||||||
import { mount } from "svelte";
|
import { mount } from "svelte";
|
||||||
export const VIEW_TYPE_LOG = "log-log";
|
export const VIEW_TYPE_LOG = "log-log";
|
||||||
//Log view
|
//Log view
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import { addIcon, debounce, normalizePath, Notice, stringifyYaml, type Workspace
|
|||||||
import { LOG_LEVEL_NOTICE, setGlobalLogFunction } from "octagonal-wheels/common/logger";
|
import { LOG_LEVEL_NOTICE, setGlobalLogFunction } from "octagonal-wheels/common/logger";
|
||||||
import { LogPaneView, VIEW_TYPE_LOG } from "./Log/LogPaneView.ts";
|
import { LogPaneView, VIEW_TYPE_LOG } from "./Log/LogPaneView.ts";
|
||||||
import { serialized } from "octagonal-wheels/concurrency/lock";
|
import { serialized } from "octagonal-wheels/concurrency/lock";
|
||||||
import { $msg } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "@lib/common/i18n.ts";
|
||||||
import { P2PLogCollector } from "@/lib/src/replication/trystero/P2PLogCollector.ts";
|
import { P2PLogCollector } from "@/lib/src/replication/trystero/P2PLogCollector.ts";
|
||||||
import type { LiveSyncCore } from "../../main.ts";
|
import type { LiveSyncCore } from "../../main.ts";
|
||||||
import { LiveSyncError } from "@lib/common/LSError.ts";
|
import { LiveSyncError } from "@lib/common/LSError.ts";
|
||||||
|
|||||||
@@ -8,12 +8,7 @@ import {
|
|||||||
type ValueComponent,
|
type ValueComponent,
|
||||||
} from "@/deps.ts";
|
} from "@/deps.ts";
|
||||||
import { unique } from "octagonal-wheels/collection";
|
import { unique } from "octagonal-wheels/collection";
|
||||||
import {
|
import { LEVEL_ADVANCED, LEVEL_POWER_USER, statusDisplay, type ConfigurationItem } from "@lib/common/types.ts";
|
||||||
LEVEL_ADVANCED,
|
|
||||||
LEVEL_POWER_USER,
|
|
||||||
statusDisplay,
|
|
||||||
type ConfigurationItem,
|
|
||||||
} from "../../../lib/src/common/types.ts";
|
|
||||||
import { createStub, type ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
import { createStub, type ObsidianLiveSyncSettingTab } from "./ObsidianLiveSyncSettingTab.ts";
|
||||||
import {
|
import {
|
||||||
type AllSettingItemKey,
|
type AllSettingItemKey,
|
||||||
@@ -23,7 +18,7 @@ import {
|
|||||||
type AllNumericItemKey,
|
type AllNumericItemKey,
|
||||||
type AllBooleanItemKey,
|
type AllBooleanItemKey,
|
||||||
} from "./settingConstants.ts";
|
} from "./settingConstants.ts";
|
||||||
import { $msg } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "@lib/common/i18n.ts";
|
||||||
import { findAttrFromParent, wrapMemo, type AutoWireOption, type OnUpdateResult } from "./SettingPane.ts";
|
import { findAttrFromParent, wrapMemo, type AutoWireOption, type OnUpdateResult } from "./SettingPane.ts";
|
||||||
|
|
||||||
export class LiveSyncSetting extends Setting {
|
export class LiveSyncSetting extends Setting {
|
||||||
|
|||||||
+2
-3
@@ -2,7 +2,6 @@
|
|||||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||||
"inlineSourceMap": true,
|
"inlineSourceMap": true,
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"target": "ES2018",
|
"target": "ES2018",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
@@ -20,8 +19,8 @@
|
|||||||
"strictBindCallApply": true,
|
"strictBindCallApply": true,
|
||||||
"strictFunctionTypes": true,
|
"strictFunctionTypes": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*"],
|
"@/*": ["./src/*"],
|
||||||
"@lib/*": ["src/lib/src/*"]
|
"@lib/*": ["./src/lib/src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts", "test/**/*.test.ts", "**/*.unit.spec.ts"],
|
"include": ["**/*.ts", "test/**/*.test.ts", "**/*.unit.spec.ts"],
|
||||||
|
|||||||
Reference in New Issue
Block a user