|
| 1 | +import js from '@eslint/js'; |
| 2 | +import globals from 'globals'; |
| 3 | +import tsParser from '@typescript-eslint/parser'; |
| 4 | +import tsPlugin from '@typescript-eslint/eslint-plugin'; |
| 5 | +import reactHooks from 'eslint-plugin-react-hooks'; |
| 6 | +import reactRefresh from 'eslint-plugin-react-refresh'; |
| 7 | + |
| 8 | +const vitestGlobals = { |
| 9 | + describe: 'readonly', |
| 10 | + it: 'readonly', |
| 11 | + test: 'readonly', |
| 12 | + expect: 'readonly', |
| 13 | + vi: 'readonly', |
| 14 | + beforeEach: 'readonly', |
| 15 | + afterEach: 'readonly', |
| 16 | + beforeAll: 'readonly', |
| 17 | + afterAll: 'readonly', |
| 18 | +}; |
| 19 | + |
| 20 | +export default [ |
| 21 | + { |
| 22 | + ignores: [ |
| 23 | + '**/node_modules/**', |
| 24 | + '**/dist/**', |
| 25 | + 'dist-electron/**', |
| 26 | + '**/*.min.js', |
| 27 | + '**/*.config.js', |
| 28 | + '**/*.config.cjs', |
| 29 | + '**/*.config.mjs', |
| 30 | + 'packages/ui/playwright-report/**', |
| 31 | + 'test-results/**', |
| 32 | + 'frontend/public/**', |
| 33 | + 'main/dist/**', |
| 34 | + 'backend/**', |
| 35 | + ], |
| 36 | + }, |
| 37 | + |
| 38 | + { |
| 39 | + files: ['**/*.{js,cjs,mjs}'], |
| 40 | + ...js.configs.recommended, |
| 41 | + }, |
| 42 | + |
| 43 | + { |
| 44 | + files: ['**/*.{ts,tsx}'], |
| 45 | + languageOptions: { |
| 46 | + parser: tsParser, |
| 47 | + parserOptions: { |
| 48 | + ecmaVersion: 'latest', |
| 49 | + sourceType: 'module', |
| 50 | + ecmaFeatures: { jsx: true }, |
| 51 | + }, |
| 52 | + globals: { |
| 53 | + ...globals.browser, |
| 54 | + ...globals.node, |
| 55 | + }, |
| 56 | + }, |
| 57 | + plugins: { |
| 58 | + '@typescript-eslint': tsPlugin, |
| 59 | + }, |
| 60 | + rules: { |
| 61 | + // Prefer TypeScript's analysis for these. |
| 62 | + 'no-undef': 'off', |
| 63 | + 'no-unused-vars': 'off', |
| 64 | + |
| 65 | + // Keep TS-focused rules permissive until the codebase is cleaned up. |
| 66 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 67 | + '@typescript-eslint/no-explicit-any': 'off', |
| 68 | + '@typescript-eslint/no-unused-vars': 'off', |
| 69 | + }, |
| 70 | + }, |
| 71 | + |
| 72 | + { |
| 73 | + files: ['**/*.test.{ts,tsx}', '**/__tests__/**/*.{ts,tsx}'], |
| 74 | + languageOptions: { |
| 75 | + globals: { |
| 76 | + ...vitestGlobals, |
| 77 | + }, |
| 78 | + }, |
| 79 | + }, |
| 80 | + |
| 81 | + { |
| 82 | + files: ['packages/ui/**/*.{ts,tsx}'], |
| 83 | + plugins: { |
| 84 | + 'react-hooks': reactHooks, |
| 85 | + 'react-refresh': reactRefresh, |
| 86 | + }, |
| 87 | + rules: { |
| 88 | + ...reactHooks.configs.recommended.rules, |
| 89 | + ...reactRefresh.configs.recommended.rules, |
| 90 | + 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], |
| 91 | + }, |
| 92 | + }, |
| 93 | +]; |
0 commit comments