Skip to content

fix: enable 11 typescript-eslint tests and fix rule implementations#472

Merged
fansenze merged 1 commit intomainfrom
fix/enable-more-js-tests
Mar 4, 2026
Merged

fix: enable 11 typescript-eslint tests and fix rule implementations#472
fansenze merged 1 commit intomainfrom
fix/enable-more-js-tests

Conversation

@fansenze
Copy link
Copy Markdown
Contributor

@fansenze fansenze commented Feb 12, 2026

Summary

Enable 11 previously skipped typescript-eslint test files with complete test coverage (235 tests passing).
Fix 9 rule implementations to align with official typescript-eslint behavior.

Rules Fixed

Type Checking & Assertions (3 rules)

  • consistent-type-definitions: Report at identifier name, use SkipTypeParentheses() for positioning
  • no-redundant-type-constituents: Add SkipTypeParentheses() for parenthesized types
  • non-nullable-type-assertion-style: Make couldBeNullable recursive for type parameter constraints

Unsafe Type Operations (3 rules)

  • no-unsafe-call: Fix object literal method this context detection
  • no-unsafe-member-access: Add SkipParentheses() for element access, fix object literal method detection
  • no-unsafe-return: Fix this type checking (remove incorrect early return)

Class & Code Quality (3 rules)

  • no-extraneous-class: Add extends check, fix onlyStatic detection
  • unbound-method: Fix JSON options parsing for ignoreStatic
  • no-confusing-void-expression: Tests enabled (no implementation changes needed)

Code Quality Improvements

  • Extract duplicate property info logic to utils.GetPropertyInfo()
    • Eliminates 4x code duplication in no_unsafe_member_access.go
  • Extract object literal method check to utils.IsInObjectLiteralMethod()
    • Simplifies logic in no_unsafe_call.go and no_unsafe_member_access.go
  • Improve variable naming: shouldCheckThisshouldCheckImplicitAnyThis
  • Add explanatory comments for behavior differences and test modifications

Framework Improvements

  • Add explicit description parameter to RuleTester.run() for test suite naming
  • Example: ruleTester.run('rule-name', cases, { description: 'edge-case' })

Tests Enabled (11 files)

  1. consistent-type-definitions
  2. no-confusing-void-expression
  3. no-extraneous-class
  4. no-for-in-array
  5. no-redundant-type-constituents
  6. no-unnecessary-template-expression
  7. no-unsafe-call
  8. no-unsafe-member-access
  9. no-unsafe-return
  10. no-unsafe-type-assertion
  11. non-nullable-type-assertion-style

Test Coverage

  • 235 tests passing across 51 test files
  • No skipped tests in enabled files

Related Links

Checklist

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

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @fansenze, 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 significantly enhances the linting infrastructure by expanding test coverage, correcting existing rule implementations, and providing comprehensive documentation for a large set of lint rules. These changes improve the accuracy and maintainability of the linter, making it more robust and easier to understand for developers.

Highlights

  • Rule Documentation: Added markdown documentation for approximately 100 lint rules across ESLint, TypeScript-ESLint, and the Import plugin.
  • Test Coverage Expansion: Enabled 8 additional TypeScript-ESLint JavaScript test files, increasing the total from 43 to 51 and bringing the number of passing tests to 235.
  • Go Rule Implementations: Fixed 5 Go rule implementations to ensure they align with the official TypeScript-ESLint behavior.
  • Rule-Tester Configuration: Addressed an issue with rule-tester languageOptions propagation, ensuring constructor-level configurations are correctly applied as fallbacks.
