import { defineConfig, globalIgnores } from "eslint/config"; import typescriptEslint from "@typescript-eslint/eslint-plugin"; import reactHooks from "eslint-plugin-react-hooks"; import prettier from "eslint-plugin-prettier"; import { fixupPluginRules } from "@eslint/compat"; import globals from "globals"; import tsParser from "@typescript-eslint/parser"; import path from "node:path"; import { fileURLToPath } from "node:url"; import js from "@eslint/js"; import { FlatCompat } from "@eslint/eslintrc"; import pluginCypress from "eslint-plugin-cypress"; import reactPlugin from "@eslint-react/eslint-plugin"; const compat = new FlatCompat({ baseDirectory: path.dirname(fileURLToPath(import.meta.url)), recommendedConfig: js.configs.recommended, allConfig: js.configs.all, }); export default defineConfig([ globalIgnores([ "node_modules/**", "dist/**", "coverage/**", "doc/**", "tests/ipalab/_venv", "eslint.config.mjs", ]), pluginCypress.configs.recommended, reactPlugin.configs.recommended, { extends: compat.extends( "eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended" ), plugins: { "@typescript-eslint": typescriptEslint, "react-hooks": fixupPluginRules(reactHooks), prettier, }, languageOptions: { globals: { ...globals.browser, ...globals.node, }, parser: tsParser, ecmaVersion: 5, sourceType: "commonjs", parserOptions: { tsx: true, jsx: true, js: true, useJSXTextNode: true, project: ["./tsconfig.json"], }, }, settings: { react: { version: "detect", }, }, rules: { "prettier/prettier": "error", "cypress/no-unnecessary-waiting": "error", // Temporarily set as warn, so we can refactor when needed "@eslint-react/no-nested-component-definitions": "warn", }, }, ]);