/ 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          Element: 'readonly',
25          navigator: 'readonly',
26          setTimeout: 'readonly',
27          fetch: 'readonly',
28          MutationObserver: 'readonly',
29          MutationRecord: 'readonly',
30          performance: 'readonly',
31          require: 'readonly'
32        }
33      },
34      plugins: {
35        '@typescript-eslint': tseslint
36      },
37      rules: {
38        '@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }],
39        // Disabled: Epic 7 requires `any` for undocumented Obsidian internal APIs
40        // (commands.executeCommandById, vault.adapter.basePath, workspace internals, etc.)
41        '@typescript-eslint/no-explicit-any': 'off',
42        '@typescript-eslint/explicit-function-return-type': 'off',
43        'no-unused-vars': 'off' // Disable base rule as it can report incorrect errors
44      }
45    },
46    {
47      files: ['src/**/*.test.ts', 'src/**/*.test.tsx', 'src/dev/*.tsx', 'src/mocks/*.ts'],
48      languageOptions: {
49        globals: {
50          document: 'readonly',
51          window: 'readonly',
52          HTMLElement: 'readonly'
53        }
54      }
55    },
56    {
57      files: ['src/commands/dreamweaving-commands.ts', 'src/services/submodule-manager-service.ts'],
58      languageOptions: {
59        globals: {
60          require: 'readonly'
61        }
62      }
63    },
64    {
65      ignores: [
66        'main.js',
67        'node_modules/',
68        '*.d.ts',
69        'src/features/realtime-transcription/scripts/venv/**',
70        'src/features/github-sharing/viewer-bundle/**',
71        'dist/**'
72      ]
73    }
74  ];