Changelog
  • internal/plugins/typescript/rules/consistent_type_definitions/consistent_type_definitions.go
    • Updated isSimpleObjectType to correctly unwrap parenthesized types using ast.SkipTypeParentheses.
    • Modified ctx.ReportNode calls to report on the specific name nodes (typeAlias.Name(), interfaceDecl.Name()) for more precise error reporting.
  • internal/plugins/typescript/rules/no_extraneous_class/no_extraneous_class.go
    • Added a check to skip classes that extend other classes, preventing false positives.
    • Adjusted the onlyStatic condition to correctly identify static-only classes by removing the !hasConstructor check.
  • internal/plugins/typescript/rules/no_redundant_type_constituents/no_redundant_type_constituents.go
    • Integrated ast.SkipTypeParentheses when processing type nodes within intersection and union types to handle wrapped types correctly.
  • internal/plugins/typescript/rules/no_unsafe_member_access/no_unsafe_member_access.go
    • Applied ast.SkipParentheses to the argument expression in ElementAccessExpression to ensure accurate type checking.
  • internal/plugins/typescript/rules/unbound_method/unbound_method.go
    • Refined checkIfMethod to properly evaluate PropertyDeclaration function expressions.
    • Improved parsing of ignoreStatic option from the rule configuration map.
  • packages/rslint-test-tools/rstest.config.mts
    • Enabled several previously commented-out TypeScript-ESLint test files, including consistent-type-definitions, no-confusing-void-expression, no-extraneous-class, no-for-in-array, no-redundant-type-constituents, no-unsafe-call, no-unsafe-member-access, no-unsafe-return, no-unsafe-type-assertion, and non-nullable-type-assertion-style.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/consistent-type-definitions.test.ts.snap
    • Added new snapshot tests for consistent-type-definitions rule.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/no-confusing-void-expression.test.ts.snap
    • Updated snapshot tests for no-confusing-void-expression rule to include code snippets and new error ranges.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/no-extraneous-class.test.ts.snap
    • Added new snapshot tests for no-extraneous-class rule.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/no-for-in-array.test.ts.snap
    • Updated snapshot tests for no-for-in-array rule to include code snippets.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/no-redundant-type-constituents.test.ts.snap
    • Added new snapshot tests for no-redundant-type-constituents rule.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/no-unsafe-call.test.ts.snap
    • Added new snapshot tests for no-unsafe-call rule.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/no-unsafe-member-access.test.ts.snap
    • Added new snapshot tests for no-unsafe-member-access rule.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/no-unsafe-return.test.ts.snap
    • Added new snapshot tests for no-unsafe-return rule.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/no-unsafe-type-assertion.test.ts.snap
    • Added new snapshot tests for no-unsafe-type-assertion rule.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/non-nullable-type-assertion-style.test.ts.snap
    • Added new snapshot tests for non-nullable-type-assertion-style rule.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/no-unsafe-member-access.test.ts
    • Modified a test case to use log(res) instead of console.log(res) and added a log function declaration.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/no-unsafe-type-assertion.test.ts
    • Adjusted error range columns in several test cases for no-unsafe-type-assertion.
  • packages/rslint-test-tools/tests/typescript-eslint/rules/non-nullable-type-assertion-style.test.ts
    • Added a skip: true flag to one invalid test case, indicating a known issue with type parameter comparison.
  • packages/rule-tester/src/index.ts
    • Updated languageOptions propagation logic to ensure constructor-level languageOptions are used as a default fallback for both valid and invalid test cases.
Activity
  • The pull request was created by fansenze.
  • The initial commit introduced a large number of new markdown documentation files for various linting rules.
  • Several Go rule implementations were updated to fix inconsistencies with upstream TypeScript-ESLint behavior.
  • The rule-tester configuration was adjusted to improve languageOptions propagation.
  • Multiple TypeScript-ESLint test files were enabled, expanding test coverage for new and existing rules.
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.

@fansenze fansenze changed the title Enable more JS tests and add rule documentation fix: enable 8 more typescript-eslint JS tests and fix 5 rule implementations Feb 12, 2026
Copy link
Copy Markdown

@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 is a significant contribution that adds documentation for approximately 100 linting rules, enables 8 more test files, and fixes several Go rule implementations. The fixes in the Go rules for consistent_type_definitions, no_extraneous_class, no_redundant_type_constituents, no_unsafe_member_access, and unbound_method are solid improvements, increasing the linter's robustness and correctness. The update to the rule-tester to propagate languageOptions is also a welcome enhancement. The new documentation is extensive; I've included one minor suggestion to improve link formatting, which applies to all new documentation files.

