I started a new project using Vite, with React and TypeScript. I’ve set up my ESLint configuration in eslint.config.js as follows:
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh'; // Make sure to import all plugins
export default [
{
ignores: ['dist'],
overrides: [
{
extends: [
js.configs.recommended,
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'prettier', // `eslint-config-prettier` is usually just referred to as `prettier`
],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2021,
globals: globals.browser,
},
plugins: ['react-hooks', 'react-refresh'], // Ensure all plugins are listed here
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
],
},
];
However, I’m encountering the following error in my file:
ConfigError: Config (unnamed): Key “overrides”: This appears to be in eslintrc format rather than flat config format.
Could someone help me understand why this is happening? It seems like my ESLint config is using an outdated format, but I’m not sure how to resolve this.
I’d greatly appreciate any guidance on fixing this issue!