import {
  __commonJS,
  __toESM
} from "./chunk-JSBRDJBE.js";

// node_modules/.pnpm/eslint-plugin-react-hooks-addons@0.3.1_eslint@8.57.1/node_modules/eslint-plugin-react-hooks-addons/lib/rules/no-unused-deps.js
var require_no_unused_deps = __commonJS({
  "node_modules/.pnpm/eslint-plugin-react-hooks-addons@0.3.1_eslint@8.57.1/node_modules/eslint-plugin-react-hooks-addons/lib/rules/no-unused-deps.js"(exports, module) {
    "use strict";
    var hookNames = ["useEffect", "useLayoutEffect"];
    var matchHooks = (calleeName, {
      pattern,
      replace
    } = {}) => {
      let match = false;
      if (pattern) {
        match = new RegExp(pattern).test(calleeName);
        if (replace) return match;
      }
      return match || hookNames.includes(calleeName);
    };
    module.exports = {
      meta: {
        type: "problem",
        schema: [{
          type: "object",
          properties: {
            effectComment: {
              type: "string"
            },
            additionalHooks: {
              type: "object",
              properties: {
                pattern: {
                  type: "string"
                },
                replace: {
                  type: "boolean"
                }
              },
              required: ["pattern"],
              additionalProperties: false
            }
          },
          additionalProperties: false
        }],
        messages: {
          unused: "React Hook {{ hook }} has unused dependencies: {{ unusedDeps }}. They might cause the Hook to run unintentionally. Either exclude them or prepend /* {{ effectComment }} */ comments to make the intention explicit."
        }
      },
      create(context) {
        const {
          effectComment = "effect dep",
          additionalHooks: additionalHooks2
        } = context.options[0] || {};
        return {
          "ArrowFunctionExpression,FunctionExpression": function(node) {
            const {
              parent
            } = node;
            if (parent.type !== "CallExpression" || parent.arguments.length < 2 || parent.arguments[1].type !== "ArrayExpression" || !matchHooks(parent.callee.name, additionalHooks2)) {
              return;
            }
            const through = context.getScope().through.map((r) => r.identifier.name);
            const depArray = parent.arguments[1];
            const deps = depArray.elements.filter(({
              type
            }) => type === "Identifier");
            const unusedDeps = [];
            for (const dep of deps) {
              if (through.includes(dep.name)) continue;
              if (context.getSourceCode().getCommentsBefore(dep).some(({
                value
              }) => value.includes(effectComment))) {
                continue;
              }
              unusedDeps.push(dep.name);
            }
            if (unusedDeps.length > 0) {
              context.report({
                node: depArray,
                messageId: "unused",
                data: {
                  hook: parent.callee.name,
                  unusedDeps: unusedDeps.map((dep) => `'${dep}'`).join(", "),
                  effectComment
                }
              });
            }
          }
        };
      }
    };
  }
});

// node_modules/.pnpm/eslint-plugin-react-hooks-addons@0.3.1_eslint@8.57.1/node_modules/eslint-plugin-react-hooks-addons/lib/index.js
var require_lib = __commonJS({
  "node_modules/.pnpm/eslint-plugin-react-hooks-addons@0.3.1_eslint@8.57.1/node_modules/eslint-plugin-react-hooks-addons/lib/index.js"(exports, module) {
    "use strict";
    module.exports = {
      rules: {
        "no-unused-deps": require_no_unused_deps()
      }
    };
  }
});

// node_modules/.pnpm/@eslint+compat@1.4.1_eslint@8.57.1/node_modules/@eslint/compat/dist/esm/index.js
import fs from "fs";
import path from "path";
var removedMethodNames = /* @__PURE__ */ new Map([
  ["getSource", "getText"],
  ["getSourceLines", "getLines"],
  ["getAllComments", "getAllComments"],
  ["getDeclaredVariables", "getDeclaredVariables"],
  ["getNodeByRangeIndex", "getNodeByRangeIndex"],
  ["getCommentsBefore", "getCommentsBefore"],
  ["getCommentsAfter", "getCommentsAfter"],
  ["getCommentsInside", "getCommentsInside"],
  ["getJSDocComment", "getJSDocComment"],
  ["getFirstToken", "getFirstToken"],
  ["getFirstTokens", "getFirstTokens"],
  ["getLastToken", "getLastToken"],
  ["getLastTokens", "getLastTokens"],
  ["getTokenAfter", "getTokenAfter"],
  ["getTokenBefore", "getTokenBefore"],
  ["getTokenByRangeStart", "getTokenByRangeStart"],
  ["getTokens", "getTokens"],
  ["getTokensAfter", "getTokensAfter"],
  ["getTokensBefore", "getTokensBefore"],
  ["getTokensBetween", "getTokensBetween"]
]);
var fixedUpRuleReplacements = /* @__PURE__ */ new WeakMap();
var fixedUpRules = /* @__PURE__ */ new WeakSet();
var fixedUpPluginReplacements = /* @__PURE__ */ new WeakMap();
var fixedUpPlugins = /* @__PURE__ */ new WeakSet();
function fixupRule(ruleDefinition) {
  if (fixedUpRuleReplacements.has(ruleDefinition)) {
    return fixedUpRuleReplacements.get(ruleDefinition);
  }
  const isLegacyRule = typeof ruleDefinition === "function";
  if (!isLegacyRule && fixedUpRules.has(ruleDefinition)) {
    return ruleDefinition;
  }
  const originalCreate = isLegacyRule ? ruleDefinition : ruleDefinition.create.bind(ruleDefinition);
  function ruleCreate(context) {
    if ("getScope" in context) {
      return originalCreate(context);
    }
    const sourceCode = context.sourceCode;
    let currentNode = sourceCode.ast;
    const newContext = Object.assign(Object.create(context), {
      parserServices: sourceCode.parserServices,
      /*
       * The following methods rely on the current node in the traversal,
       * so we need to add them manually.
       */
      getScope() {
        return sourceCode.getScope(currentNode);
      },
      getAncestors() {
        return sourceCode.getAncestors(currentNode);
      },
      markVariableAsUsed(variable) {
        sourceCode.markVariableAsUsed(variable, currentNode);
      }
    });
    for (const [
      contextMethodName,
      sourceCodeMethodName
    ] of removedMethodNames) {
      newContext[contextMethodName] = sourceCode[sourceCodeMethodName].bind(sourceCode);
    }
    Object.freeze(newContext);
    const visitor = originalCreate(newContext);
    for (const [methodName, method] of Object.entries(visitor)) {
      if (methodName.startsWith("on")) {
        visitor[methodName] = (...args) => {
          currentNode = args[methodName === "onCodePathSegmentLoop" ? 2 : 1];
          return method.call(visitor, ...args);
        };
        continue;
      }
      visitor[methodName] = (...args) => {
        currentNode = args[0];
        return method.call(visitor, ...args);
      };
    }
    return visitor;
  }
  const newRuleDefinition = {
    ...isLegacyRule ? void 0 : ruleDefinition,
    create: ruleCreate
  };
  const { schema } = ruleDefinition;
  if (schema) {
    if (!newRuleDefinition.meta) {
      newRuleDefinition.meta = { schema };
    } else {
      newRuleDefinition.meta = {
        ...newRuleDefinition.meta,
        // top-level `schema` had precedence over `meta.schema` so it's okay to overwrite `meta.schema` if it exists
        schema
      };
    }
  }
  fixedUpRuleReplacements.set(ruleDefinition, newRuleDefinition);
  fixedUpRules.add(newRuleDefinition);
  return newRuleDefinition;
}
function fixupPluginRules(plugin) {
  if (fixedUpPluginReplacements.has(plugin)) {
    return fixedUpPluginReplacements.get(plugin);
  }
  if (fixedUpPlugins.has(plugin) || !plugin.rules) {
    return plugin;
  }
  const newPlugin = {
    ...plugin,
    rules: Object.fromEntries(
      Object.entries(plugin.rules).map(([ruleId, ruleDefinition]) => [
        ruleId,
        fixupRule(ruleDefinition)
      ])
    )
  };
  fixedUpPluginReplacements.set(plugin, newPlugin);
  fixedUpPlugins.add(newPlugin);
  return newPlugin;
}

// src/eslint.ts
var import_eslint_plugin_react_hooks_addons = __toESM(require_lib(), 1);

// scripts/hooks-with-deps.json
var hooks_with_deps_default = [
  "useAsyncEffect",
  "useThreeEffect",
  "useThreeObject",
  "useLoadingEffect",
  "useLoadingMemo"
];

// src/eslint.ts
var additionalHooks = `(${hooks_with_deps_default.join("|")})`;
var config = {
  plugins: {
    // @eslint/compat returns the @eslint/core Plugin type; @types/eslint's
    // Plugin is a slightly older shape. Identical at runtime.
    "react-hooks-addons": fixupPluginRules(import_eslint_plugin_react_hooks_addons.default)
  },
  rules: {
    "react-hooks/exhaustive-deps": [
      "warn",
      {
        additionalHooks
      }
    ],
    "react-hooks-addons/no-unused-deps": [
      "warn",
      {
        additionalHooks: {
          pattern: additionalHooks
        }
      }
    ]
  }
};
var eslint_default = config;
export {
  config as configs,
  eslint_default as default
};