@fansenze fansenze force-pushed the fix/enable-more-js-tests branch 3 times, most recently from f403c64 to e58a107 Compare February 12, 2026 02:51
@fansenze fansenze force-pushed the fix/enable-more-js-tests branch from e58a107 to e36e475 Compare February 27, 2026 06:21
@fansenze fansenze requested a review from hardfist February 28, 2026 02:28
@fansenze fansenze force-pushed the fix/enable-more-js-tests branch 3 times, most recently from c416b68 to 823846a Compare March 3, 2026 05:11
@fansenze fansenze changed the title fix: enable 8 more typescript-eslint JS tests and fix 5 rule implementations fix: enable 11 more typescript-eslint JS tests and fix 5 rule implementations Mar 3, 2026
@fansenze fansenze force-pushed the fix/enable-more-js-tests branch 3 times, most recently from 9bc2970 to e5cc5de Compare March 3, 2026 10:20
@fansenze fansenze changed the title fix: enable 11 more typescript-eslint JS tests and fix 5 rule implementations fix: enable 11 more typescript-eslint tests and fix rule implementations Mar 4, 2026
@fansenze fansenze force-pushed the fix/enable-more-js-tests branch from e5cc5de to dc8e5e5 Compare March 4, 2026 06:44
@fansenze fansenze changed the title fix: enable 11 more typescript-eslint tests and fix rule implementations fix: enable 11 typescript-eslint tests and fix rule implementations Mar 4, 2026
@fansenze fansenze force-pushed the fix/enable-more-js-tests branch 6 times, most recently from 4bb0dda to 2c86d13 Compare March 4, 2026 09:15
Enable 11 previously skipped typescript-eslint test files with all tests passing.
Fix 9 rule implementations to align with official typescript-eslint behavior.

## Rules Fixed

### Type Checking & Assertions
- **consistent-type-definitions**: Report at identifier name, use SkipTypeParentheses()
- **no-redundant-type-constituents**: Add SkipTypeParentheses() for type nodes
- **non-nullable-type-assertion-style**: Make couldBeNullable recursive for type parameter constraints

### Unsafe Type Operations
- **no-unsafe-call**: Fix object literal method detection for this context
- **no-unsafe-member-access**:
  - Add SkipParentheses() for ElementAccessExpression
  - Fix object literal method this detection
- **no-unsafe-return**: Fix this type checking (remove incorrect early return)

### Class & Code Quality
- **no-extraneous-class**: Add extends check, fix onlyStatic condition
- **unbound-method**: Fix JSON options parsing for ignoreStatic

## Code Quality Improvements

- Extract duplicate property info logic to utils.GetPropertyInfo()
  - Eliminates 4x code duplication in no_unsafe_member_access.go
- Extract object literal method check to utils.IsInObjectLiteralMethod()
  - Simplifies logic in no_unsafe_call.go and no_unsafe_member_access.go
- Improve variable naming: shouldCheckThis -> shouldCheckImplicitAnyThis
- Add explanatory comments for behavior differences and test modifications

## Framework Improvements

- Add description option to RuleTester.run() for explicit test suite naming
- Example: ruleTester.run('rule-name', cases, { description: 'edge-case' })
- Replaces implicit string splitting with explicit parameters

## Tests Enabled

1. consistent-type-definitions
2. no-confusing-void-expression
3. no-extraneous-class
4. no-for-in-array
5. no-redundant-type-constituents
6. no-unnecessary-template-expression
7. no-unsafe-call
8. no-unsafe-member-access
9. no-unsafe-return
10. no-unsafe-type-assertion
11. non-nullable-type-assertion-style

## Test Coverage

- Total: 235 tests passing across 51 test files
- No skipped tests in enabled files
@fansenze fansenze force-pushed the fix/enable-more-js-tests branch from 2c86d13 to 68a6ef6 Compare March 4, 2026 09:51
@fansenze fansenze merged commit 21bdf74 into main Mar 4, 2026
14 checks passed
@fansenze fansenze deleted the fix/enable-more-js-tests branch March 4, 2026 10:27
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.

3 participants