Skip to content

Commit 13fa668

Browse files
committed
chore(lint): migrate from eslint to oxlint
oxlint runs the same policy surface in ~1s with no typescript peer constraint of its own: - typescript/unicorn/oxc/import plugins + correctness category cover the old js/ts recommended sets; consistent-type-imports, no-unused-vars(args:none) and import/no-duplicates carried over - eslint-plugin-obsidianmd runs unchanged via oxlint jsPlugins (all 7 guideline rules verified firing, incl. nested-name rules) along with the no-restricted-globals app/fetch/localStorage policy - eslint itself remains only as an internal dependency of eslint-plugin-obsidianmd; our direct eslint/typescript-eslint/ import-x devDeps and eslint.config.mjs are gone Fixes for real issues oxlint surfaced that eslint missed: - main.ts imported ./store twice via different specifiers (src/store and ./store) - merged - useless {} fallbacks in loadedData spreads (main.ts) - ambiguous new Array(n) in assertFetchableUrl + TranscriptionService - unsafe optional-chain calls in main.activateView.test.ts Svelte files are excluded (parity with the old ts-only eslint globs; svelte-check owns those).
1 parent c177485 commit 13fa668

8 files changed

Lines changed: 76 additions & 695 deletions

File tree

.oxlintrc.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["typescript", "unicorn", "oxc", "import"],
4+
"jsPlugins": ["eslint-plugin-obsidianmd"],
5+
"categories": {
6+
"correctness": "error"
7+
},
8+
"env": {
9+
"browser": true,
10+
"node": true,
11+
"es2021": true
12+
},
13+
"globals": {
14+
"app": "readonly",
15+
"activeWindow": "readonly",
16+
"activeDocument": "readonly"
17+
},
18+
"ignorePatterns": ["node_modules", "build", "npm", "main.js", "**/*.svelte"],
19+
"rules": {
20+
"no-unused-vars": ["error", { "args": "none" }],
21+
"import/no-duplicates": "error",
22+
"typescript/consistent-type-imports": [
23+
"error",
24+
{
25+
"prefer": "type-imports",
26+
"disallowTypeAnnotations": false,
27+
"fixStyle": "inline-type-imports"
28+
}
29+
]
30+
},
31+
"overrides": [
32+
{
33+
"files": ["src/**/*.ts"],
34+
"excludeFiles": ["src/**/*.test.ts", "src/**/*.spec.ts"],
35+
"rules": {
36+
"obsidianmd/no-static-styles-assignment": "error",
37+
"obsidianmd/prefer-window-timers": "error",
38+
"obsidianmd/prefer-active-doc": "error",
39+
"obsidianmd/detach-leaves": "error",
40+
"obsidianmd/no-global-this": "error",
41+
"obsidianmd/settings-tab/no-manual-html-headings": "error",
42+
"obsidianmd/commands/no-plugin-name-in-command-name": "error",
43+
"no-restricted-globals": [
44+
"error",
45+
{
46+
"name": "app",
47+
"message": "Avoid the global app object. Use the reference provided by your plugin instance (this.app, or get(plugin).app for module-level code)."
48+
},
49+
{
50+
"name": "fetch",
51+
"message": "Use Obsidian's requestUrl instead of fetch for network requests."
52+
},
53+
{
54+
"name": "localStorage",
55+
"message": "Use App#saveLocalStorage / App#loadLocalStorage for vault-scoped storage instead of the global localStorage."
56+
}
57+
]
58+
}
59+
}
60+
]
61+
}

eslint.config.mjs

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)