import antfu from "@antfu/eslint-config";

export default antfu({
  formatters: {
    html: false,
    css: true,
  },
  test: false,
  typescript: true,
  react: true,
  vue: false,
  markdown: false,
  stylistic: {
    semi: true,
    quotes: "double",
  },
  overrides: {
    react: {
      "react/no-comment-textnodes": "off",
      "react-hooks-extra/no-unnecessary-use-prefix": "off",
      "react-hooks-extra/prefer-use-state-lazy-initialization": "off",
      "react-hooks/exhaustive-deps": "off",
    },
    javascript: {
      "no-console": process.env.NODE_ENV === "production" ? "error" : "warn",
      "no-debugger": process.env.NODE_ENV === "production" ? "error" : "warn",
      "no-alert": process.env.NODE_ENV === "production" ? "error" : "warn",
      "no-restricted-syntax": [
        "error",
        {
          selector: "VariableDeclarator[id.name='pd']",
          message: "不允许使用 pd，请改用有语义化的变量名",
        },
        {
          selector: "ObjectExpression > Property[key.name='pd']",
          message: "不允许使用 pd，请改用有语义化的变量名",
        },
      ],
      "no-unused-vars": ["error", { varsIgnorePattern: "^React$" }],
    },
  },
  rules: {
    "antfu/top-level-function": "off",
    "node/prefer-global/process": "off",
    "dot-notation": "off",
    "linebreak-style": ["off", "windows"],
  },
});
