import reactPlugin from "@eslint-react/eslint-plugin" import nextPlugin from "@next/eslint-plugin-next" import tsPlugin from "@typescript-eslint/eslint-plugin" import tsParser from "@typescript-eslint/parser" import reactHooks from "eslint-plugin-react-hooks" const config = [ { ignores: [ ".next/**", "out/**", "build/**", "next-env.d.ts", "src/shared/ui/chart.tsx", "src/shared/hooks/theme-message-listener.tsx", ], }, { files: ["**/*.{js,jsx,mjs,ts,tsx,mts,cts}"], ...nextPlugin.configs["core-web-vitals"], }, ...tsPlugin.configs["flat/recommended"], { files: ["**/*.{ts,tsx}"], languageOptions: { parser: tsParser, parserOptions: { ecmaVersion: "latest", sourceType: "module", ecmaFeatures: { jsx: true, }, project: "./tsconfig.json", tsconfigRootDir: import.meta.dirname, }, }, }, { files: ["**/*.{jsx,tsx}"], name: "@eslint-react/recommended", plugins: { "@eslint-react": reactPlugin, }, rules: reactPlugin.configs.recommended.rules, }, { files: ["**/*.{ts,tsx}"], plugins: { "react-hooks": reactHooks, }, rules: { ...reactHooks.configs.flat["recommended-latest"].rules, "@typescript-eslint/no-explicit-any": "error", "@typescript-eslint/no-unused-vars": [ "error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_", }, ], "@typescript-eslint/no-unsafe-assignment": "error", "@typescript-eslint/no-unsafe-member-access": "error", "@typescript-eslint/no-unsafe-call": "error", "@typescript-eslint/no-unsafe-return": "error", "@typescript-eslint/no-unsafe-argument": "error", "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-floating-promises": "error", "@typescript-eslint/no-misused-promises": "error", "@typescript-eslint/await-thenable": "error", "@typescript-eslint/no-unnecessary-type-assertion": "error", "@typescript-eslint/no-non-null-assertion": "warn", "@typescript-eslint/prefer-nullish-coalescing": "warn", "@typescript-eslint/prefer-optional-chain": "warn", "@typescript-eslint/no-unnecessary-condition": "off", "@typescript-eslint/no-redundant-type-constituents": "error", "@typescript-eslint/ban-ts-comment": [ "off", { "ts-expect-error": "allow-with-description", "ts-ignore": true, "ts-nocheck": true, "ts-check": false, }, ], "no-unused-vars": "off", "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "warn", "no-console": ["warn", { allow: ["warn", "error", "log"] }], "no-debugger": "error", "no-alert": "warn", "no-var": "error", "prefer-const": "error", "prefer-arrow-callback": "warn", "no-duplicate-imports": "error", "no-unreachable": "error", "no-unused-expressions": "error", "no-useless-return": "error", "no-useless-escape": "error", "no-constant-condition": "error", "no-empty": "warn", "no-extra-semi": "error", "no-func-assign": "error", "no-inner-declarations": "error", "no-irregular-whitespace": "error", "no-obj-calls": "error", "no-sparse-arrays": "error", "no-undef": "off", "no-unexpected-multiline": "error", "no-unreachable-loop": "error", "use-isnan": "error", "valid-typeof": "error", "@next/next/no-html-link-for-pages": "error", "@next/next/no-img-element": "warn", }, }, { files: ["**/*.{jsx,tsx}"], rules: { "@eslint-react/no-missing-component-display-name": "warn", "@eslint-react/dom-no-unknown-property": "error", "@eslint-react/no-missing-key": "error", "@eslint-react/no-duplicate-key": "error", "@eslint-react/no-array-index-key": "off", "@eslint-react/dom-no-dangerously-set-innerhtml": "off", "@eslint-react/no-direct-mutation-state": "error", "@eslint-react/no-nested-component-definitions": "off", "@eslint-react/no-use-context": "off", "@eslint-react/no-context-provider": "off", "@eslint-react/use-state": "off", }, }, ] export default config