import js from '@eslint/js'; import { defineConfig, globalIgnores } from 'eslint/config'; import globals from 'globals'; import reactHooks from 'eslint-plugin-react-hooks'; import reactRefresh from 'eslint-plugin-react-refresh'; import tseslint from 'typescript-eslint'; // Flat config in ESLint 10's own form (defineConfig replaces the deprecated // tseslint.config). react-hooks' recommended preset includes the React // Compiler rules: pure renders, no setState straight inside an effect. export default defineConfig([ globalIgnores(['dist']), { files: ['**/*.{ts,tsx}'], extends: [js.configs.recommended, tseslint.configs.recommended, reactHooks.configs.flat.recommended], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, plugins: { 'react-refresh': reactRefresh, }, rules: { 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], }, }, ]);