import js from '@eslint/js' import globals from 'globals' import reactHooks from 'eslint-plugin-react-hooks' import reactRefresh from 'eslint-plugin-react-refresh' import tseslint from 'typescript-eslint' import { defineConfig, globalIgnores } from 'eslint/config' export default defineConfig([ globalIgnores(['dist', 'src/sw.ts']), { files: ['**/*.{ts,tsx}'], extends: [ js.configs.recommended, tseslint.configs.recommended, reactHooks.configs['recommended-latest'], reactRefresh.configs.vite, ], languageOptions: { ecmaVersion: 2020, globals: globals.browser, parserOptions: { projectService: { defaultProject: "./tsconfig.app.json" }, }, }, rules: { 'no-console': ['warn', { allow: ['warn', 'error'] }], 'react-hooks/exhaustive-deps': 'warn', }, }, { files: ['src/components/ui/**/*.{ts,tsx}', 'src/components/message/FileToolRender.tsx'], rules: { 'react-refresh/only-export-components': 'off', }, }, // Special rules for PromptInput { files: ['src/components/message/PromptInput.tsx'], rules: { 'no-empty': 'off', } }, // Special rules for test files { files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx', 'vitest.config.ts'], languageOptions: { parserOptions: { tsconfigRootDir: import.meta.dirname, projectService: false }, globals: globals.node, }, rules: { '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }], 'no-empty': 'off', } }, ])