/ eslint.config.mjs
eslint.config.mjs
 1  import eslint from '@eslint/js';
 2  import tseslint from '@typescript-eslint/eslint-plugin';
 3  import tsparser from '@typescript-eslint/parser';
 4  
 5  export default [
 6    eslint.configs.recommended,
 7    {
 8      files: ['src/**/*.ts', 'src/**/*.tsx'],
 9      languageOptions: {
10        parser: tsparser,
11        parserOptions: {
12          ecmaVersion: 2020,
13          sourceType: 'module',
14          ecmaFeatures: {
15            jsx: true
16          }
17        },
18        globals: {
19          console: 'readonly',
20          global: 'readonly',
21          window: 'readonly',
22          document: 'readonly',
23          HTMLElement: 'readonly',
24          HTMLDivElement: 'readonly',
25          HTMLInputElement: 'readonly',
26          SVGSVGElement: 'readonly',
27          Element: 'readonly',
28          navigator: 'readonly',
29          setTimeout: 'readonly',
30          setInterval: 'readonly',
31          clearInterval: 'readonly',
32          requestAnimationFrame: 'readonly',
33          cancelAnimationFrame: 'readonly',
34          fetch: 'readonly',
35          Audio: 'readonly',
36          HTMLAudioElement: 'readonly',
37          MutationObserver: 'readonly',
38          MutationRecord: 'readonly',
39          performance: 'readonly',
40          require: 'readonly',
41          indexedDB: 'readonly',
42          IDBDatabase: 'readonly',
43          IDBOpenDBRequest: 'readonly',
44          TextDecoder: 'readonly',
45          DOMException: 'readonly',
46          AbortSignal: 'readonly',
47          AbortController: 'readonly',
48          ResizeObserver: 'readonly',
49          clearTimeout: 'readonly',
50          HTMLIFrameElement: 'readonly',
51          MessageEvent: 'readonly',
52          Blob: 'readonly',
53          URL: 'readonly',
54          Buffer: 'readonly'
55        }
56      },
57      plugins: {
58        '@typescript-eslint': tseslint
59      },
60      rules: {
61        '@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_', 'varsIgnorePattern': '^_', 'caughtErrorsIgnorePattern': '^_' }],
62        // Disabled: Epic 7 requires `any` for undocumented Obsidian internal APIs
63        // (commands.executeCommandById, vault.adapter.basePath, workspace internals, etc.)
64        '@typescript-eslint/no-explicit-any': 'off',
65        '@typescript-eslint/explicit-function-return-type': 'off',
66        'no-unused-vars': 'off' // Disable base rule as it can report incorrect errors
67      }
68    },
69    {
70      files: ['src/**/*.test.ts', 'src/**/*.test.tsx', 'src/dev/*.tsx', 'src/mocks/*.ts'],
71      languageOptions: {
72        globals: {
73          document: 'readonly',
74          window: 'readonly',
75          HTMLElement: 'readonly'
76        }
77      }
78    },
79    {
80      files: ['src/commands/dreamweaving-commands.ts', 'src/services/submodule-manager-service.ts'],
81      languageOptions: {
82        globals: {
83          require: 'readonly'
84        }
85      }
86    },
87    {
88      ignores: [
89        'main.js',
90        'node_modules/',
91        '*.d.ts',
92        'src/features/realtime-transcription/scripts/venv/**',
93        'src/features/github-sharing/viewer-bundle/**',
94        'src/features/github-publishing/viewer-bundle/**',
95        'src/features/dreamnode/DreamNode-template/**',
96        'dist/**'
97      ]
98    }
99  ];