import { defineConfig } from "eslint/config";
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import tseslint from "typescript-eslint";
import pluginReactHooks from "eslint-plugin-react-hooks";
import globals from "globals";
import pluginNext from "@next/eslint-plugin-next";

export default defineConfig([
	{
		ignores: ["node_modules/*", "dist/*", ".next/*", "out/*"],
	},
	{
		files: ["**/*.{js,ts,jsx,tsx}"],
		languageOptions: {
			globals: {
				...globals.browser,
				...globals.node,
			},
		},
		plugins: {
			"react-hooks": pluginReactHooks,
			"@next/next": pluginNext,
		},
		rules: {
			...pluginReactHooks.configs.recommended.rules,
			...pluginNext.configs.recommended.rules,
			"react/react-in-jsx-scope": "off",
		},
	},
	...tseslint.config(js.configs.recommended, tseslint.configs.recommended, eslintConfigPrettier),
	{
		rules: {
			"@typescript-eslint/no-unused-vars": "warn",
		},
	},
]);
