import js from '@eslint/js'; import globals from 'globals'; import reactHooks from 'eslint-plugin-react-hooks'; import reactRefresh from 'eslint-plugin-react-refresh'; import tsPlugin from '@typescript-eslint/eslint-plugin'; import tsParser from '@typescript-eslint/parser'; import { defineConfig } from 'eslint/config'; // Combine recommended rules from providers into a single flat rules object. // Filter out prettier rule so eslint-plugin-prettier (which expects Prettier v2 API) // is not invoked by ESLint. const combinedRules = (() => { const a = js?.configs?.recommended?.rules || {}; const b = tsPlugin?.configs?.recommended?.rules || {}; const merged = { ...a, ...b }; // ensure we don't reference the prettier rule delete merged['prettier/prettier']; // add react-hooks recommended rules explicitly merged['react-hooks/rules-of-hooks'] = merged['react-hooks/rules-of-hooks'] || 'error'; merged['react-hooks/exhaustive-deps'] = merged['react-hooks/exhaustive-deps'] || 'warn'; return merged; })(); export default defineConfig({ ignores: ['dist'], files: ['**/*.{ts,tsx}'], languageOptions: { parser: tsParser, parserOptions: { ecmaVersion: 2020, sourceType: 'module', project: ['./tsconfig.app.json', './tsconfig.node.json'], }, globals: globals.browser, }, plugins: { 'react-hooks': reactHooks, '@typescript-eslint': tsPlugin, 'react-refresh': reactRefresh, }, // Avoid using `extends` to prevent nested-extends errors from shareable configs rules: combinedRules, });