Skip to content

@typescript-eslint/ban-tslint-comment#464

Open
ScriptedAlchemy wants to merge 13 commits intoweb-infra-dev:mainfrom
ScriptedAlchemy:cursor/ban-tslint-comment-rule-c4ca
Open

@typescript-eslint/ban-tslint-comment#464
ScriptedAlchemy wants to merge 13 commits intoweb-infra-dev:mainfrom
ScriptedAlchemy:cursor/ban-tslint-comment-rule-c4ca

Conversation

@ScriptedAlchemy
Copy link
Contributor

Summary

Implements the @typescript-eslint/ban-tslint-comment rule to disallow TSLint directive comments (e.g., // tslint:disable). This helps clean up codebases migrating from TSLint by removing unused directives.

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:13
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 9, 2026 04:58
@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 a new linting rule, @typescript-eslint/ban-tslint-comment, designed to identify and remove TSLint directive comments from the codebase. This is particularly useful for projects transitioning from TSLint to ESLint or other linting solutions, ensuring that deprecated directives do not clutter the code or cause confusion. The rule includes automatic fix capabilities to streamline the cleanup process.

Highlights

  • New Rule Implementation: The @typescript-eslint/ban-tslint-comment rule has been implemented to disallow TSLint directive comments.
  • Codebase Cleanup: This rule helps in cleaning up codebases that are migrating from TSLint by identifying and removing obsolete TSLint directives.
  • Automatic Fixes: The new rule includes automatic fix capabilities to streamline the removal of TSLint comments.
Changelog
  • internal/config/config.go
    • Imported and registered the new ban_tslint_comment rule within the TypeScript ESLint plugin configuration.
  • internal/plugins/typescript/rules/ban_tslint_comment/ban_tslint_comment.go
    • Added the core implementation for the ban-tslint-comment rule.
    • Includes logic to detect TSLint directive comments using regular expressions, extract their values, and provide a fix to remove them.
  • internal/plugins/typescript/rules/ban_tslint_comment/ban_tslint_comment.md
    • Added comprehensive documentation for the new rule, detailing its purpose, how it works, and providing examples of both incorrect and correct code.
  • internal/plugins/typescript/rules/ban_tslint_comment/ban_tslint_comment_test.go
    • Introduced unit tests for the ban-tslint-comment rule.
    • Verifies the rule's ability to correctly identify and auto-fix various forms of TSLint directive comments.
  • packages/rslint-test-tools/rstest.config.mts
    • Enabled the test suite for the ban-tslint-comment rule by uncommenting its entry in the configuration.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/ban-tslint-comment.test.ts.snap
    • Added snapshot test results for the ban-tslint-comment rule, capturing the expected diagnostic output for different invalid code scenarios.
Activity
  • The pull request was created by ScriptedAlchemy.
  • Initial changes were pushed to implement the ban-tslint-comment rule, including its core logic, documentation, and tests.
  • The test configuration was updated to include the new rule's tests.
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

The implementation of the @typescript-eslint/ban-tslint-comment rule is a solid addition for cleaning up legacy TSLint directives. The core logic for detecting and reporting these comments is correct and follows the existing patterns in the repository. However, the buildFixRange function has some logic issues regarding how it calculates the range for removal, particularly for trailing comments and indentation, which could lead to unintended code merging or messy formatting.

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: 4cde30d2e4

ℹ️ 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 support for the @typescript-eslint/ban-tslint-comment rule in rslint to detect and auto-fix legacy TSLint directive comments (e.g. // tslint:disable*) during TSLint→ESLint migrations.

Changes:

  • Implement new TypeScript rule ban-tslint-comment with autofix support.
  • Register the rule in the global rule registry and add Go rule-tester coverage.
  • Enable the ported typescript-eslint test and add/update its rstest snapshot.

Reviewed changes

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

Show a summary per file
File Description
packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/ban-tslint-comment.test.ts.snap Adds snapshot expectations for the ported ban-tslint-comment rule test.
packages/rslint-test-tools/rstest.config.mts Enables the ban-tslint-comment test suite in rstest includes.
internal/plugins/typescript/rules/ban_tslint_comment/ban_tslint_comment_test.go Adds Go rule-tester cases for valid/invalid directive comment detection + fixes.
internal/plugins/typescript/rules/ban_tslint_comment/ban_tslint_comment.md Documents the new rule and provides examples.
internal/plugins/typescript/rules/ban_tslint_comment/ban_tslint_comment.go Implements detection + fix logic for TSLint directive comments.
internal/config/config.go Registers @typescript-eslint/ban-tslint-comment in the TypeScript plugin rule registry.

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

ScriptedAlchemy and others added 6 commits February 8, 2026 21:07
Avoid deleting adjacent code by trimming only whitespace and handling standalone comments with safe newline removal.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use the original comment substring in diagnostics and remove extra quoting so snapshots render cleanly.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use string concatenation for diagnostics and a tagged switch for newline handling.

Co-authored-by: Cursor <cursoragent@cursor.com>
Match the snapshot expectations by using consistent whoa identifiers.

Co-authored-by: Cursor <cursoragent@cursor.com>
Removes the leftover fmt import so Go build and lint jobs pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ScriptedAlchemy ScriptedAlchemy changed the title Ban tslint comment rule ban-tslint-comment Feb 9, 2026
@ScriptedAlchemy ScriptedAlchemy changed the title ban-tslint-comment @typescript-eslint/ban-tslint-comment Feb 9, 2026
fansenze
fansenze previously approved these changes Feb 10, 2026
@ScriptedAlchemy ScriptedAlchemy enabled auto-merge (squash) February 12, 2026 21:13
Handle unary plus numeric expressions in starts/ends detection and add regression coverage for +0 and UTF-16 length semantics. Also add a defensive comment range guard and refresh parity snapshots to match current tester output formatting.

Co-authored-by: Cursor <cursoragent@cursor.com>
ScriptedAlchemy and others added 3 commits February 14, 2026 00:11
Treat invalid test cases with an explicit output field as output-bearing even when the value is null or empty string. This aligns local and CI behavior for parity snapshots and updates affected snapshots accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
Apply Prettier formatting to the rule-tester source after the output-presence logic update so CI format checks pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
Restore null support for jsxPragma in RuleTester options and cast languageOptions when calling lint so build-time type narrowing does not break existing no-unused-vars parity fixtures.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ScriptedAlchemy ScriptedAlchemy enabled auto-merge (squash) February 14, 2026 08:46
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.

3 participants