@skapxd/eslint-opinionated 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -316,6 +316,35 @@ la excepción original), y ningún error queda sin manejar (el `.exhaustive()`
316
316
  de ts-pattern no compila si falta una variante). Legibilidad y manejo de
317
317
  errores dejan de depender de la disciplina del autor — humano o agente.
318
318
 
319
+ ### El suelo del sistema: el trace global
320
+
321
+ Toda cadena de errores necesita exactamente **un punto de aterrizaje** — el
322
+ módulo donde la inducción termina. Si el volcadero de errores reportara sus
323
+ propios fallos al volcadero, tendrías recursión infinita; la solución (la
324
+ misma que usa el SDK de Sentry) es que el fallback del suelo sea síncrono e
325
+ infalible — console o un buffer local — nunca el propio suelo:
326
+
327
+ ```ts
328
+ // trace-global.ts — el ÚNICO punto donde la cadena aterriza
329
+ export async function reportDomainError(error: DomainError): Promise<void> {
330
+ const sent = await trySafe(() => sendToTelemetry(error));
331
+
332
+ if (!sent.ok) {
333
+ // El pararrayos: console recibe AMBOS errores completos. No hay
334
+ // recursión: console es síncrono, no retorna Result y no falla.
335
+ console.error("telemetry_failed", { cause: sent.error, dropped: error });
336
+ }
337
+ }
338
+ ```
339
+
340
+ Fíjate que este módulo **pasa todas las reglas sin exenciones**: el `await`
341
+ resuelve en Result, y `console.error` recibiendo el error completo es una
342
+ entrega válida para `result-error-requires-handling`. Reglas prácticas para
343
+ el suelo: una sola función pública, sin reintentos hacia sí mismo (si quieres
344
+ resiliencia: buffer local + `navigator.sendBeacon` al cerrar), y si tu setup
345
+ tiene `no-console`, la exención por archivo para *este único módulo* es
346
+ legítima y auditable — es la definición misma del suelo.
347
+
319
348
  ## Estructura del paquete
320
349
 
321
350
  ```text
@@ -759,6 +788,31 @@ if (!result.ok) {
759
788
  }
760
789
  ```
761
790
 
791
+ **Proyectar no es manejar** (desde v0.13.0). Leer `result.error.message` para
792
+ la UI está bien — pero si eso es lo ÚNICO que sale del guard, el `cause` murió
793
+ en la última milla: diste feedback de que ocurrió un error sin que el *porqué*
794
+ llegara a ninguna parte. El error debe fluir **completo** (el objeto entero,
795
+ con su cadena de causas adentro):
796
+
797
+ ```ts
798
+ if (!result.ok) {
799
+ setFeedback(result.error.message); // ❌ solo la proyección: el cause se pierde
800
+ return;
801
+ }
802
+
803
+ if (!result.ok) {
804
+ reportDomainError(result.error); // ✅ el objeto entero → al trace
805
+ setFeedback(result.error.message); // y la proyección para la UI, ahora sí
806
+ return;
807
+ }
808
+ ```
809
+
810
+ Lo mismo vía alias (`const e = result.error; setFeedback(e.message)` no
811
+ basta) y vía result (`console.log(result.ok)` no es manejo). Las formas que
812
+ mantienen la información completa: `result.error` entero como argumento /
813
+ retorno / propiedad, el result completo (`return result`), o la
814
+ transformación con `cause`.
815
+
762
816
  Type-aware como su hermana: solo aplica a Results reales de `@skapxd/result`,
763
817
  con las mismas cinco formas de guard.
764
818
 
@@ -1169,20 +1169,20 @@ function getResultErrorRequiresHandlingOptions(options = {}) {
1169
1169
  };
1170
1170
  }
1171
1171
 
1172
- // src/utils/get-declared-alias-names.ts
1173
- function getDeclaredAliasNames(id) {
1172
+ // src/utils/get-declared-alias-targets.ts
1173
+ function getDeclaredAliasTargets(id, represents) {
1174
1174
  if (id.type === "Identifier") {
1175
- return [id.name];
1175
+ return [{ name: id.name, represents }];
1176
1176
  }
1177
- if (id.type !== "ObjectPattern") {
1177
+ if (id.type !== "ObjectPattern" || represents !== "result") {
1178
1178
  return [];
1179
1179
  }
1180
1180
  return id.properties.flatMap((property) => {
1181
1181
  if (property.type === "RestElement" && property.argument.type === "Identifier") {
1182
- return [property.argument.name];
1182
+ return [{ name: property.argument.name, represents: "result" }];
1183
1183
  }
1184
- if (property.type === "Property" && property.value.type === "Identifier") {
1185
- return [property.value.name];
1184
+ if (property.type === "Property" && isPropertyKeyNamed(property, "error") && property.value.type === "Identifier") {
1185
+ return [{ name: property.value.name, represents: "error" }];
1186
1186
  }
1187
1187
  return [];
1188
1188
  });
@@ -1201,10 +1201,20 @@ function isInsideNode(node, ancestor) {
1201
1201
  }
1202
1202
 
1203
1203
  // src/utils/is-consumed-result-reference.ts
1204
- function isConsumedResultReference(identifier, searchRoot, visited = /* @__PURE__ */ new Set()) {
1204
+ function isConsumedResultReference(identifier, searchRoot, represents = "result", visited = /* @__PURE__ */ new Set()) {
1205
1205
  const member = identifier.parent?.type === "MemberExpression" && identifier.parent.object === identifier ? identifier.parent : null;
1206
+ if (member && represents === "error") {
1207
+ return false;
1208
+ }
1209
+ if (member && !isMemberPropertyNamed(member, "error")) {
1210
+ return false;
1211
+ }
1206
1212
  const reference = member ?? identifier;
1213
+ const referenceRepresents = member ? "error" : represents;
1207
1214
  const parent = reference.parent;
1215
+ if (parent?.type === "MemberExpression" && parent.object === reference) {
1216
+ return false;
1217
+ }
1208
1218
  if (parent?.type === "UnaryExpression" && parent.operator === "void") {
1209
1219
  return false;
1210
1220
  }
@@ -1214,13 +1224,18 @@ function isConsumedResultReference(identifier, searchRoot, visited = /* @__PURE_
1214
1224
  if (parent?.type !== "VariableDeclarator" || parent.init !== reference) {
1215
1225
  return true;
1216
1226
  }
1217
- const aliasNames = getDeclaredAliasNames(parent.id).filter(
1218
- (name) => !visited.has(name)
1227
+ const targets = getDeclaredAliasTargets(parent.id, referenceRepresents).filter(
1228
+ (target) => !visited.has(target.name)
1219
1229
  );
1220
- return aliasNames.some((aliasName) => {
1221
- visited.add(aliasName);
1222
- return collectIdentifiersNamed(searchRoot, aliasName).filter((aliasReference) => !isInsideNode(aliasReference, parent.id)).some(
1223
- (aliasReference) => isConsumedResultReference(aliasReference, searchRoot, visited)
1230
+ return targets.some((target) => {
1231
+ visited.add(target.name);
1232
+ return collectIdentifiersNamed(searchRoot, target.name).filter((aliasReference) => !isInsideNode(aliasReference, parent.id)).some(
1233
+ (aliasReference) => isConsumedResultReference(
1234
+ aliasReference,
1235
+ searchRoot,
1236
+ target.represents,
1237
+ visited
1238
+ )
1224
1239
  );
1225
1240
  });
1226
1241
  }
@@ -1233,7 +1248,7 @@ var resultErrorRequiresHandling = {
1233
1248
  description: "Prohibe descartar en silencio un Result fallido: el error se transforma o se entrega, nunca se ignora."
1234
1249
  },
1235
1250
  messages: {
1236
- unhandledResultError: "El guard detecta que `{{name}}` fallo, pero `{{name}}.error` muere aqui sin seguimiento. Transformalo (`Result.err({ cause: {{name}}.error, ... })`), entregaselo a alguien (telemetria, estado de error, log de dominio) o propaga el result completo. Si darle seguimiento es critico o no, no es una interpretacion: todo error fluye a alguna parte."
1251
+ unhandledResultError: "El guard detecta que `{{name}}` fallo, pero `{{name}}.error` no fluye COMPLETO a ninguna parte. Transformalo (`Result.err({ cause: {{name}}.error, ... })`), entrega el objeto entero a alguien (`reportDomainError({{name}}.error)`) o propaga el result completo. Una proyeccion (`{{name}}.error.message`) no basta: el `cause` se pierde justo en la ultima milla. La UI puede leer el mensaje, pero ADEMAS el error entero debe salir hacia el trace."
1237
1252
  },
1238
1253
  schema: [
1239
1254
  {
@@ -2181,4 +2196,4 @@ var rules = {
2181
2196
  export {
2182
2197
  rules
2183
2198
  };
2184
- //# sourceMappingURL=chunk-WZERKXPJ.mjs.map
2199
+ //# sourceMappingURL=chunk-UXF7WZ5B.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/get-file-name.ts","../src/utils/get-source-extension.ts","../src/utils/get-directory-name.ts","../src/utils/is-http-route-method.ts","../src/utils/to-kebab-case.ts","../src/utils/get-suggested-helper-file-name.ts","../src/utils/get-path-parts.ts","../src/utils/is-in-source-root.ts","../src/utils/is-inside-app-directory.ts","../src/constants/next-project-root-file-stems.ts","../src/utils/is-next-convention-file.ts","../src/utils/get-suggested-helper-path.ts","../src/utils/get-move-suggestion.ts","../src/utils/get-function-node-name.ts","../src/utils/get-variable-declarator-name.ts","../src/utils/is-function-node.ts","../src/utils/get-root-function-entries.ts","../src/utils/get-suggested-helper-file-names.ts","../src/utils/get-tree-child-lines.ts","../src/utils/get-structure-suggestion.ts","../src/rules/one-root-function-per-file.ts","../src/utils/is-ast-node.ts","../src/utils/get-node-children.ts","../src/utils/contains-jsx.ts","../src/utils/contains-own-jsx.ts","../src/utils/function-returns-jsx.ts","../src/utils/is-pascal-case-name.ts","../src/utils/to-pascal-case.ts","../src/rules/jsx-return-name-pascal-case.ts","../src/utils/is-member-property-named.ts","../src/utils/is-callee-named.ts","../src/utils/contains-call-named.ts","../src/utils/get-async-result-rule-options.ts","../src/utils/get-property-name.ts","../src/utils/get-parent-function-name.ts","../src/utils/get-function-expression-name.ts","../src/utils/get-parent-function-report-node.ts","../src/utils/get-type-context.ts","../src/utils/is-anonymous-generated-function-name.ts","../src/utils/get-type-reference-parameters.ts","../src/utils/is-type-reference-named.ts","../src/utils/is-promise-of-result-type.ts","../src/utils/get-package-name.ts","../src/utils/is-skapxd-result-source-file.ts","../src/utils/resolve-alias-symbol.ts","../src/utils/is-symbol-from-skapxd-result.ts","../src/utils/is-skapxd-named-type.ts","../src/utils/is-skapxd-result-type.ts","../src/utils/is-skapxd-result-or-promise-result-type.ts","../src/utils/matches-any-glob.ts","../src/utils/matches-any-pattern.ts","../src/rules/async-functions-return-result.ts","../src/utils/get-containing-function.ts","../src/utils/get-function-name.ts","../src/utils/get-returned-object-expression.ts","../src/utils/unwrap-expression.ts","../src/utils/get-boolean-literal-value.ts","../src/utils/is-property-key-named.ts","../src/utils/has-boolean-ok-property.ts","../src/utils/is-exported-function.ts","../src/rules/no-ad-hoc-ok-result.ts","../src/utils/get-await-requires-result-options.ts","../src/utils/get-await-scope-name.ts","../src/utils/get-enclosing-try-safe-call.ts","../src/utils/contains-await-expression.ts","../src/utils/get-call-expression-example.ts","../src/utils/get-awaited-operation-example.ts","../src/utils/get-try-safe-await-suggestion.ts","../src/utils/is-skapxd-result-or-promise-result-expression.ts","../src/utils/is-try-safe-call.ts","../src/rules/await-requires-result.ts","../src/utils/get-error-member-object.ts","../src/utils/get-ok-member-object.ts","../src/utils/is-failed-ok-comparison.ts","../src/utils/get-failed-result-binary-guard-name.ts","../src/utils/get-result-check-argument.ts","../src/utils/get-failed-result-guard.ts","../src/utils/is-result-err-call.ts","../src/utils/get-own-result-err-calls.ts","../src/utils/get-function-return-type.ts","../src/utils/function-returns-skapxd-result-type.ts","../src/utils/is-inside-skapxd-result-returning-function.ts","../src/utils/is-skapxd-result-err-call.ts","../src/utils/is-skapxd-result-expression.ts","../src/utils/is-result-error-member.ts","../src/utils/result-err-preserves-cause.ts","../src/rules/result-error-requires-cause.ts","../src/utils/collect-identifiers-named.ts","../src/utils/get-result-error-requires-handling-options.ts","../src/utils/get-declared-alias-targets.ts","../src/utils/is-inside-node.ts","../src/utils/is-consumed-result-reference.ts","../src/rules/result-error-requires-handling.ts","../src/utils/count-own-use-state-calls-in-node.ts","../src/utils/count-own-use-state-calls.ts","../src/utils/get-function-line-count.ts","../src/utils/get-max-hook-size-options.ts","../src/utils/is-hook-name.ts","../src/rules/max-hook-size.ts","../src/utils/count-parent-segments.ts","../src/rules/no-deep-relative-imports.ts","../src/constants/default-export-allowed-file-patterns.ts","../src/utils/get-no-default-export-options.ts","../src/rules/no-default-export.ts","../src/utils/contains-emoji.ts","../src/utils/get-no-emoji-options.ts","../src/rules/no-emoji.ts","../src/utils/get-no-tunnel-props-options.ts","../src/utils/get-object-pattern-prop-names.ts","../src/utils/is-pascal-case-jsx-element.ts","../src/utils/is-forwarded-prop-reference.ts","../src/rules/no-tunnel-props.ts","../src/utils/get-no-functions-inside-components-options.ts","../src/utils/is-array-map-callback.ts","../src/utils/is-expression-arrow-function.ts","../src/utils/is-jsx-attribute-callback.ts","../src/rules/no-functions-inside-components.ts","../src/rules/no-try-catch.ts","../src/utils/get-prefer-abort-signal-options.ts","../src/utils/get-variable-initializer.ts","../src/utils/object-expression-has-signal.ts","../src/utils/has-abort-signal-option.ts","../src/utils/is-inside-effect-callback.ts","../src/rules/prefer-abort-signal.ts","../src/rules/prefer-ts-pattern.ts","../src/rules/no-jsx-ternary-null.ts","../src/utils/get-no-nested-if-options.ts","../src/utils/is-nested-if-statement.ts","../src/rules/no-nested-if.ts","../src/utils/is-promise-type.ts","../src/rules/no-promise-chain.ts","../src/shared/rules.ts"],"sourcesContent":["// @ts-nocheck\nexport function getFileName(filename) {\n return filename.split(/[\\\\/]/).at(-1) ?? filename;\n}\n","// @ts-nocheck\nexport function getSourceExtension(fileName) {\n return fileName.endsWith(\".tsx\") ? \".tsx\" : \".ts\";\n}\n","// @ts-nocheck\nexport function getDirectoryName(filename) {\n return filename.split(/[\\\\/]/).slice(0, -1).join(\"/\");\n}\n","// @ts-nocheck\nexport function isHttpRouteMethod(functionName) {\n return [\"DELETE\", \"GET\", \"HEAD\", \"OPTIONS\", \"PATCH\", \"POST\", \"PUT\"].includes(\n functionName,\n );\n}\n","// @ts-nocheck\nexport function toKebabCase(value) {\n return value\n .replace(/OEmbed/g, \"Oembed\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/([A-Z]+)([A-Z][a-z])/g, \"$1-$2\")\n .replace(/[^a-zA-Z0-9]+/g, \"-\")\n .replace(/^-|-$/g, \"\")\n .toLocaleLowerCase();\n}\n","// @ts-nocheck\nimport { isHttpRouteMethod } from \"./is-http-route-method\";\nimport { toKebabCase } from \"./to-kebab-case\";\n\nexport function getSuggestedHelperFileName({ extension, fileStem, functionName }) {\n const helperFunctionName =\n fileStem === \"route\" && isHttpRouteMethod(functionName)\n ? `handle${functionName}`\n : functionName;\n\n return `${toKebabCase(helperFunctionName)}${extension}`;\n}\n","// @ts-nocheck\nexport function getPathParts(filename) {\n return filename.split(/[\\\\/]/).filter(Boolean);\n}\n","// @ts-nocheck\nimport { getPathParts } from \"./get-path-parts\";\n\nexport function isInSourceRoot(filename) {\n const pathParts = getPathParts(filename);\n return pathParts.at(-2) === \"src\";\n}\n","// @ts-nocheck\nimport { getPathParts } from \"./get-path-parts\";\n\nexport function isInsideAppDirectory(filename) {\n return getPathParts(filename).includes(\"app\");\n}\n","// @ts-nocheck\nexport const nextProjectRootFileStems = [\n \"instrumentation\",\n \"instrumentation-client\",\n \"mdx-components\",\n \"proxy\",\n];\n","// @ts-nocheck\nimport { isInSourceRoot } from \"./is-in-source-root\";\nimport { isInsideAppDirectory } from \"./is-inside-app-directory\";\nimport { nextAppMetadataFileStems } from \"#/constants/next-app-metadata-file-stems\";\nimport { nextAppRouteSegmentFileStems } from \"#/constants/next-app-route-segment-file-stems\";\nimport { nextProjectRootFileStems } from \"#/constants/next-project-root-file-stems\";\n\nexport function isNextConventionFile({ fileStem, filename }) {\n if (\n [\n ...nextAppRouteSegmentFileStems,\n ...nextAppMetadataFileStems,\n ].includes(fileStem)\n ) {\n return isInsideAppDirectory(filename);\n }\n\n if (nextProjectRootFileStems.includes(fileStem)) {\n return isInSourceRoot(filename);\n }\n\n return false;\n}\n","// @ts-nocheck\nimport { getDirectoryName } from \"./get-directory-name\";\nimport { getSuggestedHelperFileName } from \"./get-suggested-helper-file-name\";\nimport { isNextConventionFile } from \"./is-next-convention-file\";\nimport { toKebabCase } from \"./to-kebab-case\";\n\nexport function getSuggestedHelperPath({ extension, fileStem, filename, functionName }) {\n const helperFileName = getSuggestedHelperFileName({\n extension,\n fileStem,\n functionName,\n });\n\n if (isNextConventionFile({ fileStem, filename })) {\n return `${getDirectoryName(filename)}/${helperFileName}`;\n }\n\n return `${getDirectoryName(filename)}/${toKebabCase(fileStem)}/${helperFileName}`;\n}\n","// @ts-nocheck\nimport { getFileName } from \"./get-file-name\";\nimport { getSourceExtension } from \"./get-source-extension\";\nimport { getSuggestedHelperPath } from \"./get-suggested-helper-path\";\nimport { isHttpRouteMethod } from \"./is-http-route-method\";\nimport { isNextConventionFile } from \"./is-next-convention-file\";\n\nexport function getMoveSuggestion({ filename, functionName }) {\n const fileName = getFileName(filename);\n const extension = getSourceExtension(fileName);\n const fileStem = fileName.slice(0, -extension.length);\n const suggestedPath = getSuggestedHelperPath({\n extension,\n fileStem,\n filename,\n functionName,\n });\n\n if (fileStem === \"route\" && isHttpRouteMethod(functionName)) {\n return `Mueve la implementacion de \\`${functionName}\\` a \\`${suggestedPath}\\` si solo se usa aqui y deja \\`${functionName}\\` en route.ts delegando a ese helper. No conviertas route.ts en route/index.ts porque Next no lo reconoce.`;\n }\n\n if (isNextConventionFile({ fileStem, filename })) {\n return `Mueve \\`${functionName}\\` a \\`${suggestedPath}\\` si solo se usa aqui y deja \\`${fileName}\\` como entrypoint de Next. No conviertas \\`${fileName}\\` en \\`${fileStem}/index${extension}\\` porque Next exige el nombre exacto del archivo.`;\n }\n\n return `Mueve \\`${functionName}\\` a \\`${suggestedPath}\\` si solo se usa aqui.`;\n}\n","// @ts-nocheck\nexport function getFunctionNodeName(node) {\n return node.id?.name ?? \"helper\";\n}\n","// @ts-nocheck\nimport { getFunctionNodeName } from \"./get-function-node-name\";\n\nexport function getVariableDeclaratorName(variableDeclarator) {\n return variableDeclarator.id.type === \"Identifier\"\n ? variableDeclarator.id.name\n : getFunctionNodeName(variableDeclarator.init);\n}\n","// @ts-nocheck\nexport function isFunctionNode(node) {\n return (\n node?.type === \"FunctionDeclaration\" ||\n node?.type === \"FunctionExpression\" ||\n node?.type === \"ArrowFunctionExpression\"\n );\n}\n","// @ts-nocheck\nimport { getFunctionNodeName } from \"./get-function-node-name\";\nimport { getVariableDeclaratorName } from \"./get-variable-declarator-name\";\nimport { isFunctionNode } from \"./is-function-node\";\n\nexport function getRootFunctionEntries(statement) {\n const declaration =\n statement.type === \"ExportNamedDeclaration\" ||\n statement.type === \"ExportDefaultDeclaration\"\n ? statement.declaration\n : statement;\n\n if (!declaration) {\n return [];\n }\n\n if (isFunctionNode(declaration)) {\n return [\n {\n name: getFunctionNodeName(declaration),\n node: declaration,\n },\n ];\n }\n\n if (declaration.type !== \"VariableDeclaration\") {\n return [];\n }\n\n return declaration.declarations\n .filter((variableDeclarator) => isFunctionNode(variableDeclarator.init))\n .map((variableDeclarator) => ({\n name: getVariableDeclaratorName(variableDeclarator),\n node: variableDeclarator.init,\n }));\n}\n","// @ts-nocheck\nimport { getSuggestedHelperFileName } from \"./get-suggested-helper-file-name\";\n\nexport function getSuggestedHelperFileNames({ extension, fileStem, functionNames }) {\n return [\n ...new Set(\n functionNames.map((functionName) =>\n getSuggestedHelperFileName({\n extension,\n fileStem,\n functionName,\n }),\n ),\n ),\n ];\n}\n","// @ts-nocheck\nexport function getTreeChildLines({ indent = \"\", names }) {\n return names.map((name, index) => {\n const branch = index === names.length - 1 ? \"└──\" : \"├──\";\n\n return `${indent}${branch} ${name}`;\n });\n}\n","// @ts-nocheck\nimport { getDirectoryName } from \"./get-directory-name\";\nimport { getFileName } from \"./get-file-name\";\nimport { getSourceExtension } from \"./get-source-extension\";\nimport { getSuggestedHelperFileNames } from \"./get-suggested-helper-file-names\";\nimport { getTreeChildLines } from \"./get-tree-child-lines\";\nimport { isNextConventionFile } from \"./is-next-convention-file\";\nimport { toKebabCase } from \"./to-kebab-case\";\n\nexport function getStructureSuggestion({ filename, functionNames }) {\n const fileName = getFileName(filename);\n const extension = getSourceExtension(fileName);\n const fileStem = fileName.slice(0, -extension.length);\n const directoryName = getDirectoryName(filename);\n const helperFileNames = getSuggestedHelperFileNames({\n extension,\n fileStem,\n functionNames,\n });\n\n if (isNextConventionFile({ fileStem, filename })) {\n return [\n `${directoryName}/`,\n ...getTreeChildLines({\n names: [fileName, ...helperFileNames],\n }),\n ].join(\"\\n\");\n }\n\n return [\n `${directoryName}/${toKebabCase(fileStem)}/`,\n ...getTreeChildLines({\n names: [`index${extension}`, ...helperFileNames],\n }),\n ].join(\"\\n\");\n}\n","// @ts-nocheck\nimport { getMoveSuggestion } from \"#/utils/get-move-suggestion\";\nimport { getRootFunctionEntries } from \"#/utils/get-root-function-entries\";\nimport { getStructureSuggestion } from \"#/utils/get-structure-suggestion\";\n\nexport const oneRootFunctionPerFile = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Limita cada archivo a una sola funcion declarada en la raiz.\",\n },\n messages: {\n tooManyRootFunctions:\n \"Este archivo tiene {{count}} funciones en la raiz. Deja solo una funcion top-level por archivo. {{moveSuggestion}}\\n\\nEstructura sugerida:\\n{{structureSuggestion}}\\n\\nSi se reutiliza, muevela a un modulo compartido con nombre de dominio.\",\n },\n schema: [],\n },\n create(context) {\n return {\n Program(node) {\n const rootFunctions = node.body.flatMap((statement) =>\n getRootFunctionEntries(statement),\n );\n\n if (rootFunctions.length <= 1) {\n return;\n }\n\n const firstHelper = rootFunctions[1];\n const helperFunctionNames = rootFunctions\n .slice(1)\n .map((rootFunction) => rootFunction.name);\n\n context.report({\n data: {\n count: String(rootFunctions.length),\n moveSuggestion: getMoveSuggestion({\n filename: context.filename ?? context.getFilename(),\n functionName: firstHelper.name,\n }),\n structureSuggestion: getStructureSuggestion({\n filename: context.filename ?? context.getFilename(),\n functionNames: helperFunctionNames,\n }),\n },\n messageId: \"tooManyRootFunctions\",\n node: firstHelper.node,\n });\n },\n };\n },\n };\n","// @ts-nocheck\nexport function isAstNode(value) {\n return Boolean(value && typeof value === \"object\" && \"type\" in value);\n}\n","// @ts-nocheck\nimport { isAstNode } from \"./is-ast-node\";\n\nexport function getNodeChildren(node) {\n return Object.entries(node).flatMap(([key, value]) => {\n if ([\"parent\", \"loc\", \"range\", \"tokens\", \"comments\"].includes(key)) {\n return [];\n }\n\n if (Array.isArray(value)) {\n return value.filter(isAstNode);\n }\n\n return isAstNode(value) ? [value] : [];\n });\n}\n","// @ts-nocheck\nimport { getNodeChildren } from \"./get-node-children\";\nimport { isAstNode } from \"./is-ast-node\";\n\nexport function containsJsx(node) {\n if (!isAstNode(node)) {\n return false;\n }\n\n if (node.type === \"JSXElement\" || node.type === \"JSXFragment\") {\n return true;\n }\n\n return getNodeChildren(node).some((child) => containsJsx(child));\n}\n","// @ts-nocheck\nimport { getNodeChildren } from \"./get-node-children\";\nimport { isAstNode } from \"./is-ast-node\";\nimport { isFunctionNode } from \"./is-function-node\";\n\nexport function containsOwnJsx(node) {\n if (!isAstNode(node)) {\n return false;\n }\n\n if (node.type === \"JSXElement\" || node.type === \"JSXFragment\") {\n return true;\n }\n\n if (isFunctionNode(node)) {\n return false;\n }\n\n return getNodeChildren(node).some((child) => containsOwnJsx(child));\n}\n","// @ts-nocheck\nimport { containsJsx } from \"./contains-jsx\";\nimport { containsOwnJsx } from \"./contains-own-jsx\";\n\nexport function functionReturnsJsx(functionNode) {\n if (functionNode.body?.type !== \"BlockStatement\") {\n return containsJsx(functionNode.body);\n }\n\n return containsOwnJsx(functionNode.body);\n}\n","// @ts-nocheck\nexport function isPascalCaseName(value) {\n return /^[A-Z][A-Za-z0-9]*$/.test(value);\n}\n","// @ts-nocheck\nexport function toPascalCase(value) {\n return value.replace(/^[a-z]/, (letter) => letter.toLocaleUpperCase());\n}\n","// @ts-nocheck\nimport { functionReturnsJsx } from \"#/utils/function-returns-jsx\";\nimport { isFunctionNode } from \"#/utils/is-function-node\";\nimport { isPascalCaseName } from \"#/utils/is-pascal-case-name\";\nimport { toPascalCase } from \"#/utils/to-pascal-case\";\n\nexport const jsxReturnNamePascalCase = {\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Exige nombres PascalCase para funciones que devuelven JSX.\",\n },\n messages: {\n invalidName:\n \"La funcion `{{name}}` devuelve JSX. Nombrala como componente, por ejemplo `{{suggestedName}}`, y usala con sintaxis JSX si aplica.\",\n },\n schema: [],\n },\n create(context) {\n function reportIfJsxReturningFunction(node, name, reportNode = node) {\n if (!name || isPascalCaseName(name) || !functionReturnsJsx(node)) {\n return;\n }\n\n context.report({\n data: {\n name,\n suggestedName: toPascalCase(name),\n },\n messageId: \"invalidName\",\n node: reportNode,\n });\n }\n\n return {\n FunctionDeclaration(node) {\n reportIfJsxReturningFunction(node, node.id?.name, node.id ?? node);\n },\n VariableDeclarator(node) {\n if (!isFunctionNode(node.init) || node.id.type !== \"Identifier\") {\n return;\n }\n\n reportIfJsxReturningFunction(node.init, node.id.name, node.id);\n },\n };\n },\n };\n","// @ts-nocheck\nexport function isMemberPropertyNamed(node, propertyName) {\n if (node.computed) {\n return node.property.type === \"Literal\" && node.property.value === propertyName;\n }\n\n return node.property.type === \"Identifier\" && node.property.name === propertyName;\n}\n","// @ts-nocheck\nimport { isMemberPropertyNamed } from \"./is-member-property-named\";\n\nexport function isCalleeNamed(node, names) {\n if (node?.type === \"Identifier\") {\n return names.includes(node.name);\n }\n\n if (node?.type === \"MemberExpression\") {\n return names.some((name) => isMemberPropertyNamed(node, name));\n }\n\n return false;\n}\n","// @ts-nocheck\nimport { getNodeChildren } from \"./get-node-children\";\nimport { isAstNode } from \"./is-ast-node\";\nimport { isCalleeNamed } from \"./is-callee-named\";\n\nexport function containsCallNamed(node, names) {\n if (!isAstNode(node)) {\n return false;\n }\n\n if (node.type === \"CallExpression\" && isCalleeNamed(node.callee, names)) {\n return true;\n }\n\n return getNodeChildren(node).some((child) => containsCallNamed(child, names));\n}\n","// @ts-nocheck\nexport function getAsyncResultRuleOptions(options = {}) {\n return {\n allowFilePatterns: options.allowFilePatterns ?? [],\n allowNamePatterns: options.allowNamePatterns ?? [],\n checkMissingReturnType: options.checkMissingReturnType ?? true,\n checkMissingReturnTypeWhenCallNames:\n options.checkMissingReturnTypeWhenCallNames ?? [],\n promiseTypeNames: options.promiseTypeNames ?? [\"Promise\"],\n requireCallNames: options.requireCallNames ?? [],\n resultTypeNames: options.resultTypeNames ?? [\"Result\"],\n };\n}\n","// @ts-nocheck\nexport function getPropertyName(node) {\n if (!node) {\n return \"anonymous\";\n }\n\n if (node.type === \"Identifier\") {\n return node.name;\n }\n\n if (node.type === \"Literal\") {\n return String(node.value);\n }\n\n return \"anonymous\";\n}\n","// @ts-nocheck\nimport { getFunctionNodeName } from \"./get-function-node-name\";\nimport { getPropertyName } from \"./get-property-name\";\nimport { getVariableDeclaratorName } from \"./get-variable-declarator-name\";\n\nexport function getParentFunctionName(node) {\n const parent = node.parent;\n\n if (parent?.type === \"VariableDeclarator\") {\n return getVariableDeclaratorName(parent);\n }\n\n if (\n parent?.type === \"Property\" ||\n parent?.type === \"MethodDefinition\" ||\n parent?.type === \"PropertyDefinition\"\n ) {\n return getPropertyName(parent.key);\n }\n\n return getFunctionNodeName(node);\n}\n","// @ts-nocheck\nimport { getParentFunctionName } from \"./get-parent-function-name\";\n\nexport function getFunctionExpressionName(node) {\n return node.id?.name ?? getParentFunctionName(node);\n}\n","// @ts-nocheck\nexport function getParentFunctionReportNode(node) {\n const parent = node.parent;\n\n if (parent?.type === \"VariableDeclarator\" && parent.id.type === \"Identifier\") {\n return parent.id;\n }\n\n if (\n parent?.type === \"Property\" ||\n parent?.type === \"MethodDefinition\" ||\n parent?.type === \"PropertyDefinition\"\n ) {\n return parent.key;\n }\n\n return node.id ?? node;\n}\n","// @ts-nocheck\nexport function getTypeContext(context) {\n const sourceCode = context.sourceCode ?? context.getSourceCode();\n const parserServices = sourceCode.parserServices;\n\n if (!parserServices?.program) {\n return null;\n }\n\n return {\n checker: parserServices.program.getTypeChecker(),\n services: parserServices,\n };\n}\n","// @ts-nocheck\nexport function isAnonymousGeneratedFunctionName(name) {\n return name === \"anonymous\" || name === \"helper\";\n}\n","// @ts-nocheck\nexport function getTypeReferenceParameters(node) {\n return node.typeArguments?.params ?? node.typeParameters?.params ?? [];\n}\n","// @ts-nocheck\nexport function isTypeReferenceNamed(node, names) {\n const typeName = node.typeName;\n\n return typeName.type === \"Identifier\" && names.includes(typeName.name);\n}\n","// @ts-nocheck\nimport { getTypeReferenceParameters } from \"./get-type-reference-parameters\";\nimport { isTypeReferenceNamed } from \"./is-type-reference-named\";\n\nexport function isPromiseOfResultType(node, options) {\n if (node.type !== \"TSTypeReference\") {\n return false;\n }\n\n if (!isTypeReferenceNamed(node, options.promiseTypeNames)) {\n return false;\n }\n\n const promiseValueType = getTypeReferenceParameters(node)[0];\n\n return Boolean(\n promiseValueType &&\n promiseValueType.type === \"TSTypeReference\" &&\n isTypeReferenceNamed(promiseValueType, options.resultTypeNames),\n );\n}\n","// @ts-nocheck\nimport { trySafe } from \"@skapxd/result\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nconst packageNameByDir = new Map();\n\n// Resuelve el `name` del package.json más cercano hacia arriba desde un archivo.\n// Robusto ante cualquier layout (node_modules, pnpm, workspace link, monorepo):\n// se basa en la identidad real del paquete, no en la forma de la ruta.\nexport function getPackageName(fileName) {\n const visited = [];\n let dir = path.dirname(fileName);\n\n while (true) {\n if (packageNameByDir.has(dir)) {\n const cached = packageNameByDir.get(dir);\n for (const visitedDir of visited) packageNameByDir.set(visitedDir, cached);\n return cached;\n }\n\n visited.push(dir);\n\n const packageJsonPath = path.join(dir, \"package.json\");\n\n if (fs.existsSync(packageJsonPath)) {\n const parsed = trySafe(() =>\n JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\")),\n );\n const name = parsed.ok ? (parsed.value.name ?? null) : null;\n for (const visitedDir of visited) packageNameByDir.set(visitedDir, name);\n return name;\n }\n\n const parent = path.dirname(dir);\n\n if (parent === dir) {\n for (const visitedDir of visited) packageNameByDir.set(visitedDir, null);\n return null;\n }\n\n dir = parent;\n }\n}\n","// @ts-nocheck\nimport { getPackageName } from \"./get-package-name\";\n\nexport function isSkapxdResultSourceFile(fileName) {\n return getPackageName(fileName) === \"@skapxd/result\";\n}\n","// @ts-nocheck\nimport ts from \"typescript\";\n\nexport function resolveAliasSymbol(symbol, typeContext) {\n return symbol.flags & ts.SymbolFlags.Alias\n ? typeContext.checker.getAliasedSymbol(symbol)\n : symbol;\n}\n","// @ts-nocheck\nimport { isSkapxdResultSourceFile } from \"./is-skapxd-result-source-file\";\nimport { resolveAliasSymbol } from \"./resolve-alias-symbol\";\n\nexport function isSymbolFromSkapxdResult(symbol, typeContext) {\n const resolvedSymbol = resolveAliasSymbol(symbol, typeContext);\n\n return (resolvedSymbol.getDeclarations() ?? []).some((declaration) =>\n isSkapxdResultSourceFile(declaration.getSourceFile().fileName),\n );\n}\n","// @ts-nocheck\nimport { isSymbolFromSkapxdResult } from \"./is-symbol-from-skapxd-result\";\n\nexport function isSkapxdNamedType(type, names, typeContext) {\n return [\n type.aliasSymbol,\n type.symbol,\n ].some((symbol) =>\n Boolean(\n symbol &&\n names.includes(symbol.getName()) &&\n isSymbolFromSkapxdResult(symbol, typeContext),\n ),\n );\n}\n","// @ts-nocheck\nimport { isSkapxdNamedType } from \"./is-skapxd-named-type\";\n\nexport function isSkapxdResultType(type, typeContext) {\n if (isSkapxdNamedType(type, [\"Result\", \"SafeResult\"], typeContext)) {\n return true;\n }\n\n if (!type.isUnion()) {\n return false;\n }\n\n const hasOk = type.types.some((part) =>\n isSkapxdNamedType(part, [\"Ok\"], typeContext),\n );\n const hasErr = type.types.some((part) =>\n isSkapxdNamedType(part, [\"Err\"], typeContext),\n );\n\n return hasOk && hasErr;\n}\n","// @ts-nocheck\nimport { isSkapxdResultType } from \"./is-skapxd-result-type\";\n\nexport function isSkapxdResultOrPromiseResultType(type, typeContext) {\n if (isSkapxdResultType(type, typeContext)) {\n return true;\n }\n\n const promisedType = typeContext.checker.getPromisedTypeOfPromise(type);\n\n return Boolean(promisedType && isSkapxdResultType(promisedType, typeContext));\n}\n","// @ts-nocheck\nimport picomatch from \"picomatch\";\n\n// Matching de rutas con globs delegado a picomatch (el motor que usan\n// fast-glob, chokidar y vitest). Dos ergonomías propias:\n// - separadores de Windows normalizados, mismo glob en cualquier sistema;\n// - un patrón sin prefijo (`src/index.ts`, `*.config.*`) matchea en\n// cualquier carpeta — se le antepone `**/`.\nexport function matchesAnyGlob(filePath, globs) {\n const normalized = filePath.replaceAll(\"\\\\\", \"/\");\n\n return globs.some((glob) => {\n const anchored =\n glob.startsWith(\"/\") || glob.startsWith(\"**\") ? glob : `**/${glob}`;\n\n return picomatch(anchored)(normalized);\n });\n}\n","// @ts-nocheck\nexport function matchesAnyPattern(value, patterns) {\n return patterns.some((pattern) => new RegExp(pattern).test(value));\n}\n","// @ts-nocheck\nimport { containsCallNamed } from \"#/utils/contains-call-named\";\nimport { getAsyncResultRuleOptions } from \"#/utils/get-async-result-rule-options\";\nimport { getFunctionExpressionName } from \"#/utils/get-function-expression-name\";\nimport { getParentFunctionName } from \"#/utils/get-parent-function-name\";\nimport { getParentFunctionReportNode } from \"#/utils/get-parent-function-report-node\";\nimport { getTypeContext } from \"#/utils/get-type-context\";\nimport { isAnonymousGeneratedFunctionName } from \"#/utils/is-anonymous-generated-function-name\";\nimport { isPromiseOfResultType } from \"#/utils/is-promise-of-result-type\";\nimport { isSkapxdResultOrPromiseResultType } from \"#/utils/is-skapxd-result-or-promise-result-type\";\nimport { matchesAnyGlob } from \"#/utils/matches-any-glob\";\nimport { matchesAnyPattern } from \"#/utils/matches-any-pattern\";\n\nexport const asyncFunctionsReturnResult = {\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Exige Promise<Result<...>> en funciones async de dominio.\",\n },\n messages: {\n missingReturnType:\n \"La funcion async `{{name}}` debe declarar Promise<Result<...>> como tipo de retorno: trySafe en la frontera, errores de dominio con `cause`, y el consumidor decide con `match()` de ts-pattern.\",\n invalidReturnType:\n \"La funcion async `{{name}}` debe retornar Promise<Result<...>> para modelar errores de forma explicita: trySafe en la frontera, errores de dominio con `cause`, y el consumidor decide con `match()` de ts-pattern.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowFilePatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n allowNamePatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n checkMissingReturnType: { type: \"boolean\" },\n checkMissingReturnTypeWhenCallNames: {\n items: { type: \"string\" },\n type: \"array\",\n },\n requireCallNames: {\n items: { type: \"string\" },\n type: \"array\",\n },\n promiseTypeNames: {\n items: { type: \"string\" },\n type: \"array\",\n },\n resultTypeNames: {\n items: { type: \"string\" },\n type: \"array\",\n },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getAsyncResultRuleOptions(context.options[0]);\n const filename = context.filename ?? context.getFilename();\n const typeContext = getTypeContext(context);\n\n // Verifica que el tipo de retorno sea un Result de @skapxd/result.\n // Con información de tipos (projectService) resuelve el símbolo hasta\n // el paquete; sin ella, cae a una comprobación por nombre.\n function isSkapxdResultReturnType(annotation) {\n if (typeContext) {\n const type = typeContext.services.getTypeFromTypeNode(annotation);\n\n return isSkapxdResultOrPromiseResultType(type, typeContext);\n }\n\n return isPromiseOfResultType(annotation, options);\n }\n\n function reportIfInvalidAsyncReturn(node, name, reportNode = node) {\n if (!node.async || matchesAnyGlob(filename, options.allowFilePatterns)) {\n return;\n }\n\n const functionName = name ?? \"anonymous\";\n\n if (isAnonymousGeneratedFunctionName(functionName)) {\n return;\n }\n\n if (matchesAnyPattern(functionName, options.allowNamePatterns)) {\n return;\n }\n\n if (\n options.requireCallNames.length &&\n !containsCallNamed(node.body, options.requireCallNames)\n ) {\n return;\n }\n\n const returnType = node.returnType?.typeAnnotation;\n const missingReturnTypeIsReportable =\n options.checkMissingReturnType ||\n containsCallNamed(node.body, options.checkMissingReturnTypeWhenCallNames);\n\n if (!returnType && missingReturnTypeIsReportable) {\n context.report({\n data: { name: functionName },\n messageId: \"missingReturnType\",\n node: reportNode,\n });\n\n return;\n }\n\n if (!returnType) {\n return;\n }\n\n if (isSkapxdResultReturnType(returnType)) {\n return;\n }\n\n context.report({\n data: { name: functionName },\n messageId: \"invalidReturnType\",\n node: reportNode,\n });\n }\n\n return {\n ArrowFunctionExpression(node) {\n reportIfInvalidAsyncReturn(\n node,\n getParentFunctionName(node),\n getParentFunctionReportNode(node),\n );\n },\n FunctionDeclaration(node) {\n reportIfInvalidAsyncReturn(node, node.id?.name, node.id ?? node);\n },\n FunctionExpression(node) {\n reportIfInvalidAsyncReturn(\n node,\n getFunctionExpressionName(node),\n getParentFunctionReportNode(node),\n );\n },\n };\n },\n };\n","// @ts-nocheck\nimport { isFunctionNode } from \"./is-function-node\";\n\nexport function getContainingFunction(node) {\n let currentNode = node.parent;\n\n while (currentNode) {\n if (isFunctionNode(currentNode)) {\n return currentNode;\n }\n\n currentNode = currentNode.parent;\n }\n\n return null;\n}\n","// @ts-nocheck\nimport { getFunctionNodeName } from \"./get-function-node-name\";\nimport { getParentFunctionName } from \"./get-parent-function-name\";\n\nexport function getFunctionName(node) {\n if (node.type === \"FunctionDeclaration\") {\n return getFunctionNodeName(node);\n }\n\n return getParentFunctionName(node);\n}\n","// @ts-nocheck\nexport function getReturnedObjectExpression(node) {\n if (!node) {\n return null;\n }\n\n if (node.type === \"ObjectExpression\") {\n return node;\n }\n\n if (\n node.type === \"TSAsExpression\" ||\n node.type === \"TSSatisfiesExpression\" ||\n node.type === \"TSNonNullExpression\" ||\n node.type === \"ChainExpression\"\n ) {\n return getReturnedObjectExpression(node.expression);\n }\n\n return null;\n}\n","// @ts-nocheck\nexport function unwrapExpression(node) {\n if (\n node.type === \"ChainExpression\" ||\n node.type === \"TSAsExpression\" ||\n node.type === \"TSSatisfiesExpression\" ||\n node.type === \"TSNonNullExpression\"\n ) {\n return unwrapExpression(node.expression);\n }\n\n return node;\n}\n","// @ts-nocheck\nimport { unwrapExpression } from \"./unwrap-expression\";\n\nexport function getBooleanLiteralValue(node) {\n const unwrappedNode = unwrapExpression(node);\n\n return unwrappedNode.type === \"Literal\" && typeof unwrappedNode.value === \"boolean\"\n ? unwrappedNode.value\n : null;\n}\n","// @ts-nocheck\nexport function isPropertyKeyNamed(property, propertyName) {\n if (property.key.type === \"Identifier\") {\n return property.key.name === propertyName;\n }\n\n return property.key.type === \"Literal\" && property.key.value === propertyName;\n}\n","// @ts-nocheck\nimport { getBooleanLiteralValue } from \"./get-boolean-literal-value\";\nimport { isPropertyKeyNamed } from \"./is-property-key-named\";\n\n// Detecta `{ ok: true }` / `{ ok: false }` (contrato ad hoc tipo Result),\n// no `{ ok: res.ok }` (un valor cualquiera, p. ej. un Response de fetch).\nexport function hasBooleanOkProperty(node) {\n return node.properties.some(\n (property) =>\n property.type === \"Property\" &&\n isPropertyKeyNamed(property, \"ok\") &&\n getBooleanLiteralValue(property.value) !== null,\n );\n}\n","// @ts-nocheck\nexport function isExportedFunction(node) {\n const parent = node.parent;\n\n if (\n node.type === \"FunctionDeclaration\" &&\n (parent?.type === \"ExportNamedDeclaration\" ||\n parent?.type === \"ExportDefaultDeclaration\")\n ) {\n return true;\n }\n\n if (\n (node.type === \"ArrowFunctionExpression\" ||\n node.type === \"FunctionExpression\") &&\n parent?.type === \"VariableDeclarator\" &&\n parent.parent?.parent?.type === \"ExportNamedDeclaration\"\n ) {\n return true;\n }\n\n return false;\n}\n","// @ts-nocheck\nimport { getContainingFunction } from \"#/utils/get-containing-function\";\nimport { getFunctionName } from \"#/utils/get-function-name\";\nimport { getReturnedObjectExpression } from \"#/utils/get-returned-object-expression\";\nimport { hasBooleanOkProperty } from \"#/utils/has-boolean-ok-property\";\nimport { isExportedFunction } from \"#/utils/is-exported-function\";\n\nexport const noAdHocOkResult = {\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Prohibe retornar contratos ad hoc con ok en funciones async exportadas.\",\n },\n messages: {\n adHocOkResult:\n \"No retornes objetos ad hoc con `ok` desde la funcion async `{{name}}`. Usa Result.ok(...) / Result.err(...) de @skapxd/result con un error discriminado `{ type: ... }`: un unico contrato Result permite consumir cada variante con `match()` de ts-pattern y `.exhaustive()`.\",\n },\n schema: [],\n },\n create(context) {\n return {\n ReturnStatement(node) {\n const returnedObject = getReturnedObjectExpression(node.argument);\n\n if (!returnedObject || !hasBooleanOkProperty(returnedObject)) {\n return;\n }\n\n const containingFunction = getContainingFunction(node);\n\n if (\n !containingFunction?.async ||\n !isExportedFunction(containingFunction)\n ) {\n return;\n }\n\n context.report({\n data: {\n name: getFunctionName(containingFunction),\n },\n messageId: \"adHocOkResult\",\n node,\n });\n },\n };\n },\n };\n","// @ts-nocheck\nexport function getAwaitRequiresResultOptions(options = {}) {\n return {\n allowFilePatterns: options.allowFilePatterns ?? [],\n trySafeCallNames: options.trySafeCallNames ?? [\"trySafe\"],\n };\n}\n","// @ts-nocheck\nimport { getContainingFunction } from \"./get-containing-function\";\nimport { getFunctionName } from \"./get-function-name\";\n\nexport function getAwaitScopeName(node) {\n const containingFunction = getContainingFunction(node);\n\n return containingFunction ? getFunctionName(containingFunction) : \"top-level\";\n}\n","// @ts-nocheck\nimport { isCalleeNamed } from \"./is-callee-named\";\nimport { isFunctionNode } from \"./is-function-node\";\n\n// Si el nodo está dentro de un callback pasado a `trySafe(...)`, devuelve esa\n// CallExpression (para poder verificar su símbolo); si no, null.\nexport function getEnclosingTrySafeCall(node, trySafeCallNames) {\n let currentNode = node.parent;\n\n while (currentNode) {\n if (!isFunctionNode(currentNode)) {\n currentNode = currentNode.parent;\n continue;\n }\n\n const parent = currentNode.parent;\n const isTrySafeArgument =\n parent?.type === \"CallExpression\" &&\n parent.arguments.includes(currentNode) &&\n isCalleeNamed(parent.callee, trySafeCallNames);\n\n return isTrySafeArgument ? parent : null;\n }\n\n return null;\n}\n","// @ts-nocheck\nimport { getNodeChildren } from \"./get-node-children\";\nimport { isAstNode } from \"./is-ast-node\";\nimport { isFunctionNode } from \"./is-function-node\";\n\nexport function containsAwaitExpression(node) {\n if (!isAstNode(node)) {\n return false;\n }\n\n if (node.type === \"AwaitExpression\") {\n return true;\n }\n\n if (isFunctionNode(node)) {\n return false;\n }\n\n return getNodeChildren(node).some((child) => containsAwaitExpression(child));\n}\n","// @ts-nocheck\nimport { unwrapExpression } from \"./unwrap-expression\";\n\nexport function getCallExpressionExample(node, sourceCode) {\n const calleeText = sourceCode.getText(node.callee);\n\n if (node.arguments.length === 0) {\n return `${calleeText}()`;\n }\n\n if (node.arguments.length === 1 && unwrapExpression(node.arguments[0]).type === \"ObjectExpression\") {\n return `${calleeText}({...})`;\n }\n\n return `${calleeText}(...)`;\n}\n","// @ts-nocheck\nimport { getCallExpressionExample } from \"./get-call-expression-example\";\nimport { unwrapExpression } from \"./unwrap-expression\";\n\nexport function getAwaitedOperationExample(node, sourceCode) {\n const unwrappedNode = unwrapExpression(node);\n\n if (unwrappedNode.type === \"CallExpression\") {\n return getCallExpressionExample(unwrappedNode, sourceCode);\n }\n\n const expressionText = sourceCode.getText(unwrappedNode).replace(/\\s+/g, \" \");\n\n return expressionText.length > 80\n ? `${expressionText.slice(0, 77)}...`\n : expressionText;\n}\n","// @ts-nocheck\nimport { containsAwaitExpression } from \"./contains-await-expression\";\nimport { getAwaitedOperationExample } from \"./get-awaited-operation-example\";\n\nexport function getTrySafeAwaitSuggestion(node, sourceCode) {\n const callbackKeyword = containsAwaitExpression(node) ? \"async \" : \"\";\n\n return `await trySafe(${callbackKeyword}() => ${getAwaitedOperationExample(\n node,\n sourceCode,\n )})`;\n}\n","// @ts-nocheck\nimport { isSkapxdResultOrPromiseResultType } from \"./is-skapxd-result-or-promise-result-type\";\n\nexport function isSkapxdResultOrPromiseResultExpression(node, typeContext) {\n return isSkapxdResultOrPromiseResultType(\n typeContext.services.getTypeAtLocation(node),\n typeContext,\n );\n}\n","// @ts-nocheck\nimport { isCalleeNamed } from \"./is-callee-named\";\n\nexport function isTrySafeCall(node, trySafeCallNames) {\n return (\n node?.type === \"CallExpression\" &&\n isCalleeNamed(node.callee, trySafeCallNames)\n );\n}\n","// @ts-nocheck\nimport { getAwaitRequiresResultOptions } from \"#/utils/get-await-requires-result-options\";\nimport { getAwaitScopeName } from \"#/utils/get-await-scope-name\";\nimport { getEnclosingTrySafeCall } from \"#/utils/get-enclosing-try-safe-call\";\nimport { getTrySafeAwaitSuggestion } from \"#/utils/get-try-safe-await-suggestion\";\nimport { getTypeContext } from \"#/utils/get-type-context\";\nimport { isSkapxdResultOrPromiseResultExpression } from \"#/utils/is-skapxd-result-or-promise-result-expression\";\nimport { isSymbolFromSkapxdResult } from \"#/utils/is-symbol-from-skapxd-result\";\nimport { isTrySafeCall } from \"#/utils/is-try-safe-call\";\nimport { matchesAnyGlob } from \"#/utils/matches-any-glob\";\n\nexport const awaitRequiresResult = {\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Exige que todo await resuelva en un Result: una funcion que retorne Promise<Result<...>> o trySafe en el sitio.\",\n },\n messages: {\n awaitWithoutResult:\n \"El await dentro de `{{name}}` no resuelve en un Result. Mejor opcion: extrae la operacion a una funcion que retorne Promise<Result<...>> y modela ahi los errores de dominio con `{ type, message, cause }` (el trySafe vive dentro de esa funcion). Alternativa: envuelvela aqui mismo: `{{suggestion}}`. En ambos casos, consume el Result con `match()` de ts-pattern.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowFilePatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n trySafeCallNames: {\n items: { type: \"string\" },\n type: \"array\",\n },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getAwaitRequiresResultOptions(context.options[0]);\n const filename = context.filename ?? context.getFilename();\n const sourceCode = context.sourceCode ?? context.getSourceCode();\n const typeContext = getTypeContext(context);\n\n // Una llamada protege el await solo si es trySafe de @skapxd/result.\n // Con info de tipos se verifica por símbolo; sin ella, el nombre basta.\n function isSkapxdTrySafe(callNode) {\n if (!callNode) {\n return false;\n }\n\n if (!typeContext) {\n return true;\n }\n\n const symbol = typeContext.services.getSymbolAtLocation(callNode.callee);\n\n return Boolean(symbol && isSymbolFromSkapxdResult(symbol, typeContext));\n }\n\n return {\n AwaitExpression(node) {\n if (matchesAnyGlob(filename, options.allowFilePatterns)) {\n return;\n }\n\n // Si lo awaiteado ya es Result/Promise<Result> de @skapxd/result,\n // los errores ya están modelados y trySafe sería redundante.\n if (\n typeContext &&\n isSkapxdResultOrPromiseResultExpression(node.argument, typeContext)\n ) {\n return;\n }\n\n const directCall = isTrySafeCall(node.argument, options.trySafeCallNames)\n ? node.argument\n : null;\n const enclosingCall = getEnclosingTrySafeCall(\n node,\n options.trySafeCallNames,\n );\n\n if (isSkapxdTrySafe(directCall) || isSkapxdTrySafe(enclosingCall)) {\n return;\n }\n\n context.report({\n data: {\n name: getAwaitScopeName(node),\n suggestion: getTrySafeAwaitSuggestion(node.argument, sourceCode),\n },\n messageId: \"awaitWithoutResult\",\n node,\n });\n },\n };\n },\n };\n","// @ts-nocheck\nimport { isMemberPropertyNamed } from \"./is-member-property-named\";\nimport { unwrapExpression } from \"./unwrap-expression\";\n\n// `result.error` usado como condición: la presencia del error es el guard.\nexport function getErrorMemberObject(node) {\n const unwrappedNode = unwrapExpression(node);\n\n if (\n unwrappedNode.type !== \"MemberExpression\" ||\n unwrappedNode.object.type !== \"Identifier\" ||\n !isMemberPropertyNamed(unwrappedNode, \"error\")\n ) {\n return null;\n }\n\n return {\n name: unwrappedNode.object.name,\n node: unwrappedNode.object,\n };\n}\n","// @ts-nocheck\nimport { isMemberPropertyNamed } from \"./is-member-property-named\";\nimport { unwrapExpression } from \"./unwrap-expression\";\n\nexport function getOkMemberObject(node) {\n const unwrappedNode = unwrapExpression(node);\n\n if (\n unwrappedNode.type !== \"MemberExpression\" ||\n unwrappedNode.object.type !== \"Identifier\" ||\n !isMemberPropertyNamed(unwrappedNode, \"ok\")\n ) {\n return null;\n }\n\n return {\n name: unwrappedNode.object.name,\n node: unwrappedNode.object,\n };\n}\n","// @ts-nocheck\nexport function isFailedOkComparison(operator, comparedValue) {\n return (\n (operator === \"===\" && comparedValue === false) ||\n (operator === \"!==\" && comparedValue === true)\n );\n}\n","// @ts-nocheck\nimport { getBooleanLiteralValue } from \"./get-boolean-literal-value\";\nimport { getOkMemberObject } from \"./get-ok-member-object\";\nimport { isFailedOkComparison } from \"./is-failed-ok-comparison\";\n\nexport function getFailedResultBinaryGuardName(node) {\n const leftResult = getOkMemberObject(node.left);\n const rightResult = getOkMemberObject(node.right);\n const leftBoolean = getBooleanLiteralValue(node.left);\n const rightBoolean = getBooleanLiteralValue(node.right);\n\n if (leftResult && rightBoolean !== null) {\n return isFailedOkComparison(node.operator, rightBoolean) ? leftResult : null;\n }\n\n if (rightResult && leftBoolean !== null) {\n return isFailedOkComparison(node.operator, leftBoolean) ? rightResult : null;\n }\n\n return null;\n}\n","// @ts-nocheck\nimport { isMemberPropertyNamed } from \"./is-member-property-named\";\nimport { unwrapExpression } from \"./unwrap-expression\";\n\n// Extrae el Result de una guarda con type-guard, p. ej. `Result.isErr(result)`\n// o `Result.isOk(result)`. Devuelve `{ name, node }` del argumento, o null.\nexport function getResultCheckArgument(node, methodName) {\n const unwrappedNode = unwrapExpression(node);\n\n if (\n unwrappedNode.type !== \"CallExpression\" ||\n unwrappedNode.callee.type !== \"MemberExpression\" ||\n !isMemberPropertyNamed(unwrappedNode.callee, methodName)\n ) {\n return null;\n }\n\n const argument = unwrappedNode.arguments[0];\n\n if (argument?.type !== \"Identifier\") {\n return null;\n }\n\n return { name: argument.name, node: argument };\n}\n","// @ts-nocheck\nimport { getErrorMemberObject } from \"./get-error-member-object\";\nimport { getFailedResultBinaryGuardName } from \"./get-failed-result-binary-guard-name\";\nimport { getOkMemberObject } from \"./get-ok-member-object\";\nimport { getResultCheckArgument } from \"./get-result-check-argument\";\nimport { unwrapExpression } from \"./unwrap-expression\";\n\nexport function getFailedResultGuard(node) {\n const unwrappedNode = unwrapExpression(node);\n\n // `result.error` como condición (truthiness del error)\n if (unwrappedNode.type === \"MemberExpression\") {\n return getErrorMemberObject(unwrappedNode);\n }\n\n // `!result.ok` o `!Result.isOk(result)`\n if (unwrappedNode.type === \"UnaryExpression\" && unwrappedNode.operator === \"!\") {\n return (\n getOkMemberObject(unwrappedNode.argument) ??\n getResultCheckArgument(unwrappedNode.argument, \"isOk\")\n );\n }\n\n // `Result.isErr(result)`\n if (unwrappedNode.type === \"CallExpression\") {\n return getResultCheckArgument(unwrappedNode, \"isErr\");\n }\n\n // `result.ok === false` / `result.ok !== true`\n if (\n unwrappedNode.type === \"BinaryExpression\" &&\n [\"===\", \"!==\"].includes(unwrappedNode.operator)\n ) {\n return getFailedResultBinaryGuardName(unwrappedNode);\n }\n\n return null;\n}\n","// @ts-nocheck\nimport { isMemberPropertyNamed } from \"./is-member-property-named\";\n\nexport function isResultErrCall(node) {\n // No se exige que el objeto se llame literalmente `Result`: un alias\n // (`import { Result as R }`) también vale. La identidad real (que provenga de\n // @skapxd/result) la verifica `isSkapxdResultErrCall` con el símbolo.\n return (\n node.callee.type === \"MemberExpression\" &&\n node.callee.object.type === \"Identifier\" &&\n isMemberPropertyNamed(node.callee, \"err\")\n );\n}\n","// @ts-nocheck\nimport { getNodeChildren } from \"./get-node-children\";\nimport { isAstNode } from \"./is-ast-node\";\nimport { isFunctionNode } from \"./is-function-node\";\nimport { isResultErrCall } from \"./is-result-err-call\";\n\nexport function getOwnResultErrCalls(node, isRoot = true) {\n if (!isAstNode(node)) {\n return [];\n }\n\n if (isFunctionNode(node) || (!isRoot && node.type === \"IfStatement\")) {\n return [];\n }\n\n const ownCalls =\n node.type === \"CallExpression\" && isResultErrCall(node) ? [node] : [];\n\n return [\n ...ownCalls,\n ...getNodeChildren(node).flatMap((child) => getOwnResultErrCalls(child, false)),\n ];\n}\n","// @ts-nocheck\nexport function getFunctionReturnType(node, typeContext) {\n if (node.returnType?.typeAnnotation) {\n return typeContext.services.getTypeFromTypeNode(node.returnType.typeAnnotation);\n }\n\n const functionType = typeContext.services.getTypeAtLocation(node);\n const signature = functionType.getCallSignatures()[0];\n\n return signature?.getReturnType() ?? null;\n}\n","// @ts-nocheck\nimport { getFunctionReturnType } from \"./get-function-return-type\";\nimport { isSkapxdResultOrPromiseResultType } from \"./is-skapxd-result-or-promise-result-type\";\n\nexport function functionReturnsSkapxdResultType(node, typeContext) {\n const returnType = getFunctionReturnType(node, typeContext);\n\n return Boolean(returnType && isSkapxdResultOrPromiseResultType(returnType, typeContext));\n}\n","// @ts-nocheck\nimport { functionReturnsSkapxdResultType } from \"./function-returns-skapxd-result-type\";\nimport { getContainingFunction } from \"./get-containing-function\";\n\nexport function isInsideSkapxdResultReturningFunction(node, typeContext) {\n const containingFunction = getContainingFunction(node);\n\n return Boolean(\n containingFunction &&\n functionReturnsSkapxdResultType(containingFunction, typeContext),\n );\n}\n","// @ts-nocheck\nimport { isResultErrCall } from \"./is-result-err-call\";\nimport { isSymbolFromSkapxdResult } from \"./is-symbol-from-skapxd-result\";\n\nexport function isSkapxdResultErrCall(node, typeContext) {\n if (!isResultErrCall(node)) {\n return false;\n }\n\n const symbol = typeContext.services.getSymbolAtLocation(node.callee.object);\n\n return Boolean(symbol && isSymbolFromSkapxdResult(symbol, typeContext));\n}\n","// @ts-nocheck\nimport { isSkapxdResultType } from \"./is-skapxd-result-type\";\n\nexport function isSkapxdResultExpression(node, typeContext) {\n return isSkapxdResultType(typeContext.services.getTypeAtLocation(node), typeContext);\n}\n","// @ts-nocheck\nimport { isMemberPropertyNamed } from \"./is-member-property-named\";\nimport { unwrapExpression } from \"./unwrap-expression\";\n\nexport function isResultErrorMember(node, resultName) {\n const unwrappedNode = unwrapExpression(node);\n\n return (\n unwrappedNode.type === \"MemberExpression\" &&\n unwrappedNode.object.type === \"Identifier\" &&\n unwrappedNode.object.name === resultName &&\n isMemberPropertyNamed(unwrappedNode, \"error\")\n );\n}\n","// @ts-nocheck\nimport { isPropertyKeyNamed } from \"./is-property-key-named\";\nimport { isResultErrorMember } from \"./is-result-error-member\";\nimport { unwrapExpression } from \"./unwrap-expression\";\n\nexport function resultErrPreservesCause(node, resultName) {\n const unwrappedNode = unwrapExpression(node);\n\n if (isResultErrorMember(unwrappedNode, resultName)) {\n return true;\n }\n\n if (unwrappedNode.type !== \"ObjectExpression\") {\n return false;\n }\n\n return unwrappedNode.properties.some((property) => {\n if (property.type !== \"Property\" || !isPropertyKeyNamed(property, \"cause\")) {\n return false;\n }\n\n return isResultErrorMember(property.value, resultName);\n });\n}\n","// @ts-nocheck\nimport { getFailedResultGuard } from \"#/utils/get-failed-result-guard\";\nimport { getOwnResultErrCalls } from \"#/utils/get-own-result-err-calls\";\nimport { getTypeContext } from \"#/utils/get-type-context\";\nimport { isInsideSkapxdResultReturningFunction } from \"#/utils/is-inside-skapxd-result-returning-function\";\nimport { isSkapxdResultErrCall } from \"#/utils/is-skapxd-result-err-call\";\nimport { isSkapxdResultExpression } from \"#/utils/is-skapxd-result-expression\";\nimport { resultErrPreservesCause } from \"#/utils/result-err-preserves-cause\";\n\nexport const resultErrorRequiresCause = {\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Exige preservar result.error como cause cuando una funcion que retorna Result transforma un Result fallido en Result.err.\",\n },\n messages: {\n missingCause:\n \"El error de `{{name}}` ya existe como `{{name}}.error`. Preservalo en Result.err con `cause: {{name}}.error`: la cadena de causas conecta el error de dominio con la excepcion original que capturo `trySafe`; sin ella el debugging pierde el contexto.\",\n },\n schema: [],\n },\n create(context) {\n const typeContext = getTypeContext(context);\n\n return {\n IfStatement(node) {\n const resultGuard = getFailedResultGuard(node.test);\n\n if (\n !typeContext ||\n !resultGuard ||\n !isSkapxdResultExpression(resultGuard.node, typeContext) ||\n !isInsideSkapxdResultReturningFunction(node, typeContext)\n ) {\n return;\n }\n\n for (const resultErrCall of getOwnResultErrCalls(node.consequent)) {\n if (!isSkapxdResultErrCall(resultErrCall, typeContext)) {\n continue;\n }\n\n // `Result.err()` sin argumentos descarta el error por completo:\n // es el peor caso, no una exención.\n if (\n resultErrCall.arguments.length > 0 &&\n resultErrPreservesCause(resultErrCall.arguments[0], resultGuard.name)\n ) {\n continue;\n }\n\n context.report({\n data: {\n name: resultGuard.name,\n },\n messageId: \"missingCause\",\n node: resultErrCall,\n });\n }\n },\n };\n },\n };\n","// @ts-nocheck\nimport { getNodeChildren } from \"./get-node-children\";\n\nexport function collectIdentifiersNamed(node, name, results = []) {\n if (node?.type === \"Identifier\" && node.name === name) {\n results.push(node);\n }\n\n for (const child of getNodeChildren(node)) {\n collectIdentifiersNamed(child, name, results);\n }\n\n return results;\n}\n","// @ts-nocheck\nexport function getResultErrorRequiresHandlingOptions(options = {}) {\n return {\n allowFilePatterns: options.allowFilePatterns ?? [],\n };\n}\n","// @ts-nocheck\nimport { isPropertyKeyNamed } from \"./is-property-key-named\";\n\n// Bindings que declara el lado izquierdo de un `const x = ...` y QUÉ\n// representa cada uno. Si lo asignado es el error, un destructuring lo\n// proyecta (pierde el cause) y no produce targets. Si es el result:\n// `{ error }` sigue como error, `...rest` sigue como result (aún lo carga),\n// y los demás bindings (`ok`, `value`) son proyecciones que no se siguen.\nexport function getDeclaredAliasTargets(id, represents) {\n if (id.type === \"Identifier\") {\n return [{ name: id.name, represents }];\n }\n\n if (id.type !== \"ObjectPattern\" || represents !== \"result\") {\n return [];\n }\n\n return id.properties.flatMap((property) => {\n if (property.type === \"RestElement\" && property.argument.type === \"Identifier\") {\n return [{ name: property.argument.name, represents: \"result\" }];\n }\n\n if (\n property.type === \"Property\" &&\n isPropertyKeyNamed(property, \"error\") &&\n property.value.type === \"Identifier\"\n ) {\n return [{ name: property.value.name, represents: \"error\" }];\n }\n\n return [];\n });\n}\n","// @ts-nocheck\nexport function isInsideNode(node, ancestor) {\n let current = node;\n\n while (current) {\n if (current === ancestor) {\n return true;\n }\n\n current = current.parent;\n }\n\n return false;\n}\n","// @ts-nocheck\nimport { collectIdentifiersNamed } from \"./collect-identifiers-named\";\nimport { getDeclaredAliasTargets } from \"./get-declared-alias-targets\";\nimport { isInsideNode } from \"./is-inside-node\";\nimport { isMemberPropertyNamed } from \"./is-member-property-named\";\n\n// ¿La referencia consume el error de verdad? El contrato:\n// - El ERROR debe fluir COMPLETO: `result.error` (o su alias) como argumento,\n// retorno o propiedad. Una proyección (`result.error.message`, `e.type`)\n// pierde el `cause` y NO cuenta — la UI puede leer el mensaje, pero el\n// objeto entero tiene que salir hacia alguna parte.\n// - El result completo (`return result`, `fn(result)`) también vale: el\n// error viaja adentro.\n// - Descartes no cuentan: `void x`, expresión suelta, alias nunca consumido\n// (se siguen recursivamente, destructuring incluido).\nexport function isConsumedResultReference(\n identifier,\n searchRoot,\n represents = \"result\",\n visited = new Set(),\n) {\n const member =\n identifier.parent?.type === \"MemberExpression\" &&\n identifier.parent.object === identifier\n ? identifier.parent\n : null;\n\n // Cualquier acceso sobre el error es proyección; sobre el result, solo\n // `.error` mantiene la información completa (`.ok`/`.value` la pierden).\n if (member && represents === \"error\") {\n return false;\n }\n\n if (member && !isMemberPropertyNamed(member, \"error\")) {\n return false;\n }\n\n const reference = member ?? identifier;\n const referenceRepresents = member ? \"error\" : represents;\n const parent = reference.parent;\n\n // `result.error.message`: proyección encadenada sobre el error.\n if (parent?.type === \"MemberExpression\" && parent.object === reference) {\n return false;\n }\n\n if (parent?.type === \"UnaryExpression\" && parent.operator === \"void\") {\n return false;\n }\n\n if (parent?.type === \"ExpressionStatement\") {\n return false;\n }\n\n if (parent?.type !== \"VariableDeclarator\" || parent.init !== reference) {\n return true;\n }\n\n const targets = getDeclaredAliasTargets(parent.id, referenceRepresents).filter(\n (target) => !visited.has(target.name),\n );\n\n return targets.some((target) => {\n visited.add(target.name);\n\n return collectIdentifiersNamed(searchRoot, target.name)\n .filter((aliasReference) => !isInsideNode(aliasReference, parent.id))\n .some((aliasReference) =>\n isConsumedResultReference(\n aliasReference,\n searchRoot,\n target.represents,\n visited,\n ),\n );\n });\n}\n","// @ts-nocheck\nimport { collectIdentifiersNamed } from \"#/utils/collect-identifiers-named\";\nimport { getFailedResultGuard } from \"#/utils/get-failed-result-guard\";\nimport { getResultErrorRequiresHandlingOptions } from \"#/utils/get-result-error-requires-handling-options\";\nimport { getTypeContext } from \"#/utils/get-type-context\";\nimport { isConsumedResultReference } from \"#/utils/is-consumed-result-reference\";\nimport { isSkapxdResultExpression } from \"#/utils/is-skapxd-result-expression\";\nimport { matchesAnyGlob } from \"#/utils/matches-any-glob\";\n\nexport const resultErrorRequiresHandling = {\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Prohibe descartar en silencio un Result fallido: el error se transforma o se entrega, nunca se ignora.\",\n },\n messages: {\n unhandledResultError:\n \"El guard detecta que `{{name}}` fallo, pero `{{name}}.error` no fluye COMPLETO a ninguna parte. Transformalo (`Result.err({ cause: {{name}}.error, ... })`), entrega el objeto entero a alguien (`reportDomainError({{name}}.error)`) o propaga el result completo. Una proyeccion (`{{name}}.error.message`) no basta: el `cause` se pierde justo en la ultima milla. La UI puede leer el mensaje, pero ADEMAS el error entero debe salir hacia el trace.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowFilePatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getResultErrorRequiresHandlingOptions(context.options[0]);\n const filename = context.filename ?? context.getFilename();\n const typeContext = getTypeContext(context);\n\n if (matchesAnyGlob(filename, options.allowFilePatterns)) {\n return {};\n }\n\n return {\n IfStatement(node) {\n const resultGuard = getFailedResultGuard(node.test);\n\n if (\n !typeContext ||\n !resultGuard ||\n !isSkapxdResultExpression(resultGuard.node, typeContext)\n ) {\n return;\n }\n\n const references = collectIdentifiersNamed(\n node.consequent,\n resultGuard.name,\n );\n\n if (\n references.some((reference) =>\n isConsumedResultReference(reference, node.consequent),\n )\n ) {\n return;\n }\n\n context.report({\n data: { name: resultGuard.name },\n messageId: \"unhandledResultError\",\n node: node.test,\n });\n },\n };\n },\n};\n","// @ts-nocheck\nimport { getNodeChildren } from \"./get-node-children\";\nimport { isAstNode } from \"./is-ast-node\";\nimport { isCalleeNamed } from \"./is-callee-named\";\nimport { isFunctionNode } from \"./is-function-node\";\n\nexport function countOwnUseStateCallsInNode(node) {\n if (!isAstNode(node)) {\n return 0;\n }\n\n if (isFunctionNode(node)) {\n return 0;\n }\n\n const ownCount =\n node.type === \"CallExpression\" && isCalleeNamed(node.callee, [\"useState\"])\n ? 1\n : 0;\n\n return ownCount + getNodeChildren(node).reduce(\n (total, child) => total + countOwnUseStateCallsInNode(child),\n 0,\n );\n}\n","// @ts-nocheck\nimport { countOwnUseStateCallsInNode } from \"./count-own-use-state-calls-in-node\";\nimport { isAstNode } from \"./is-ast-node\";\n\nexport function countOwnUseStateCalls(node) {\n const body = node.body;\n\n return isAstNode(body) ? countOwnUseStateCallsInNode(body) : 0;\n}\n","// @ts-nocheck\nexport function getFunctionLineCount(node) {\n return node.loc ? node.loc.end.line - node.loc.start.line + 1 : 0;\n}\n","// @ts-nocheck\nexport function getMaxHookSizeOptions(options = {}) {\n return {\n maxLines: options.maxLines ?? 120,\n maxUseState: options.maxUseState ?? 1,\n };\n}\n","// @ts-nocheck\nexport function isHookName(name) {\n return /^use[A-Z0-9]/.test(name ?? \"\");\n}\n","// @ts-nocheck\nimport { countOwnUseStateCalls } from \"#/utils/count-own-use-state-calls\";\nimport { getFunctionExpressionName } from \"#/utils/get-function-expression-name\";\nimport { getFunctionLineCount } from \"#/utils/get-function-line-count\";\nimport { getMaxHookSizeOptions } from \"#/utils/get-max-hook-size-options\";\nimport { getParentFunctionName } from \"#/utils/get-parent-function-name\";\nimport { getParentFunctionReportNode } from \"#/utils/get-parent-function-report-node\";\nimport { isHookName } from \"#/utils/is-hook-name\";\n\nexport const maxHookSize = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Limita el tamaño y cantidad de estados propios en hooks React.\",\n },\n messages: {\n tooLargeHook:\n \"El hook `{{name}}` es demasiado grande: tiene {{lines}} lineas. Maximo permitido: {{maxLines}} lineas. Extrae efectos, handlers o flujos a hooks/archivos semanticos.\",\n tooManyUseState:\n \"El hook `{{name}}` declara {{useStateCount}} useState. Maximo permitido: {{maxUseState}}. Usa useReducer con acciones semanticas cuando varios campos cambian juntos, o extrae estado a hooks especializados.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n maxLines: { type: \"number\" },\n maxUseState: { type: \"number\" },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getMaxHookSizeOptions(context.options[0]);\n\n function reportIfOversizedHook(node, name, reportNode = node) {\n if (!isHookName(name)) {\n return;\n }\n\n const lines = getFunctionLineCount(node);\n const useStateCount = countOwnUseStateCalls(node);\n\n if (lines > options.maxLines) {\n context.report({\n data: {\n lines: String(lines),\n maxLines: String(options.maxLines),\n name,\n },\n messageId: \"tooLargeHook\",\n node: reportNode,\n });\n }\n\n if (useStateCount > options.maxUseState) {\n context.report({\n data: {\n maxUseState: String(options.maxUseState),\n name,\n useStateCount: String(useStateCount),\n },\n messageId: \"tooManyUseState\",\n node: reportNode,\n });\n }\n }\n\n return {\n ArrowFunctionExpression(node) {\n reportIfOversizedHook(\n node,\n getParentFunctionName(node),\n getParentFunctionReportNode(node),\n );\n },\n FunctionDeclaration(node) {\n reportIfOversizedHook(node, node.id?.name, node.id ?? node);\n },\n FunctionExpression(node) {\n reportIfOversizedHook(\n node,\n getFunctionExpressionName(node),\n getParentFunctionReportNode(node),\n );\n },\n };\n },\n };\n","export function countParentSegments(source: string): number {\n let count = 0;\n\n for (const part of source.split(\"/\")) {\n if (part === \"..\") {\n count += 1;\n continue;\n }\n\n if (part === \".\") {\n continue;\n }\n\n break;\n }\n\n return count;\n}\n","// @ts-nocheck\nimport { countParentSegments } from \"#/utils/count-parent-segments\";\n\nexport const noDeepRelativeImports = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Limita la profundidad de los imports relativos (`../`). Empuja hacia estructuras planas o alias de ruta.\",\n },\n messages: {\n deepRelativeImport:\n \"El import `{{source}}` sube {{depth}} niveles con `../`. Maximo permitido: {{maxDepth}}. Usa un alias de ruta (ej. `@/...`) o acerca el modulo a quien lo usa.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n maxDepth: { type: \"number\" },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const maxDepth = context.options[0]?.maxDepth ?? 0;\n\n function reportIfTooDeep(source) {\n if (!source || typeof source.value !== \"string\") {\n return;\n }\n\n const depth = countParentSegments(source.value);\n\n if (depth <= maxDepth) {\n return;\n }\n\n context.report({\n data: {\n depth: String(depth),\n maxDepth: String(maxDepth),\n source: source.value,\n },\n messageId: \"deepRelativeImport\",\n node: source,\n });\n }\n\n return {\n ExportAllDeclaration(node) {\n reportIfTooDeep(node.source);\n },\n ExportNamedDeclaration(node) {\n reportIfTooDeep(node.source);\n },\n ImportDeclaration(node) {\n reportIfTooDeep(node.source);\n },\n ImportExpression(node) {\n reportIfTooDeep(node.source);\n },\n };\n },\n};\n","// @ts-nocheck\n// Archivos donde el ecosistema EXIGE `export default` y la regla\n// no-default-export no debe reportar nunca: configs de tooling\n// (next.config, tailwind.config, vitest.config, eslint.config, ...) y\n// stories de Storybook (el meta es un default export por contrato CSF).\n// Son GLOBS, no regex: `*` = un segmento, `**` = cualquier profundidad.\nexport const defaultExportAllowedFilePatterns = [\n \"*.config.*\",\n \"*.stories.*\",\n];\n","// @ts-nocheck\nimport { defaultExportAllowedFilePatterns } from \"#/constants/default-export-allowed-file-patterns\";\n\n// allowFilePatterns es ADITIVO: los patrones del consumidor se suman a los\n// integrados. Así, cuando aparezca un framework o tool que la regla aún no\n// contempla, basta con agregar su patrón sin perder los conocidos.\nexport function getNoDefaultExportOptions(options = {}) {\n return {\n allowFilePatterns: [\n ...defaultExportAllowedFilePatterns,\n ...(options.allowFilePatterns ?? []),\n ],\n };\n}\n","// @ts-nocheck\nimport { getNoDefaultExportOptions } from \"#/utils/get-no-default-export-options\";\nimport { matchesAnyGlob } from \"#/utils/matches-any-glob\";\n\nexport const noDefaultExport = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prohibe export default; un export nombrado hace del nombre el contrato del modulo.\",\n },\n messages: {\n noDefaultExport:\n \"No uses `export default`: un export nombrado hace el simbolo renombrable con el IDE, grepeable y estable en autoimports. Si este archivo es un entrypoint donde un framework o tool exige el default, agrega su glob en `allowFilePatterns` de skapxd/no-default-export (p. ej. \\\"+page.ts\\\").\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowFilePatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getNoDefaultExportOptions(context.options[0]);\n const filename = context.filename ?? context.getFilename();\n\n if (matchesAnyGlob(filename, options.allowFilePatterns)) {\n return {};\n }\n\n return {\n ExportDefaultDeclaration(node) {\n context.report({ messageId: \"noDefaultExport\", node });\n },\n // Cubre la forma indirecta: `export { algo as default }`.\n ExportNamedDeclaration(node) {\n for (const specifier of node.specifiers ?? []) {\n const exportedName =\n specifier.exported?.name ?? specifier.exported?.value;\n\n if (exportedName === \"default\") {\n context.report({ messageId: \"noDefaultExport\", node: specifier });\n }\n }\n },\n };\n },\n};\n","// @ts-nocheck\n// Detección por propiedad Unicode: Extended_Pictographic cubre los emojis y\n// pictogramas (🚀, ✅, 😄) sin tocar símbolos de texto normales (→, ✓, ©).\nconst emojiPattern = /\\p{Extended_Pictographic}/u;\n\nexport function containsEmoji(value) {\n return emojiPattern.test(value);\n}\n","// @ts-nocheck\nexport function getNoEmojiOptions(options = {}) {\n return {\n allowFilePatterns: options.allowFilePatterns ?? [],\n };\n}\n","// @ts-nocheck\nimport { containsEmoji } from \"#/utils/contains-emoji\";\nimport { getNoEmojiOptions } from \"#/utils/get-no-emoji-options\";\nimport { matchesAnyGlob } from \"#/utils/matches-any-glob\";\n\nexport const noEmoji = {\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Prohibe emojis en strings y JSX; cada sistema los renderiza distinto (o no los renderiza).\",\n },\n messages: {\n noEmoji:\n \"No uses emojis en el codigo: se renderizan con la fuente del sistema del usuario, distinta en cada plataforma (y ausente en algunos Linux, donde sale un cuadro vacio). Reemplazalo por un icono SVG con el mismo significado (p. ej. lucide-react) o un asset SVG propio.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowFilePatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getNoEmojiOptions(context.options[0]);\n const filename = context.filename ?? context.getFilename();\n\n if (matchesAnyGlob(filename, options.allowFilePatterns)) {\n return {};\n }\n\n function reportIfEmoji(node, value) {\n if (typeof value === \"string\" && containsEmoji(value)) {\n context.report({ messageId: \"noEmoji\", node });\n }\n }\n\n return {\n JSXText(node) {\n reportIfEmoji(node, node.value);\n },\n Literal(node) {\n reportIfEmoji(node, node.value);\n },\n TemplateElement(node) {\n reportIfEmoji(node, node.value.raw);\n },\n };\n },\n};\n","// @ts-nocheck\nexport function getNoTunnelPropsOptions(options = {}) {\n return {\n allowFilePatterns: options.allowFilePatterns ?? [],\n // Regex de nombres de prop que sí pueden reenviarse (p. ej.\n // [\"^className$\", \"^style$\"] en wrappers de un design system).\n allowPropPatterns: options.allowPropPatterns ?? [],\n };\n}\n","// @ts-nocheck\n// Extrae los nombres de props destructuradas del primer parámetro de un\n// componente: `({ game, variant, ...rest })` → { propNames, restName }.\n// Solo cuenta los shorthand (`{ game }`); un rename (`{ game: g }`) se omite.\nexport function getObjectPatternPropNames(pattern) {\n const result = { propNames: [], restName: null };\n\n if (pattern?.type !== \"ObjectPattern\") {\n return result;\n }\n\n for (const property of pattern.properties) {\n if (property.type === \"RestElement\" && property.argument.type === \"Identifier\") {\n result.restName = property.argument.name;\n continue;\n }\n\n if (\n property.type === \"Property\" &&\n property.key.type === \"Identifier\" &&\n property.value.type === \"Identifier\" &&\n property.key.name === property.value.name\n ) {\n result.propNames.push(property.key.name);\n }\n }\n\n return result;\n}\n","// @ts-nocheck\nimport { isPascalCaseName } from \"./is-pascal-case-name\";\n\n// `<Child ... />` es un componente propio; `<button ... />` es la frontera\n// con el DOM. Solo el primero cuenta para las reglas de prop drilling.\nexport function isPascalCaseJsxElement(openingElement) {\n return (\n openingElement?.type === \"JSXOpeningElement\" &&\n openingElement.name?.type === \"JSXIdentifier\" &&\n isPascalCaseName(openingElement.name.name)\n );\n}\n","// @ts-nocheck\nimport { isPascalCaseJsxElement } from \"./is-pascal-case-jsx-element\";\n\n// La referencia es el valor directo de una prop hacia un componente\n// PascalCase (`game={game}`, `handler={onSelect}`): un reenvío, sin importar\n// el nombre del atributo. Reenviar a un elemento nativo (`value={value}` en\n// un <input>) es uso real, no reenvío.\nexport function isForwardedPropReference(identifier) {\n const container = identifier.parent;\n\n if (container?.type !== \"JSXExpressionContainer\") {\n return false;\n }\n\n const attribute = container.parent;\n\n if (attribute?.type !== \"JSXAttribute\") {\n return false;\n }\n\n return isPascalCaseJsxElement(attribute.parent);\n}\n","// @ts-nocheck\nimport { collectIdentifiersNamed } from \"#/utils/collect-identifiers-named\";\nimport { getFunctionName } from \"#/utils/get-function-name\";\nimport { getNoTunnelPropsOptions } from \"#/utils/get-no-tunnel-props-options\";\nimport { getObjectPatternPropNames } from \"#/utils/get-object-pattern-prop-names\";\nimport { isForwardedPropReference } from \"#/utils/is-forwarded-prop-reference\";\nimport { isPascalCaseJsxElement } from \"#/utils/is-pascal-case-jsx-element\";\nimport { isPascalCaseName } from \"#/utils/is-pascal-case-name\";\nimport { matchesAnyGlob } from \"#/utils/matches-any-glob\";\nimport { matchesAnyPattern } from \"#/utils/matches-any-pattern\";\n\nexport const noTunnelProps = {\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Ninguna prop viaja mas de un nivel: quien la recibe no puede reenviarla a otro componente.\",\n },\n messages: {\n forwardedProp:\n \"La prop `{{prop}}` que `{{component}}` recibe se reenvia a otro componente: ya va por su segundo salto (abuelo -> padre -> hijo). Quien CREA un valor puede pasarlo UN nivel; quien lo recibe no lo reenvia. Mueve el estado/accion a un store global (p. ej. zustand) o a un custom hook y consumelo donde se usa, o deja que el padre componga el JSX (`children`).\",\n spreadTunnel:\n \"`{{component}}` reenvia TODAS sus props con `{...{{name}}}` a otro componente: es un tunel puro. Mueve el estado a un store global (p. ej. zustand) o a un custom hook, o deja que el padre componga el JSX (`children`).\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowFilePatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n allowPropPatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getNoTunnelPropsOptions(context.options[0]);\n const filename = context.filename ?? context.getFilename();\n\n if (matchesAnyGlob(filename, options.allowFilePatterns)) {\n return {};\n }\n\n function reportSpreadTunnel(node, componentName, restName) {\n const spreads = collectIdentifiersNamed(node.body, restName).filter(\n (identifier) =>\n identifier.parent?.type === \"JSXSpreadAttribute\" &&\n isPascalCaseJsxElement(identifier.parent.parent),\n );\n\n if (spreads.length > 0) {\n context.report({\n data: { component: componentName, name: restName },\n messageId: \"spreadTunnel\",\n node: spreads[0].parent,\n });\n }\n }\n\n function reportForwardedProps(node, componentName, propNames) {\n for (const propName of propNames) {\n if (matchesAnyPattern(propName, options.allowPropPatterns)) {\n continue;\n }\n\n for (const usage of collectIdentifiersNamed(node.body, propName)) {\n if (isForwardedPropReference(usage)) {\n context.report({\n data: { component: componentName, prop: propName },\n messageId: \"forwardedProp\",\n node: usage.parent.parent,\n });\n }\n }\n }\n }\n\n function reportIfTunnelComponent(node) {\n const componentName = getFunctionName(node);\n\n if (!isPascalCaseName(componentName)) {\n return;\n }\n\n const { propNames, restName } = getObjectPatternPropNames(node.params[0]);\n\n if (restName) {\n reportSpreadTunnel(node, componentName, restName);\n }\n\n reportForwardedProps(node, componentName, propNames);\n }\n\n return {\n ArrowFunctionExpression: reportIfTunnelComponent,\n FunctionDeclaration: reportIfTunnelComponent,\n FunctionExpression: reportIfTunnelComponent,\n };\n },\n};\n","// @ts-nocheck\n// Los callbacks inline de JSX y de .map son React idiomático: permitidos por\n// defecto. El modo ultraestricto se activa pasando `false` explícito.\nexport function getNoFunctionsInsideComponentsOptions(options = {}) {\n return {\n allowArrayMapCallbacks: options.allowArrayMapCallbacks ?? true,\n allowJsxCallbacks: options.allowJsxCallbacks ?? true,\n };\n}\n","// @ts-nocheck\n// `items.map((item) => <Item ... />)`: la función es el primer argumento de\n// una llamada `.map(...)`.\nexport function isArrayMapCallback(node) {\n const parent = node.parent;\n\n if (parent?.type !== \"CallExpression\" || parent.arguments[0] !== node) {\n return false;\n }\n\n const callee = parent.callee;\n\n return (\n callee?.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property?.type === \"Identifier\" &&\n callee.property.name === \"map\"\n );\n}\n","// @ts-nocheck\n// Una flecha \"de expresión\": sin cuerpo de bloque. Solo puede contener una\n// expresión (JSX, una llamada), así que es declarativa por construcción. Un\n// cuerpo con llaves (`=> { return ... }`) ya da pie a ifs, variables y lógica\n// — eso debe vivir fuera del componente. Las function expressions siempre\n// tienen bloque, así que nunca califican.\nexport function isExpressionArrowFunction(node) {\n return (\n node.type === \"ArrowFunctionExpression\" &&\n node.body.type !== \"BlockStatement\"\n );\n}\n","// @ts-nocheck\n// `<button onClick={() => ...} />`: la función es el valor directo de una\n// prop JSX (ArrowFunction → JSXExpressionContainer → JSXAttribute).\nexport function isJsxAttributeCallback(node) {\n return (\n node.parent?.type === \"JSXExpressionContainer\" &&\n node.parent.parent?.type === \"JSXAttribute\"\n );\n}\n","// @ts-nocheck\nimport { getContainingFunction } from \"#/utils/get-containing-function\";\nimport { getFunctionName } from \"#/utils/get-function-name\";\nimport { getNoFunctionsInsideComponentsOptions } from \"#/utils/get-no-functions-inside-components-options\";\nimport { isArrayMapCallback } from \"#/utils/is-array-map-callback\";\nimport { isExpressionArrowFunction } from \"#/utils/is-expression-arrow-function\";\nimport { isFunctionNode } from \"#/utils/is-function-node\";\nimport { isJsxAttributeCallback } from \"#/utils/is-jsx-attribute-callback\";\nimport { isPascalCaseName } from \"#/utils/is-pascal-case-name\";\n\nexport const noFunctionsInsideComponents = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prohibe definir funciones dentro de componentes React; se recrean en cada render.\",\n },\n messages: {\n functionInsideComponent:\n \"No definas funciones dentro del componente `{{component}}`: se recrean en cada render. Muevela a un hook (`useX`) o a un helper fuera del componente. Los callbacks inline de JSX y .map solo se permiten como flecha de expresion (sin cuerpo `{ }`): un bloque ya da pie a ifs y logica que pertenece fuera.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowArrayMapCallbacks: { type: \"boolean\" },\n allowJsxCallbacks: { type: \"boolean\" },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getNoFunctionsInsideComponentsOptions(context.options[0]);\n\n function isComponentFunction(node) {\n return isFunctionNode(node) && isPascalCaseName(getFunctionName(node));\n }\n\n function isAllowedInlineCallback(node) {\n if (!isExpressionArrowFunction(node)) {\n return false;\n }\n\n if (options.allowJsxCallbacks && isJsxAttributeCallback(node)) {\n return true;\n }\n\n return options.allowArrayMapCallbacks && isArrayMapCallback(node);\n }\n\n function reportIfInsideComponent(node) {\n const enclosingFunction = getContainingFunction(node);\n\n if (!enclosingFunction || !isComponentFunction(enclosingFunction)) {\n return;\n }\n\n if (isAllowedInlineCallback(node)) {\n return;\n }\n\n context.report({\n data: {\n component: getFunctionName(enclosingFunction),\n },\n messageId: \"functionInsideComponent\",\n node,\n });\n }\n\n return {\n ArrowFunctionExpression: reportIfInsideComponent,\n FunctionDeclaration: reportIfInsideComponent,\n FunctionExpression: reportIfInsideComponent,\n };\n },\n};\n","// @ts-nocheck\nexport const noTryCatch = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prohibe try/catch; usa trySafe de @skapxd/result para modelar el error como Result.\",\n },\n messages: {\n noTryCatch:\n \"Usa `trySafe` de @skapxd/result en lugar de try/catch: el error queda modelado como Result en vez de saltar como excepcion. Luego mapealo a un error de dominio `{ type, message, cause }` y consumelo con `match()` de ts-pattern.\",\n },\n schema: [],\n },\n create(context) {\n return {\n TryStatement(node) {\n context.report({\n messageId: \"noTryCatch\",\n node,\n });\n },\n };\n },\n};\n","// @ts-nocheck\nexport function getPreferAbortSignalOptions(options = {}) {\n return {\n allowFilePatterns: options.allowFilePatterns ?? [],\n effectNames: options.effectNames ?? [\"useEffect\", \"useLayoutEffect\"],\n };\n}\n","// @ts-nocheck\n// Resuelve un Identifier hasta el inicializador de su declaración subiendo\n// por la cadena de scopes (`const opts = {...}` → el ObjectExpression).\n// Devuelve null si la variable no se declara aquí (parámetro, import).\nexport function getVariableInitializer(identifier, scope) {\n let current = scope;\n\n while (current) {\n const variable = current.variables.find(\n (candidate) => candidate.name === identifier.name,\n );\n\n if (variable) {\n const definition = variable.defs[0];\n\n return definition?.node?.type === \"VariableDeclarator\"\n ? definition.node.init\n : null;\n }\n\n current = current.upper;\n }\n\n return null;\n}\n","// @ts-nocheck\nimport { isPropertyKeyNamed } from \"./is-property-key-named\";\n\n// ¿El objeto literal de options trae `signal`? Un spread dentro del objeto\n// recibe el beneficio de la duda (puede aportar el signal).\nexport function objectExpressionHasSignal(objectExpression) {\n return objectExpression.properties.some(\n (property) =>\n property.type === \"SpreadElement\" ||\n isPropertyKeyNamed(property, \"signal\"),\n );\n}\n","// @ts-nocheck\nimport { getVariableInitializer } from \"./get-variable-initializer\";\nimport { objectExpressionHasSignal } from \"./object-expression-has-signal\";\n\n// addEventListener(type, listener, options): ¿las options traen `signal`?\n// Resolución en capas: objeto literal → inspección directa; identifier →\n// se sigue hasta su inicializador en el scope; sin inicializador → el type\n// checker pregunta si el TIPO declara `signal` (si ni el tipo la tiene, es\n// imposible que llegue); sin tipos → beneficio de la duda.\nexport function hasAbortSignalOption(callExpression, sourceCode, typeContext) {\n const options = callExpression.arguments[2];\n\n if (!options) {\n return false;\n }\n\n // `addEventListener(\"x\", fn, true)`: el boolean de capture nunca trae signal.\n if (options.type === \"Literal\") {\n return false;\n }\n\n if (options.type === \"ObjectExpression\") {\n return objectExpressionHasSignal(options);\n }\n\n const initializer =\n options.type === \"Identifier\"\n ? getVariableInitializer(options, sourceCode.getScope(options))\n : null;\n\n if (initializer?.type === \"ObjectExpression\") {\n return objectExpressionHasSignal(initializer);\n }\n\n if (typeContext) {\n const type = typeContext.services.getTypeAtLocation(options);\n\n return Boolean(typeContext.checker.getPropertyOfType(type, \"signal\"));\n }\n\n return true;\n}\n","// @ts-nocheck\nimport { isCalleeNamed } from \"./is-callee-named\";\nimport { isFunctionNode } from \"./is-function-node\";\n\n// ¿El nodo vive dentro del callback de un useEffect/useLayoutEffect?\n// Cubre también las funciones anidadas (handlers y el cleanup retornado).\nexport function isInsideEffectCallback(node, effectNames) {\n let current = node.parent;\n\n while (current) {\n const call = isFunctionNode(current) ? current.parent : null;\n\n if (\n call?.type === \"CallExpression\" &&\n call.arguments[0] === current &&\n isCalleeNamed(call.callee, effectNames)\n ) {\n return true;\n }\n\n current = current.parent;\n }\n\n return false;\n}\n","// @ts-nocheck\nimport { getPreferAbortSignalOptions } from \"#/utils/get-prefer-abort-signal-options\";\nimport { getTypeContext } from \"#/utils/get-type-context\";\nimport { hasAbortSignalOption } from \"#/utils/has-abort-signal-option\";\nimport { isInsideEffectCallback } from \"#/utils/is-inside-effect-callback\";\nimport { isMemberPropertyNamed } from \"#/utils/is-member-property-named\";\nimport { matchesAnyGlob } from \"#/utils/matches-any-glob\";\n\nexport const preferAbortSignal = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"En efectos de React, los listeners se limpian con AbortController, no con removeEventListener.\",\n },\n messages: {\n addWithoutSignal:\n \"Este addEventListener vive en un efecto sin `signal`. Crea `const controller = new AbortController()`, pasa `{ signal: controller.signal }` como tercer argumento y limpia con `return () => controller.abort()`: un solo abort cubre todos los listeners del efecto.\",\n removeInsteadOfAbort:\n \"No quites listeners a mano en el cleanup: registra con `{ signal: controller.signal }` y reemplaza este removeEventListener por `return () => controller.abort()`. Evita el bug clasico de pasar una referencia distinta al remover.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowFilePatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n effectNames: {\n items: { type: \"string\" },\n type: \"array\",\n },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getPreferAbortSignalOptions(context.options[0]);\n const filename = context.filename ?? context.getFilename();\n const sourceCode = context.sourceCode ?? context.getSourceCode();\n const typeContext = getTypeContext(context);\n\n if (matchesAnyGlob(filename, options.allowFilePatterns)) {\n return {};\n }\n\n return {\n CallExpression(node) {\n if (node.callee?.type !== \"MemberExpression\") {\n return;\n }\n\n const isAdd = isMemberPropertyNamed(node.callee, \"addEventListener\");\n const isRemove = isMemberPropertyNamed(node.callee, \"removeEventListener\");\n\n if (!isAdd && !isRemove) {\n return;\n }\n\n if (!isInsideEffectCallback(node, options.effectNames)) {\n return;\n }\n\n if (isRemove) {\n context.report({ messageId: \"removeInsteadOfAbort\", node });\n return;\n }\n\n if (!hasAbortSignalOption(node, sourceCode, typeContext)) {\n context.report({ messageId: \"addWithoutSignal\", node });\n }\n },\n };\n },\n};\n","// @ts-nocheck\nexport const preferTsPattern = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prefiere match() de ts-pattern sobre switch/case y ternarios anidados.\",\n },\n messages: {\n noSwitch:\n \"Usa `match()` de ts-pattern en lugar de switch/case para un control de flujo exhaustivo y tipado. Es la pieza que cierra el sistema de errores: un Result con errores `{ type: ... }` se consume con una rama `.with()` por variante y `.exhaustive()` garantiza que ninguna quede sin manejar.\",\n noNestedTernary:\n \"Usa `match()` de ts-pattern en lugar de ternarios anidados; mejora la legibilidad y `.exhaustive()` obliga a cubrir todos los casos.\",\n },\n schema: [],\n },\n create(context) {\n return {\n ConditionalExpression(node) {\n if (node.parent?.type === \"ConditionalExpression\") {\n context.report({\n messageId: \"noNestedTernary\",\n node,\n });\n }\n },\n SwitchStatement(node) {\n context.report({\n messageId: \"noSwitch\",\n node,\n });\n },\n };\n },\n};\n","// @ts-nocheck\nexport const noJsxTernaryNull = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prefiere `condicion && <Elemento />` sobre un ternario con `null` al renderizar JSX.\",\n },\n messages: {\n preferLogicalAnd:\n \"Usa `condicion && elemento` en lugar de un ternario con `null` para renderizar JSX condicional.\",\n },\n schema: [],\n },\n create(context) {\n function isNullLiteral(node) {\n return node?.type === \"Literal\" && node.value === null;\n }\n\n return {\n ConditionalExpression(node) {\n const container = node.parent;\n\n if (container?.type !== \"JSXExpressionContainer\") {\n return;\n }\n\n const host = container.parent;\n\n if (host?.type !== \"JSXElement\" && host?.type !== \"JSXFragment\") {\n return;\n }\n\n if (!isNullLiteral(node.alternate) && !isNullLiteral(node.consequent)) {\n return;\n }\n\n context.report({\n messageId: \"preferLogicalAnd\",\n node,\n });\n },\n };\n },\n};\n","// @ts-nocheck\nexport function getNoNestedIfOptions(options = {}) {\n return {\n allowFilePatterns: options.allowFilePatterns ?? [],\n };\n}\n","// @ts-nocheck\nimport { isFunctionNode } from \"./is-function-node\";\n\n// ¿Este if vive dentro de otro if de la MISMA función? El eslabón directo de\n// un `else if` no cuenta (es cadena, no anidación) — si la cadena entera está\n// dentro de otro if, el reporte cae sobre su cabeza, una sola vez. Una\n// función definida dentro de un if es una unidad cognitiva aparte.\nexport function isNestedIfStatement(node) {\n if (node.parent?.type === \"IfStatement\" && node.parent.alternate === node) {\n return false;\n }\n\n let current = node.parent;\n\n while (current && !isFunctionNode(current)) {\n if (current.type === \"IfStatement\") {\n return true;\n }\n\n current = current.parent;\n }\n\n return false;\n}\n","// @ts-nocheck\nimport { getNoNestedIfOptions } from \"#/utils/get-no-nested-if-options\";\nimport { isNestedIfStatement } from \"#/utils/is-nested-if-statement\";\nimport { matchesAnyGlob } from \"#/utils/matches-any-glob\";\n\nexport const noNestedIf = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prohibe if anidados; usa retorno anticipado (guard clauses) o match() de ts-pattern.\",\n },\n messages: {\n noNestedIf:\n \"No anides un if dentro de otro: cada nivel suma carga cognitiva y crea puntos ciegos para las demas reglas. Aplana con retorno anticipado (`if (!x) return ...;` y sigue el camino feliz) o decide con `match()` de ts-pattern si son variantes de un mismo valor.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowFilePatterns: {\n items: { type: \"string\" },\n type: \"array\",\n },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const options = getNoNestedIfOptions(context.options[0]);\n const filename = context.filename ?? context.getFilename();\n\n if (matchesAnyGlob(filename, options.allowFilePatterns)) {\n return {};\n }\n\n return {\n IfStatement(node) {\n if (isNestedIfStatement(node)) {\n context.report({ messageId: \"noNestedIf\", node });\n }\n },\n };\n },\n};\n","// @ts-nocheck\nexport function isPromiseType(type, typeContext) {\n return typeContext.checker.getPromisedTypeOfPromise(type) !== undefined;\n}\n","// @ts-nocheck\nimport { getTypeContext } from \"#/utils/get-type-context\";\nimport { isMemberPropertyNamed } from \"#/utils/is-member-property-named\";\nimport { isPromiseType } from \"#/utils/is-promise-type\";\n\nconst defaultMethods = [\"catch\", \"finally\", \"then\"];\n\nexport const noPromiseChain = {\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Prohibe encadenar .then/.catch/.finally en promesas; usa await (envuelto en trySafe).\",\n },\n messages: {\n noPromiseChain:\n \"No encadenes `.{{method}}()` en una promesa. La unica forma de tratar funciones asincronas es `await`: o la funcion llamada ya retorna Promise<Result<...>> o envuelve la llamada en `trySafe` de @skapxd/result.\",\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n methods: {\n items: { type: \"string\" },\n type: \"array\",\n },\n },\n type: \"object\",\n },\n ],\n },\n create(context) {\n const methods = context.options[0]?.methods ?? defaultMethods;\n const typeContext = getTypeContext(context);\n\n return {\n CallExpression(node) {\n const callee = node.callee;\n\n if (callee.type !== \"MemberExpression\") {\n return;\n }\n\n const method = methods.find((name) => isMemberPropertyNamed(callee, name));\n\n if (!method) {\n return;\n }\n\n // type-aware: solo si el receptor es una promesa. Sin info de tipos\n // (projectService apagado) cae a verificación por nombre.\n if (\n typeContext &&\n !isPromiseType(\n typeContext.services.getTypeAtLocation(callee.object),\n typeContext,\n )\n ) {\n return;\n }\n\n context.report({\n data: { method },\n messageId: \"noPromiseChain\",\n node: callee.property,\n });\n },\n };\n },\n};\n","import { oneRootFunctionPerFile } from \"#/rules/one-root-function-per-file\";\nimport { jsxReturnNamePascalCase } from \"#/rules/jsx-return-name-pascal-case\";\nimport { asyncFunctionsReturnResult } from \"#/rules/async-functions-return-result\";\nimport { noAdHocOkResult } from \"#/rules/no-ad-hoc-ok-result\";\nimport { awaitRequiresResult } from \"#/rules/await-requires-result\";\nimport { resultErrorRequiresCause } from \"#/rules/result-error-requires-cause\";\nimport { resultErrorRequiresHandling } from \"#/rules/result-error-requires-handling\";\nimport type { Rule } from \"eslint\";\nimport { maxHookSize } from \"#/rules/max-hook-size\";\nimport { noDeepRelativeImports } from \"#/rules/no-deep-relative-imports\";\nimport { noDefaultExport } from \"#/rules/no-default-export\";\nimport { noEmoji } from \"#/rules/no-emoji\";\nimport { noTunnelProps } from \"#/rules/no-tunnel-props\";\nimport { noFunctionsInsideComponents } from \"#/rules/no-functions-inside-components\";\nimport { noTryCatch } from \"#/rules/no-try-catch\";\nimport { preferAbortSignal } from \"#/rules/prefer-abort-signal\";\nimport { preferTsPattern } from \"#/rules/prefer-ts-pattern\";\nimport { noJsxTernaryNull } from \"#/rules/no-jsx-ternary-null\";\nimport { noNestedIf } from \"#/rules/no-nested-if\";\nimport { noPromiseChain } from \"#/rules/no-promise-chain\";\n\nexport const rules: Record<string, Rule.RuleModule> = {\n \"one-root-function-per-file\": oneRootFunctionPerFile,\n \"jsx-return-name-pascal-case\": jsxReturnNamePascalCase,\n \"async-functions-return-result\": asyncFunctionsReturnResult,\n \"no-ad-hoc-ok-result\": noAdHocOkResult,\n \"await-requires-result\": awaitRequiresResult,\n // Alias deprecado del nombre anterior; se elimina en una versión futura.\n \"await-requires-try-safe\": {\n ...awaitRequiresResult,\n meta: {\n ...awaitRequiresResult.meta,\n deprecated: true,\n replacedBy: [\"skapxd/await-requires-result\"],\n },\n },\n \"result-error-requires-cause\": resultErrorRequiresCause,\n \"result-error-requires-handling\": resultErrorRequiresHandling,\n \"max-hook-size\": maxHookSize,\n \"no-deep-relative-imports\": noDeepRelativeImports,\n \"no-default-export\": noDefaultExport,\n \"no-emoji\": noEmoji,\n \"no-tunnel-props\": noTunnelProps,\n \"no-functions-inside-components\": noFunctionsInsideComponents,\n \"no-try-catch\": noTryCatch,\n \"prefer-abort-signal\": preferAbortSignal,\n \"prefer-ts-pattern\": preferTsPattern,\n \"no-jsx-ternary-null\": noJsxTernaryNull,\n \"no-nested-if\": noNestedIf,\n \"no-promise-chain\": noPromiseChain,\n} as unknown as Record<string, Rule.RuleModule>;\n"],"mappings":";;;;;;AACO,SAAS,YAAY,UAAU;AACpC,SAAO,SAAS,MAAM,OAAO,E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AAS;AACd,UAAM,UAAU,QAAQ,QAAQ,CAAC,GAAG,WAAW;AAC/C,UAAM,cAAc,eAAe,OAAO;AAE1C,WAAO;AAAA,MACL,eAAe,MAAM;AACnB,cAAM,SAAS,KAAK;AAEpB,YAAI,OAAO,SAAS,oBAAoB;AACtC;AAAA,QACF;AAEA,cAAM,SAAS,QAAQ,KAAK,CAAC,SAAS,sBAAsB,QAAQ,IAAI,CAAC;AAEzE,YAAI,CAAC,QAAQ;AACX;AAAA,QACF;AAIA,YACE,eACA,CAAC;AAAA,UACC,YAAY,SAAS,kBAAkB,OAAO,MAAM;AAAA,UACpD;AAAA,QACF,GACA;AACA;AAAA,QACF;AAEA,gBAAQ,OAAO;AAAA,UACb,MAAM,EAAE,OAAO;AAAA,UACf,WAAW;AAAA,UACX,MAAM,OAAO;AAAA,QACf,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;;;AChDO,IAAM,QAAyC;AAAA,EACpD,8BAA8B;AAAA,EAC9B,+BAA+B;AAAA,EAC/B,iCAAiC;AAAA,EACjC,uBAAuB;AAAA,EACvB,yBAAyB;AAAA;AAAA,EAEzB,2BAA2B;AAAA,IACzB,GAAG;AAAA,IACH,MAAM;AAAA,MACJ,GAAG,oBAAoB;AAAA,MACvB,YAAY;AAAA,MACZ,YAAY,CAAC,8BAA8B;AAAA,IAC7C;AAAA,EACF;AAAA,EACA,+BAA+B;AAAA,EAC/B,kCAAkC;AAAA,EAClC,iBAAiB;AAAA,EACjB,4BAA4B;AAAA,EAC5B,qBAAqB;AAAA,EACrB,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,kCAAkC;AAAA,EAClC,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,oBAAoB;AACtB;","names":[]}
package/dist/index.js CHANGED
@@ -1434,20 +1434,20 @@ function getResultErrorRequiresHandlingOptions(options = {}) {
1434
1434
  };
1435
1435
  }
1436
1436
 
1437
- // src/utils/get-declared-alias-names.ts
1438
- function getDeclaredAliasNames(id) {
1437
+ // src/utils/get-declared-alias-targets.ts
1438
+ function getDeclaredAliasTargets(id, represents) {
1439
1439
  if (id.type === "Identifier") {
1440
- return [id.name];
1440
+ return [{ name: id.name, represents }];
1441
1441
  }
1442
- if (id.type !== "ObjectPattern") {
1442
+ if (id.type !== "ObjectPattern" || represents !== "result") {
1443
1443
  return [];
1444
1444
  }
1445
1445
  return id.properties.flatMap((property) => {
1446
1446
  if (property.type === "RestElement" && property.argument.type === "Identifier") {
1447
- return [property.argument.name];
1447
+ return [{ name: property.argument.name, represents: "result" }];
1448
1448
  }
1449
- if (property.type === "Property" && property.value.type === "Identifier") {
1450
- return [property.value.name];
1449
+ if (property.type === "Property" && isPropertyKeyNamed(property, "error") && property.value.type === "Identifier") {
1450
+ return [{ name: property.value.name, represents: "error" }];
1451
1451
  }
1452
1452
  return [];
1453
1453
  });
@@ -1466,10 +1466,20 @@ function isInsideNode(node, ancestor) {
1466
1466
  }
1467
1467
 
1468
1468
  // src/utils/is-consumed-result-reference.ts
1469
- function isConsumedResultReference(identifier, searchRoot, visited = /* @__PURE__ */ new Set()) {
1469
+ function isConsumedResultReference(identifier, searchRoot, represents = "result", visited = /* @__PURE__ */ new Set()) {
1470
1470
  const member = identifier.parent?.type === "MemberExpression" && identifier.parent.object === identifier ? identifier.parent : null;
1471
+ if (member && represents === "error") {
1472
+ return false;
1473
+ }
1474
+ if (member && !isMemberPropertyNamed(member, "error")) {
1475
+ return false;
1476
+ }
1471
1477
  const reference = member ?? identifier;
1478
+ const referenceRepresents = member ? "error" : represents;
1472
1479
  const parent = reference.parent;
1480
+ if (parent?.type === "MemberExpression" && parent.object === reference) {
1481
+ return false;
1482
+ }
1473
1483
  if (parent?.type === "UnaryExpression" && parent.operator === "void") {
1474
1484
  return false;
1475
1485
  }
@@ -1479,13 +1489,18 @@ function isConsumedResultReference(identifier, searchRoot, visited = /* @__PURE_
1479
1489
  if (parent?.type !== "VariableDeclarator" || parent.init !== reference) {
1480
1490
  return true;
1481
1491
  }
1482
- const aliasNames = getDeclaredAliasNames(parent.id).filter(
1483
- (name) => !visited.has(name)
1492
+ const targets = getDeclaredAliasTargets(parent.id, referenceRepresents).filter(
1493
+ (target) => !visited.has(target.name)
1484
1494
  );
1485
- return aliasNames.some((aliasName) => {
1486
- visited.add(aliasName);
1487
- return collectIdentifiersNamed(searchRoot, aliasName).filter((aliasReference) => !isInsideNode(aliasReference, parent.id)).some(
1488
- (aliasReference) => isConsumedResultReference(aliasReference, searchRoot, visited)
1495
+ return targets.some((target) => {
1496
+ visited.add(target.name);
1497
+ return collectIdentifiersNamed(searchRoot, target.name).filter((aliasReference) => !isInsideNode(aliasReference, parent.id)).some(
1498
+ (aliasReference) => isConsumedResultReference(
1499
+ aliasReference,
1500
+ searchRoot,
1501
+ target.represents,
1502
+ visited
1503
+ )
1489
1504
  );
1490
1505
  });
1491
1506
  }
@@ -1498,7 +1513,7 @@ var resultErrorRequiresHandling = {
1498
1513
  description: "Prohibe descartar en silencio un Result fallido: el error se transforma o se entrega, nunca se ignora."
1499
1514
  },
1500
1515
  messages: {
1501
- unhandledResultError: "El guard detecta que `{{name}}` fallo, pero `{{name}}.error` muere aqui sin seguimiento. Transformalo (`Result.err({ cause: {{name}}.error, ... })`), entregaselo a alguien (telemetria, estado de error, log de dominio) o propaga el result completo. Si darle seguimiento es critico o no, no es una interpretacion: todo error fluye a alguna parte."
1516
+ unhandledResultError: "El guard detecta que `{{name}}` fallo, pero `{{name}}.error` no fluye COMPLETO a ninguna parte. Transformalo (`Result.err({ cause: {{name}}.error, ... })`), entrega el objeto entero a alguien (`reportDomainError({{name}}.error)`) o propaga el result completo. Una proyeccion (`{{name}}.error.message`) no basta: el `cause` se pierde justo en la ultima milla. La UI puede leer el mensaje, pero ADEMAS el error entero debe salir hacia el trace."
1502
1517
  },
1503
1518
  schema: [
1504
1519
  {
@@ -2451,7 +2466,7 @@ var plugin = {
2451
2466
  configs: {},
2452
2467
  meta: {
2453
2468
  name: "@skapxd/eslint-opinionated",
2454
- version: "0.12.1"
2469
+ version: "0.13.0"
2455
2470
  },
2456
2471
  rules
2457
2472
  };