import js from '@eslint/js'; import globals from 'globals'; import reactPlugin from 'eslint-plugin-react'; import reactHooksPlugin from 'eslint-plugin-react-hooks'; import reactRefreshPlugin from 'eslint-plugin-react-refresh'; export default [ { ignores: [ '**/node_modules/**', '**/dist/**', '**/.vite/**', '**/coverage/**', '**/*.min.*', ], }, // Base JS rules js.configs.recommended, { rules: { 'no-empty': ['error', { allowEmptyCatch: true }], 'no-unused-vars': [ 'error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', }, ], }, }, // Node (server/build) files { files: ['**/*.js', '**/*.mjs'], languageOptions: { ecmaVersion: 'latest', sourceType: 'module', globals: { ...globals.node, }, }, rules: { // This repo uses `console.log` for boot logs. 'no-console': 'off', }, }, // Browser + React files { files: ['src/**/*.{js,jsx}'], languageOptions: { ecmaVersion: 'latest', sourceType: 'module', parserOptions: { ecmaFeatures: { jsx: true }, }, globals: { ...globals.browser, }, }, plugins: { react: reactPlugin, 'react-hooks': reactHooksPlugin, 'react-refresh': reactRefreshPlugin, }, settings: { react: { version: 'detect' }, }, rules: { ...reactPlugin.configs.recommended.rules, ...reactHooksPlugin.configs.recommended.rules, 'react/react-in-jsx-scope': 'off', 'react/prop-types': 'off', 'react-refresh/only-export-components': [ 'warn', { allowConstantExport: true }, ], }, }, ];