Having troubles migrating eslintrc.js to eslint.config.js

I need some help to solve this issue

We have eslintrc.js file :

module.exports = {

  "env": {
    "browser": true,
    "es6": true,
    "node": true,
    "amd": true
  },
  "settings": {
    "react": {
      "version": "detect"
    }
  },
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended"
  ],
  "parser": "@babel/eslint-parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "plugins": [
    "react"
  ],
  "rules": {
    "array-bracket-spacing": ["error", "never"],
    "comma-style": ["error"],
    "arrow-spacing": [
      "error",
      {
        "after": true,
        "before": true
      }
    ],
    "block-scoped-var": "error",
    "block-spacing": "error",
    "brace-style": [
      "error",
      "1tbs"
    ],
    "jsx-quotes": ["error", "prefer-double"],
    "keyword-spacing": "error",
    "key-spacing": ["error", {
      "beforeColon": false,
      "afterColon": true,
    }],
    "no-unused-vars": [
      "warn",
      {
        "varsIgnorePattern": "React"
      }
    ],
    "no-trailing-spaces": "error",
    "object-curly-spacing": ["error", "always"],
    "react/display-name": 0,
    "react/prop-types": 0,
    "react/no-unescaped-entities": [0],
    "react/jsx-no-duplicate-props": [0],
    "indent": [
      "error", 2, {
        "FunctionExpression": { "parameters": "first" },
        "FunctionDeclaration": { "parameters": "first" },
        "MemberExpression": 1,
        "SwitchCase": 1,
        "outerIIFEBody": 0,
        "VariableDeclarator": { "var": 2, "let": 2, "const": 3 },
        ignoredNodes: ["TemplateLiteral"]
      }
    ],
    "linebreak-style": [
      "error",
      "unix"
    ],
    "quotes": [
      "error",
      "double"
    ],
    "semi": [
      "error",
      "always"
    ],
    "strict": 0,
    "valid-typeof": 0,
    "space-unary-ops": [
      1, {
        "words": true,
        "nonwords": false
      }
    ],
    "space-infix-ops": [
      "error"
    ]
  }
};

I have changed it to the eslint.config.js file:

const js = require("@eslint/js");
const globals = require("globals");
const react = require("eslint-plugin-react");
const babelParser = require("@babel/eslint-parser");

module.exports = [
  {
    ignores: [
      "node_modules/",
      "**/*.test.js",
      "src/utils/",
      ".cache/",
      ".github/",
      "assets/",
      "public/",
      ".babelrc",
      ".env.development",
      "CNAME",
      "CODE_OF_CONDUCT.md",
      "CODEOWNERS",
      "font-preload-cache.json",
      "LICENSE",
      "Makefile",
      "README.md",
      "package.json",
      "package-lock.json",
      "static/"
    ]
  },
  js.configs.recommended,
  {
    files: ["**/*.{js,jsx,mjs,cjs}"],
    plugins: {
      react
    },
    languageOptions: {
      parser: babelParser,
      ecmaVersion: 2018,
      sourceType: "module",
      parserOptions: {
        ecmaFeatures: {
          jsx: true
        }
      },
      globals: {
        ...globals.browser,
        ...globals.es6,
        ...globals.node,
        ...globals.amd
      }
    },
    settings: {
      react: {
        version: "detect"
      }
    },
    rules: {
      ...react.configs.recommended.rules,

      "array-bracket-spacing": ["error", "never"],
      "object-curly-spacing": ["error", "always"],

      "comma-style": ["error"],
      "arrow-spacing": [
        "error",
        {
          "after": true,
          "before": true
        }
      ],

      "block-scoped-var": "error",
      "block-spacing": "error",
      "brace-style": [
        "error",
        "1tbs"
      ],

      "jsx-quotes": ["error", "prefer-double"],
      "quotes": [
        "error",
        "double"
      ],

      "keyword-spacing": "error",
      "key-spacing": ["error", {
        "beforeColon": false,
        "afterColon": true
      }],
      "space-unary-ops": [
        1, {
          "words": true,
          "nonwords": false
        }
      ],
      "space-infix-ops": ["error"],
      "no-trailing-spaces": "error",

      "no-unused-vars": [
        "warn",
        {
          "varsIgnorePattern": "React"
        }
      ],

      "indent": [
        "error", 2, {
          "FunctionExpression": { "parameters": "first" },
          "FunctionDeclaration": { "parameters": "first" },
          "MemberExpression": 1,
          "SwitchCase": 1,
          "outerIIFEBody": 0,
          "VariableDeclarator": { "var": 2, "let": 2, "const": 3 },
          "ignoredNodes": ["TemplateLiteral"]
        }
      ],

      "linebreak-style": [
        "error",
        "unix"
      ],
      "semi": [
        "error",
        "always"
      ],

      "strict": 0,
      "valid-typeof": 0,

      "react/display-name": 0,
      "react/prop-types": 0,
      "react/no-unescaped-entities": [0],
      "react/jsx-no-duplicate-props": [0]
    }
  }
];

Now, I am facing this problem:

Failed to load plugin 'flowtype' declared in 'BaseConfig » /Users/madinaamankeldinova/Desktop/Linux
Foundation /layer5/layer5/node_modules/eslint-config-react-app/index.js': Package subpath
'./lib/rules/no-unused-expressions' is not defined by "exports" in
/Users/madinaamankeldinova/Desktop/Linux Foundation /layer5/layer5/node_modules/eslint/package.json
failed Building development bundle - 58.375s
ERROR in Failed to load plugin 'flowtype' declared in 'BaseConfig »
/Users/madinaamankeldinova/Desktop/Linux Foundation
/layer5/layer5/node_modules/eslint-config-react-app/index.js': Package subpath
'./lib/rules/no-unused-expressions' is not defined by "exports" in
/Users/madinaamankeldinova/Desktop/Linux Foundation /layer5/layer5/node_modules/eslint/package.json
develop compiled with 1 error

I have tried to do delete node_modules and package-lock.json files, clear cache and install dependencies again. It did not help.

After that I found this and tried to add empty eslintrc.js and this error was not appearing when I run gatsby develop, but it gives this error:


 ERROR #98123  WEBPACK.BUILD-JAVASCRIPT

Generating JavaScript bundles failed

[eslint] Couldn't find FlatESLint, you might need to set eslintPath to 'eslint/use-at-your-own-risk'

File: node_modules/swiper/swiper.css

when I run gatsby build

I would be glad to receive any suggestions and advice from you!