Skip to content

armgit / ui

Public Imported from GitHub
0
TypeScript
1.5 KB
Raw Blame
import nextVitals from "eslint-config-next/core-web-vitals"
import reactHooks from "eslint-plugin-react-hooks"
import tseslint from "typescript-eslint"

const eslintConfig = tseslint.config(
  // Remove the @typescript-eslint plugin from next/typescript to prevent
  // duplicate registration with tseslint.configs.recommended.
  ...nextVitals.map((config) =>
    config.name === "next/typescript"
      ? { ...config, plugins: {} }
      : config.plugins?.["react-hooks"]
        ? {
            ...config,
            plugins: { ...config.plugins, "react-hooks": reactHooks },
          }
        : config
  ),
  ...tseslint.configs.recommended,
  {
    ignores: [
      "node_modules/**",
      ".next/**",
      "out/**",
      "build/**",
      "next-env.d.ts",
      ".source/**",
      "**/__index__.tsx",
    ],
  },
  {
    rules: {
      "react-hooks/incompatible-library": "off",
      "react-hooks/purity": "off",
      "react-hooks/set-state-in-effect": "off",
      "@next/next/no-html-link-for-pages": "off",
      "@next/next/no-img-element": "off",
      "@typescript-eslint/no-unused-vars": "off",
      "@typescript-eslint/consistent-type-imports": [
        "error",
        {
          prefer: "type-imports",
          fixStyle: "inline-type-imports",
        },
      ],
    },
  },
  {
    files: [
      "components/**/*.{ts,tsx}",
      "hooks/**/*.{ts,tsx}",
      "registry/**/*.{ts,tsx}",
    ],
    rules: reactHooks.configs.flat.recommended.rules,
  }
)

export default eslintConfig