mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-28 20:13:21 +00:00
refactor: align platform APIs with community review
This commit is contained in:
1 parent
298738fc67
commit
326bf77183
39 files changed
+444
-294
No files matched your search
+36
-4
@@ -7,10 +7,19 @@ import svelteParser from "svelte-eslint-parser";
|
||||
import importAlias from "@dword-design/eslint-plugin-import-alias";
|
||||
import { baseRules, ImportAliasRules, obsidianRules } from "./eslint.config.common.mjs";
|
||||
const warnWhileDev = "off"; // Change to "warn" to enable warnings for rules that are currently disabled.
|
||||
const lintProjects = [
|
||||
"./tsconfig.json",
|
||||
"./src/apps/browser/tsconfig.json",
|
||||
"./src/apps/cli/tsconfig.json",
|
||||
"./src/apps/webapp/tsconfig.json",
|
||||
"./src/apps/webpeer/tsconfig.app.json",
|
||||
"./src/apps/webpeer/tsconfig.node.json",
|
||||
];
|
||||
export default defineConfig([
|
||||
globalIgnores([
|
||||
// Build outputs and legacy files
|
||||
"**/build",
|
||||
"**/dist/**",
|
||||
"coverage",
|
||||
"**/main.js",
|
||||
"main_org.js",
|
||||
@@ -22,8 +31,7 @@ export default defineConfig([
|
||||
// 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",
|
||||
// Sub-project tooling with its own environment
|
||||
"utils",
|
||||
|
||||
// Config files and build scripts
|
||||
@@ -38,6 +46,9 @@ export default defineConfig([
|
||||
"vitest.*",
|
||||
// Testing files (Simplified patterns)
|
||||
"test/**",
|
||||
"**/test/**",
|
||||
"src/apps/_test/**",
|
||||
"src/apps/cli/testdeno/**",
|
||||
"**/*.test.ts",
|
||||
"**/*.unit.spec.ts",
|
||||
"**/test.ts",
|
||||
@@ -52,8 +63,8 @@ export default defineConfig([
|
||||
globals: { ...globals.browser, PouchDB: "readonly" },
|
||||
parser: tsParser,
|
||||
parserOptions: {
|
||||
project: "./tsconfig.json",
|
||||
rootDir: "./",
|
||||
project: lintProjects,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
linterOptions: {
|
||||
@@ -73,6 +84,8 @@ export default defineConfig([
|
||||
parser: svelteParser,
|
||||
parserOptions: {
|
||||
parser: tsParser,
|
||||
project: lintProjects,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
extraFileExtensions: [".svelte"],
|
||||
},
|
||||
},
|
||||
@@ -86,4 +99,23 @@ export default defineConfig([
|
||||
...ImportAliasRules("."),
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["src/apps/**/*.ts"],
|
||||
rules: {
|
||||
// Platform adapters implement asynchronous contracts even when a local operation is synchronous.
|
||||
"@typescript-eslint/require-await": "off",
|
||||
// Keep existing application code visible without making gradual type tightening a release blocker.
|
||||
"@typescript-eslint/no-base-to-string": "warn",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
|
||||
"@typescript-eslint/restrict-template-expressions": "warn",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["src/apps/browser/**/*.{ts,svelte}", "src/apps/webapp/**/*.ts"],
|
||||
rules: {
|
||||
// Browser applications use the DOM rather than Obsidian's DOM extensions.
|
||||
"obsidianmd/prefer-create-el": "off",
|
||||
"obsidianmd/prefer-active-doc": "off",
|
||||
},
|
||||
},
|
||||
]);
|
||||
Reference in new issue
Block a user