/* eslint-env node */
require("@typescript-eslint/eslint-recommended");
require("@typescript-eslint/parser");
require("eslint-plugin-solid");

module.exports = {
  root: true,
  parser: "@typescript-eslint/parser",
  plugins: ["solid"],
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:solid/recommended",
  ],
  overrides: [
    {
      files: ["**/*.tsx"],
      parserOptions: {
        ecmaFeatures: {
          jsx: true,
        },
      },
      settings: {
        solid: {
          noImportReact: true,
        },
      },
      rules: {
        "solid/hyperscript": "off",
        "solid/jsx-no-undef": "error",
        "solid/jsx-pseudo-element": "error",
        "solid/jsx-single-root-elem": "error",
        "solid/no-dynamic-mount": "error",
        "solid/no-hyphen-in-props": "error",
        "solid/no-leaked-event-handlers": "error",
        "solid/no-react-unknown-property": "error",
        "solid/no-unknown-property": "error",
        "solid/no-useless-fragment": "error",
        "solid/prefer-classlist": "error",
        "solid/prefer-destructuring": "warn",
        "solid/prefer-innerhtml": "warn",
      },
    },
  ],
  rules: {
    "@typescript-eslint/explicit-function-return-type": "off",
    "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
    "@typescript-eslint/no-explicit-any": "warn",
    "arrow-body-style": ["warn", "as-needed"],
    curly: ["error", "multi-line"],
    "no-console": "off",
    "no-debugger": "warn",
    "no-unused-vars": "off",
    "prefer-const": "error",
  },
  env: {
    browser: true,
  },
  ignorePatterns: [
    "dist",
    ".output",
    "node_modules",
    "coverage",
    "test-results",
    "playwright-report",
  ],
};
