fix: enable 11 typescript-eslint tests and fix rule implementations#472
fix: enable 11 typescript-eslint tests and fix rule implementations#472
Conversation
Summary of ChangesHello @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
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
f403c64 to
e58a107
Compare
e58a107 to
e36e475
Compare
internal/plugins/typescript/rules/ban_ts_comment/ban_ts_comment.md
Outdated
Show resolved
Hide resolved
c416b68 to
823846a
Compare
9bc2970 to
e5cc5de
Compare
e5cc5de to
dc8e5e5
Compare
4bb0dda to
2c86d13
Compare
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
2c86d13 to
68a6ef6
Compare
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, useSkipTypeParentheses()for positioningno-redundant-type-constituents: AddSkipTypeParentheses()for parenthesized typesnon-nullable-type-assertion-style: MakecouldBeNullablerecursive for type parameter constraintsUnsafe Type Operations (3 rules)
no-unsafe-call: Fix object literal methodthiscontext detectionno-unsafe-member-access: AddSkipParentheses()for element access, fix object literal method detectionno-unsafe-return: Fixthistype checking (remove incorrect early return)Class & Code Quality (3 rules)
no-extraneous-class: Addextendscheck, fixonlyStaticdetectionunbound-method: Fix JSON options parsing forignoreStaticno-confusing-void-expression: Tests enabled (no implementation changes needed)Code Quality Improvements
utils.GetPropertyInfo()utils.IsInObjectLiteralMethod()shouldCheckThis→shouldCheckImplicitAnyThisFramework Improvements
descriptionparameter toRuleTester.run()for test suite namingruleTester.run('rule-name', cases, { description: 'edge-case' })Tests Enabled (11 files)
Test Coverage
Related Links
Checklist