|
| 1 | +// eslint.config.mjs |
| 2 | +import tsparser from "@typescript-eslint/parser"; |
| 3 | +import { defineConfig } from "eslint/config"; |
| 4 | +import obsidianmd from "eslint-plugin-obsidianmd"; |
| 5 | +import globals from "globals"; |
| 6 | + |
| 7 | +export default defineConfig([ |
| 8 | + { |
| 9 | + ignores: ["node_modules/**", "main.js", "*.mjs"], |
| 10 | + }, |
| 11 | + ...obsidianmd.configs.recommended, |
| 12 | + { |
| 13 | + // Disable dependency ban for package.json - builtin-modules is part of standard Obsidian template |
| 14 | + files: ["package.json"], |
| 15 | + rules: { |
| 16 | + "depend/ban-dependencies": "off", |
| 17 | + }, |
| 18 | + }, |
| 19 | + { |
| 20 | + files: ["**/*.ts"], |
| 21 | + languageOptions: { |
| 22 | + parser: tsparser, |
| 23 | + parserOptions: { project: "./tsconfig.json" }, |
| 24 | + globals: { |
| 25 | + ...globals.browser, |
| 26 | + }, |
| 27 | + }, |
| 28 | + |
| 29 | + rules: { |
| 30 | + // ============================================ |
| 31 | + // DISABLED - Would require major refactoring |
| 32 | + // ============================================ |
| 33 | + |
| 34 | + // // Floating promises - very common in Obsidian plugins with event handlers |
| 35 | + // "@typescript-eslint/no-floating-promises": "off", |
| 36 | + |
| 37 | + // // Misused promises in callbacks - common pattern in Obsidian |
| 38 | + // "@typescript-eslint/no-misused-promises": "off", |
| 39 | + |
| 40 | + // // Unsafe any usage - would require extensive type fixes |
| 41 | + // "@typescript-eslint/no-unsafe-assignment": "off", |
| 42 | + // "@typescript-eslint/no-unsafe-member-access": "off", |
| 43 | + // "@typescript-eslint/no-unsafe-call": "off", |
| 44 | + // "@typescript-eslint/no-unsafe-argument": "off", |
| 45 | + // "@typescript-eslint/no-unsafe-return": "off", |
| 46 | + |
| 47 | + // // Unnecessary type assertions - minor issue |
| 48 | + // "@typescript-eslint/no-unnecessary-type-assertion": "off", |
| 49 | + |
| 50 | + // // Restrict template expressions - minor issue |
| 51 | + // "@typescript-eslint/restrict-template-expressions": "off", |
| 52 | + |
| 53 | + // // Await non-promise - can be intentional |
| 54 | + // "@typescript-eslint/await-thenable": "off", |
| 55 | + |
| 56 | + // // Unbound method - too strict for Obsidian patterns |
| 57 | + // "@typescript-eslint/unbound-method": "off", |
| 58 | + |
| 59 | + // // Base to string - minor issue |
| 60 | + // "@typescript-eslint/no-base-to-string": "off", |
| 61 | + |
| 62 | + // // ============================================ |
| 63 | + // // WARNINGS - Good to fix but not blocking |
| 64 | + // // ============================================ |
| 65 | + |
| 66 | + // // Unused variables - prefix with _ to ignore |
| 67 | + // "@typescript-eslint/no-unused-vars": ["warn", { |
| 68 | + // "argsIgnorePattern": "^_", |
| 69 | + // "varsIgnorePattern": "^_", |
| 70 | + // "caughtErrorsIgnorePattern": "^_" |
| 71 | + // }], |
| 72 | + |
| 73 | + // // Unused expressions |
| 74 | + // "@typescript-eslint/no-unused-expressions": "warn", |
| 75 | + |
| 76 | + // // Empty blocks (empty catch statements) |
| 77 | + // "no-empty": ["warn", { "allowEmptyCatch": true }], |
| 78 | + |
| 79 | + // // Case declarations - should wrap in blocks |
| 80 | + // "no-case-declarations": "warn", |
| 81 | + |
| 82 | + // // Useless escapes in regex |
| 83 | + // "no-useless-escape": "warn", |
| 84 | + |
| 85 | + // // ============================================ |
| 86 | + // // OBSIDIAN-SPECIFIC RULES - Keep as warnings |
| 87 | + // // ============================================ |
| 88 | + |
| 89 | + // // UI sentence case - good practice but not critical |
| 90 | + // "obsidianmd/ui/sentence-case": "warn", |
| 91 | + |
| 92 | + // // Settings headings - good practice |
| 93 | + // "obsidianmd/settings-tab/no-manual-html-headings": "warn", |
| 94 | + |
| 95 | + // // Static styles - good practice |
| 96 | + // "obsidianmd/no-static-styles-assignment": "warn", |
| 97 | + |
| 98 | + // // Platform detection - good practice |
| 99 | + // "obsidianmd/platform": "warn", |
| 100 | + |
| 101 | + // // File manager trash - good practice |
| 102 | + // "obsidianmd/prefer-file-manager-trash-file": "warn", |
| 103 | + |
| 104 | + // // Dependency warnings - builtin-modules is part of standard Obsidian template |
| 105 | + // "depend/ban-dependencies": "off", |
| 106 | + }, |
| 107 | + }, |
| 108 | +]); |
0 commit comments