Skip to content

feat: port rule no-obj-calls#523

Open
fansenze wants to merge 1 commit intomainfrom
feat/port-rule-no-obj-calls-20260317
Open

feat: port rule no-obj-calls#523
fansenze wants to merge 1 commit intomainfrom
feat/port-rule-no-obj-calls-20260317

Conversation

@fansenze
Copy link
Copy Markdown
Contributor

@fansenze fansenze commented Mar 17, 2026

Summary

Port the no-obj-calls rule from ESLint to rslint.

Disallow calling global object properties as functions

Related Links

Checklist

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

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 a new linting rule, no-obj-calls, to the rslint project. The rule aims to improve code quality by identifying and preventing incorrect invocations of global namespace objects that are not callable, thereby helping developers avoid common runtime errors and enhance the robustness of their JavaScript codebases.

Highlights

  • New Linting Rule: The no-obj-calls rule has been ported from ESLint to rslint.
  • Error Prevention: This rule disallows calling global object properties like Math, JSON, Reflect, Atomics, and Intl as functions or constructors, preventing runtime TypeError exceptions.
Changelog
  • internal/config/config.go
    • Imported the new no_obj_calls rule package.
    • Registered the no-obj-calls rule with the global rule registry.
  • internal/rules/no_obj_calls/no_obj_calls.go
    • Added the implementation of the no-obj-calls rule, which checks for calls to non-callable global objects.
  • internal/rules/no_obj_calls/no_obj_calls.md
    • Added comprehensive documentation for the no-obj-calls rule, including its purpose and examples of correct and incorrect usage.
  • internal/rules/no_obj_calls/no_obj_calls_test.go
    • Added Go-based unit tests to verify the functionality of the no-obj-calls rule.
  • packages/rslint-test-tools/rstest.config.mts
    • Included the new no-obj-calls.test.ts file in the ESLint rule test configuration.
    • Added the new no-obj-calls.test.ts file to the TypeScript ESLint rule test configuration.
  • packages/rslint-test-tools/tests/eslint/rules/snapshots/no-obj-calls.test.ts.snap
    • Generated snapshot test results for the no-obj-calls rule's invalid cases.
  • packages/rslint-test-tools/tests/eslint/rules/no-obj-calls.test.ts
    • Added TypeScript-based test cases for the no-obj-calls rule using RuleTester.
Activity
  • The author has confirmed that tests are updated and documentation is either updated or not required, indicating the PR is ready for review.
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
Copy Markdown
Contributor

@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 ports the no-obj-calls rule from ESLint, which is a great addition. The rule implementation is clean and follows the project's conventions. The documentation and registration are also done correctly. My main feedback is on improving test coverage. The current tests don't cover all the global objects that the rule is designed to check, specifically Atomics and Intl. I've left a couple of suggestions to add these missing test cases to ensure the rule is robust.

@fansenze fansenze force-pushed the feat/port-rule-no-obj-calls-20260317 branch 2 times, most recently from df4924d to 6e61169 Compare March 17, 2026 10:58
@fansenze fansenze force-pushed the feat/port-rule-no-obj-calls-20260317 branch 3 times, most recently from e7f4f05 to 15a44cf Compare March 18, 2026 02:45
@fansenze fansenze force-pushed the feat/port-rule-no-obj-calls-20260317 branch from 15a44cf to 4995d5e Compare March 18, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant