Skip to content

@typescript-eslint/explicit-function-return-type#465

Open
ScriptedAlchemy wants to merge 7 commits intoweb-infra-dev:mainfrom
ScriptedAlchemy:cursor/explicit-function-return-type-ce2b
Open

@typescript-eslint/explicit-function-return-type#465
ScriptedAlchemy wants to merge 7 commits intoweb-infra-dev:mainfrom
ScriptedAlchemy:cursor/explicit-function-return-type-ce2b

Conversation

@ScriptedAlchemy
Copy link
Contributor

Summary

Implements the @typescript-eslint/explicit-function-return-type rule, including full option handling, correct function-head range reporting, Go unit tests, and documentation. The existing JavaScript rule tests have also been enabled.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

\"Open \"Open

Made with Cursor

cursoragent and others added 2 commits February 8, 2026 23:35
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
…ion-return-type-ce2b

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 9, 2026 06:32
@gemini-code-assist
Copy link

Summary of Changes

Hello @ScriptedAlchemy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the @typescript-eslint/explicit-function-return-type rule, which mandates explicit return type annotations for functions and class methods. The implementation covers all specified options, ensures accurate error reporting by identifying the correct function head ranges, and is thoroughly tested with new Go unit tests. Additionally, the existing JavaScript test suite for this rule has been activated, and comprehensive documentation has been provided to guide users.

Highlights

  • New Rule Implementation: The @typescript-eslint/explicit-function-return-type rule has been fully implemented.
  • Option Handling: Comprehensive option handling is included for the new rule, allowing flexible configuration.
  • Accurate Range Reporting: The rule correctly reports issues by identifying the precise function-head ranges.
  • Go Unit Tests: Dedicated Go unit tests have been added to ensure the reliability and correctness of the rule.
  • Documentation: Documentation for the new rule, including usage examples, has been provided.
  • JavaScript Test Enablement: Existing JavaScript rule tests for explicit-function-return-type have been enabled.
Changelog
  • internal/config/config.go
    • The new explicit_function_return_type rule has been imported and registered within the global rule registry.
  • internal/plugins/typescript/rules/explicit_function_return_type/explicit_function_return_type.go
    • This new file contains the complete logic for the explicit-function-return-type rule, including parsing of configuration options, abstract syntax tree (AST) traversal to identify functions, and precise range reporting for violations.
  • internal/plugins/typescript/rules/explicit_function_return_type/explicit_function_return_type.md
    • Documentation for the new rule has been added, detailing its purpose, usage, and providing examples of both compliant and non-compliant code.
  • internal/plugins/typescript/rules/explicit_function_return_type/explicit_function_return_type_test.go
    • A new Go test file has been added to validate the functionality of the explicit-function-return-type rule across various scenarios and option configurations.
  • packages/rslint-test-tools/rstest.config.mts
    • The configuration for the test tools has been updated to enable the JavaScript tests for the explicit-function-return-type rule.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/explicit-function-return-type.test.ts.snap
    • New snapshot test data has been generated and added to capture the expected diagnostic output for the explicit-function-return-type rule.
Activity
  • ScriptedAlchemy has implemented the @typescript-eslint/explicit-function-return-type rule, including its core logic, option handling, and accurate range reporting.
  • Go unit tests and comprehensive documentation for the new rule have been added by ScriptedAlchemy.
  • ScriptedAlchemy has enabled the existing JavaScript rule tests for this feature.
  • The author has confirmed that both tests and documentation are updated as part of this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements the @typescript-eslint/explicit-function-return-type rule. The implementation is comprehensive, including handling for all rule options, Go unit tests, documentation, and enabling the original JavaScript-based test suite. The code is well-structured. I've found one potential issue in the logic for inferring return types from ancestor functions which I've commented on. Overall, this is a great contribution.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4cb0f53f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the @typescript-eslint/explicit-function-return-type rule to the TypeScript plugin, wiring it into the global rule registry and enabling the upstream TS-ESLint rule test suite in rslint-test-tools.

Changes:

  • Implement explicit-function-return-type rule logic in Go, including option parsing and function-head range reporting.
  • Add Go unit tests for core behaviors and enable the upstream TypeScript-ESLint rule tests + snapshot.
  • Register the rule and add basic rule documentation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/plugins/typescript/rules/explicit_function_return_type/explicit_function_return_type.go New Go implementation of the rule + option handling + diagnostic range calculation.
internal/plugins/typescript/rules/explicit_function_return_type/explicit_function_return_type_test.go Go unit tests for key options / ranges.
internal/plugins/typescript/rules/explicit_function_return_type/explicit_function_return_type.md New rule documentation page.
internal/config/config.go Registers the rule in the TS-ESLint plugin rule registry.
packages/rslint-test-tools/rstest.config.mts Enables the upstream rule test file.
packages/rslint-test-tools/tests/typescript-eslint/rules/__snapshots__/explicit-function-return-type.test.ts.snap New snapshot output for the enabled upstream test suite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ScriptedAlchemy and others added 5 commits February 8, 2026 22:43
Simplify allow-expression checks to satisfy staticcheck and disable the rule in dogfooding config.

Co-authored-by: Cursor <cursoragent@cursor.com>
Apply review feedback for ancestor checks, option gating, and document available options.

Co-authored-by: Cursor <cursoragent@cursor.com>
Skip object literal wrappers when walking for return-typed ancestors and avoid spellcheck warnings.

Co-authored-by: Cursor <cursoragent@cursor.com>
Treat array literal containers as typed contexts for object literal properties.

Co-authored-by: Cursor <cursoragent@cursor.com>
Limit the report scope and missing list to @typescript-eslint rules only.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants