Skip to content

feat: port rule eqeqeq#511

Merged
fansenze merged 1 commit intomainfrom
feat/port-rule-eqeqeq-20260317
Apr 9, 2026
Merged

feat: port rule eqeqeq#511
fansenze merged 1 commit intomainfrom
feat/port-rule-eqeqeq-20260317

Conversation

@fansenze
Copy link
Copy Markdown
Contributor

@fansenze fansenze commented Mar 17, 2026

Summary

Port the eqeqeq rule from ESLint to rslint.

Require the use of === and !==

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 the eqeqeq linting rule, a significant addition to the rslint project. This rule aims to improve code quality and prevent subtle bugs by requiring developers to use strict equality operators, thereby avoiding JavaScript's often surprising type coercion behavior in comparisons. The implementation includes robust logic to handle various use cases and configuration options, ensuring flexibility while promoting best practices.

Highlights

  • New Linting Rule: The ESLint eqeqeq rule has been ported to rslint, enforcing the use of strict equality operators (=== and !==) in JavaScript/TypeScript code.
  • Configurable Modes: The rule supports multiple configuration modes: "always" (default, always requires strict equality), "smart" (allows loose equality for typeof comparisons, same-type literals, and null checks), and "allow-null" (shorthand for "always" with null comparisons ignored).
  • Comprehensive Testing and Documentation: The new rule includes extensive Go-based unit tests, TypeScript-based test cases, snapshot tests, and detailed Markdown documentation outlining its purpose, options, and code examples.
Changelog
  • internal/config/config.go
    • Imported the new eqeqeq rule package.
    • Registered the eqeqeq rule with the global rule registry.
  • internal/rules/eqeqeq/eqeqeq.go
    • Added the core implementation of the eqeqeq rule.
    • Defined helper functions for operator text, strict/loose equivalents, and literal checks.
    • Implemented logic for "always" and "smart" modes, including null handling options.
    • Parsed rule options to configure behavior.
  • internal/rules/eqeqeq/eqeqeq.md
    • Created documentation for the eqeqeq rule.
    • Described the rule's purpose and available options.
    • Provided examples of correct and incorrect code for different modes.
  • internal/rules/eqeqeq/eqeqeq_test.go
    • Added comprehensive Go unit tests for the eqeqeq rule.
    • Included valid and invalid test cases for default, "smart", "always" with null options, and "allow-null" modes.
  • packages/rslint-test-tools/rstest.config.mts
    • Updated the test configuration to include the new eqeqeq.test.ts file for ESLint rules.
    • Added the eqeqeq.test.ts file to the TypeScript ESLint rules section.
  • packages/rslint-test-tools/tests/eslint/rules/snapshots/eqeqeq.test.ts.snap
    • Generated snapshot test results for the eqeqeq rule's invalid cases.
  • packages/rslint-test-tools/tests/eslint/rules/eqeqeq.test.ts
    • Created TypeScript-based test cases for the eqeqeq rule using RuleTester.
Activity
  • The author, fansenze, created this pull request to port the eqeqeq rule from ESLint to rslint.
  • The pull request description indicates that both tests and documentation have been updated as part of this change.
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 eqeqeq rule from ESLint to rslint. The implementation is comprehensive and includes good test coverage for various options. I've identified a few areas for minor refactoring to enhance code clarity and reduce duplication. Additionally, I found a redundant test file entry in the configuration. Overall, this is a solid contribution.

Comment thread internal/rules/eqeqeq/eqeqeq.go Outdated
Comment thread internal/rules/eqeqeq/eqeqeq.go Outdated
Comment thread packages/rslint-test-tools/rstest.config.mts Outdated
@fansenze fansenze mentioned this pull request Mar 17, 2026
2 tasks
@fansenze fansenze force-pushed the feat/port-rule-eqeqeq-20260317 branch from d62322a to f331d16 Compare March 17, 2026 10:05
@fansenze fansenze force-pushed the feat/port-rule-eqeqeq-20260317 branch 4 times, most recently from d183256 to ba5b7c1 Compare March 18, 2026 06:10
@fansenze fansenze force-pushed the feat/port-rule-eqeqeq-20260317 branch from ba5b7c1 to 6ef5ae3 Compare April 9, 2026 06:22
@fansenze fansenze merged commit b643d52 into main Apr 9, 2026
10 checks passed
@fansenze fansenze deleted the feat/port-rule-eqeqeq-20260317 branch April 9, 2026 08:40
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