Repository: eslint-functional/eslint-plugin-functional
Pull request #963 (2025-05-04 16:30:59)

fix: mark no-throw-statements rule as requiring type checking
Previously, the rule `functional/no-throw-statements` did not declare `requiresTypeChecking: true`, which caused runtime errors when using it with `@typescript-eslint` without a `parserOptions.project` set.

This change adds `requiresTypeChecking: true` to the rule's meta to align with its actual type-dependent behavior.

graphite-app[bot]: ## How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:
- <kbd>Status: Merge Queue</kbd> - adds this PR to the back of the merge queue
- <kbd>Status: Hotfix</kbd> - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using [this link](https://app.graphite.dev/invite/github/eslint-functional?ref=merge-queue-instructions-comment&prId=6179331405).

<h2></h2>
<sub>

An organization admin has enabled the [Graphite Merge Queue](https://graphite.dev/docs/graphite-merge-queue) in this repository.

</sub>

<sub>

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

</sub>

Patch:
diff --git a/src/rules/no-throw-statements.ts b/src/rules/no-throw-statements.ts
index b6358a5..e8cde04 100644
--- a/src/rules/no-throw-statements.ts
+++ b/src/rules/no-throw-statements.ts
@@ -66,7 +66,7 @@ const meta: NamedCreateRuleCustomMeta<keyof typeof errorMessages, RawOptions> =
     description: "Disallow throwing exceptions.",
     recommended: "recommended",
     recommendedSeverity: "error",
-    requiresTypeChecking: false,
+    requiresTypeChecking: true,
   },
   messages: errorMessages,
   schema,
diff --git a/src/rules/prefer-tacit.ts b/src/rules/prefer-tacit.ts
index 8011921..7978823 100644
--- a/src/rules/prefer-tacit.ts
+++ b/src/rules/prefer-tacit.ts
@@ -118,6 +118,18 @@ function isCallerViolation(
     .some((signature) => signature.parameters.length === caller.arguments.length);
 }
 
+/**
+ * Is the given node a direct child of a getter.
+ */
+function isDirectChildOfGetter(node: TSESTree.Node): boolean {
+  const { parent } = node;
+  if (parent?.type !== TSESTree.AST_NODE_TYPES.Property) {
+    return false;
+  }
+
+  return parent.kind === "get";
+}
+
 /**
  * Get the fixes for a call to a reference violation.
  */
@@ -260,6 +272,13 @@ function checkFunction(
   context: Readonly<RuleContext<keyof typeof errorMessages, RawOptions>>,
   options: RawOptions,
 ): RuleResult<keyof typeof errorMessages, RawOptions> {
+  if (isDirectChildOfGetter(node)) {
+    return {
+      context,
+      descriptors: [],
+    };
+  }
+
   return {
     context,
     descriptors: [


Test patch:
diff --git a/tests/rules/prefer-tacit.test.ts b/tests/rules/prefer-tacit.test.ts
index 11aeefb..25f0ad3 100644
--- a/tests/rules/prefer-tacit.test.ts
+++ b/tests/rules/prefer-tacit.test.ts
@@ -97,6 +97,23 @@ describe(name, () => {
       `);
     });
 
+    it("doesn't report getters", async () => {
+      await valid(dedent`
+        const foo = () => {
+          const getBar = () => 1;
+          const setBar = (value: number) => {};
+          return {
+            get baz() {
+              return getBar();
+            },
+            set baz(value) {
+              setBar(value);
+            },
+          };
+        };
+      `);
+    });
+
     describe("options", () => {
       describe("checkMemberExpressions", () => {
         it("doesn't report member expressions when disabled", async () => {