nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: eslint-stylistic/eslint-stylistic
Pull request #910 (2025-07-23 01:13:46)

fix(indent): correctly locate left paren in `CallExpression` with specific type arguments
<!-- DO NOT IGNORE THE TEMPLATE!

Thank you for contributing!

Before submitting the PR, please make sure you do the following:

- Read the [Contributing Guide](https://eslint.style/contribute/guide).
- Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
- Provide a description in this PR that addresses **what** the PR is solving, or reference the issue that it solves (e.g. `fixes #123`).
- Ideally, include relevant tests that fail without this PR but pass with it.

-->

### Description

Fix incorrect parenthesis positioning specifically when:
- CallExpression contains type arguments
- Type arguments include nested parentheses
- Only occurs in complex type structures like:
```ts
// parentheses inside type argument
func<{ prop: (Type) }>(...)
             ^
```

<!-- Please insert your description here and provide especially info about the "what" this PR is solving -->

### Linked Issues

Fix: #909

### Additional context

<!-- e.g. is there anything you'd like reviewers to focus on? -->


codecov[bot]: ## [Bundle](https://app.codecov.io/gh/eslint-stylistic/eslint-stylistic/pull/910?dropdown=bundle) Report

Bundle size has no change :white_check_mark:




Patch:
diff --git a/packages/eslint-plugin/rules/indent/indent.ts b/packages/eslint-plugin/rules/indent/indent.ts
index df02c919..da76f0c2 100644
--- a/packages/eslint-plugin/rules/indent/indent.ts
+++ b/packages/eslint-plugin/rules/indent/indent.ts
@@ -1001,10 +1001,15 @@ export default createRule<RuleOptions, MessageIds>({
     function addFunctionCallIndent(node: Tree.CallExpression | Tree.NewExpression) {
       let openingParen
 
-      if (node.arguments.length)
-        openingParen = sourceCode.getFirstTokenBetween(node.callee, node.arguments[0], isOpeningParenToken)!
-      else
+      if (node.arguments.length) {
+        openingParen = sourceCode.getTokenAfter(
+          node.typeArguments ?? node.callee,
+          isOpeningParenToken,
+        )!
+      }
+      else {
         openingParen = sourceCode.getLastToken(node, 1)!
+      }
 
       const closingParen = sourceCode.getLastToken(node)!
 


Test patch:
diff --git a/packages/eslint-plugin/rules/indent/indent._ts_.test.ts b/packages/eslint-plugin/rules/indent/indent._ts_.test.ts
index a6e6dea7..0e0bd7e8 100644
--- a/packages/eslint-plugin/rules/indent/indent._ts_.test.ts
+++ b/packages/eslint-plugin/rules/indent/indent._ts_.test.ts
@@ -867,6 +867,23 @@ run<RuleOptions, MessageIds>({
         | 'four'
       ;
     `,
+    // https://github.com/eslint-stylistic/eslint-stylistic/issues/909
+    $`
+      genericFunction<
+          () => void
+      >(
+          () => {
+              console.log("Test");
+          }
+      );
+    `,
+    $`
+      genericFunction<() => void>(
+          () => {
+              console.log("Test");
+          }
+      )
+    `,
   ],
   invalid: [
     ...individualNodeTests.invalid!,