-
-
Notifications
You must be signed in to change notification settings - Fork 0
test: Enable test for consistent-indexed-object-style rule #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 This pull request has been linked to DevBird Task #1538 View the task details and manage the automated development workflow in DevBird. Learn more about DevBird here or the announcement blog post here. |
📋 DevBird Task PromptEnable the test for the ObjectiveUncomment the test file Documentation & Resources
Implementation Steps
Critical RequirementIf CI fails, implement from scratch:
Success Criteria
This comment was automatically added by DevBird. You can disable this feature in DevBird Settings. |
PR Review: Enable test for consistent-indexed-object-style ruleSummaryThis PR uncomments the test file for the Code Quality: ✅ ExcellentPositive Aspects:
Go Implementation Verification:
Potential Issues:
|
## Summary - Uncommented the test file for consistent-return rule in rstest.config.mts - Fixed Go implementation to properly report errors on return statements instead of function declarations - Added support for both missingReturnValue and unexpectedReturnValue error types - Follow-up to #156, which enabled the test for consistent-indexed-object-style rule ## Context This PR enables the test suite for the consistent-return rule, which enforces consistent return statements in functions - either all return statements should return a value, or none should. ## Changes ### Test Configuration (rstest.config.mts:41) - Uncommented the line enabling the consistent-return test file ### Implementation Changes (consistent_return.go) 1. **Enhanced error reporting**: - Now reports errors on individual return statements instead of the function declaration - Added tracking of individual return statements with returnInfo struct - The first return statement in a function sets the expected pattern 2. **Two error types**: - `missingReturnValue`: When a return statement is missing a value (e.g., `return;`) but other returns have values - `unexpectedReturnValue`: When a return statement has a value but other returns don't 3. **Improved function naming**: - Added "Async" prefix for async functions, arrow functions, and methods - Better error messages for arrow functions and async functions 4. **Logic implementation**: - First return statement sets the expected pattern (with value or without value) - Subsequent returns that don't match the pattern are reported as errors - Respects treatUndefinedAsUnspecified option - Properly handles void, Promise<void>, and undefined return types ## TypeScript-ESLint Reference The implementation follows the behavior of the TypeScript-ESLint consistent-return rule: https://typescript-eslint.io/rules/consistent-return/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
## Summary - Uncommented the `consistent-type-exports.test.ts` test file in the rstest configuration (line 44 of `packages/rslint-test-tools/rstest.config.mts`) - This enables testing for the `consistent-type-exports` rule, which enforces the use of type-only exports when exporting only types ## Background The `consistent-type-exports` rule from TypeScript-ESLint helps improve code clarity and enables better tree-shaking by enforcing the use of `export type` syntax when exporting only type definitions. Reference: https://typescript-eslint.io/rules/consistent-type-exports/ ## Test Plan - [ ] Verify CI passes with the new test enabled - [ ] If tests fail, investigate the Go implementation at the rule implementation location - [ ] Fix any issues in the implementation to make tests pass - [ ] Ensure all existing tests continue to pass ## Notes This PR follows the same pattern as #156 which enabled the `consistent-indexed-object-style` rule test. The change itself is minimal - just uncommenting a single line - but CI will validate that the rule implementation is complete and correct. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
## Summary - Uncommented the test file for consistent-indexed-object-style rule in `rstest.config.mts` - Follow-up to #155, which enabled the test for consistent-generic-constructors rule ## Context This PR enables the test suite for consistent-indexed-object-style rule, which enforces consistent usage of indexed object types in TypeScript. ## Changes ### Test Configuration (rstest.config.mts:40) - Uncommented the line enabling the consistent-indexed-object-style test file ### Implementation Status The Go implementation at `internal/plugins/typescript/rules/consistent_indexed_object_style/` already supports all required features: 1. **Default 'record' style**: Enforces use of `Record<K, V>` utility type - Example: `type Foo = Record<string, any>;` 2. **'index-signature' style option**: Enforces use of index signatures - Example: `type Foo = { [key: string]: any };` 3. **'mapped-type' style option**: Enforces use of mapped types - Example: `type Foo = { [K in string]: any };` 4. **Comprehensive coverage**: - Interface declarations with index signatures - Type literals with index signatures - Mapped types - Record type references - Circular reference detection to avoid false positives ## TypeScript-ESLint Reference The implementation follows the behavior of the TypeScript-ESLint consistent-indexed-object-style rule: https://typescript-eslint.io/rules/consistent-indexed-object-style/ ## Documentation References - TypeScript index signatures: https://www.typescriptlang.org/docs/handbook/2/objects.html#index-signatures - Record utility type: https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
## Summary - Uncommented the `consistent-type-exports.test.ts` test file in the rstest configuration (line 44 of `packages/rslint-test-tools/rstest.config.mts`) - This enables testing for the `consistent-type-exports` rule, which enforces the use of type-only exports when exporting only types ## Background The `consistent-type-exports` rule from TypeScript-ESLint helps improve code clarity and enables better tree-shaking by enforcing the use of `export type` syntax when exporting only type definitions. Reference: https://typescript-eslint.io/rules/consistent-type-exports/ ## Test Plan - [ ] Verify CI passes with the new test enabled - [ ] If tests fail, investigate the Go implementation at the rule implementation location - [ ] Fix any issues in the implementation to make tests pass - [ ] Ensure all existing tests continue to pass ## Notes This PR follows the same pattern as #156 which enabled the `consistent-indexed-object-style` rule test. The change itself is minimal - just uncommenting a single line - but CI will validate that the rule implementation is complete and correct. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
## Summary - Uncommented the test file for consistent-indexed-object-style rule in `rstest.config.mts` - Follow-up to #155, which enabled the test for consistent-generic-constructors rule ## Context This PR enables the test suite for consistent-indexed-object-style rule, which enforces consistent usage of indexed object types in TypeScript. ## Changes ### Test Configuration (rstest.config.mts:40) - Uncommented the line enabling the consistent-indexed-object-style test file ### Implementation Status The Go implementation at `internal/plugins/typescript/rules/consistent_indexed_object_style/` already supports all required features: 1. **Default 'record' style**: Enforces use of `Record<K, V>` utility type - Example: `type Foo = Record<string, any>;` 2. **'index-signature' style option**: Enforces use of index signatures - Example: `type Foo = { [key: string]: any };` 3. **'mapped-type' style option**: Enforces use of mapped types - Example: `type Foo = { [K in string]: any };` 4. **Comprehensive coverage**: - Interface declarations with index signatures - Type literals with index signatures - Mapped types - Record type references - Circular reference detection to avoid false positives ## TypeScript-ESLint Reference The implementation follows the behavior of the TypeScript-ESLint consistent-indexed-object-style rule: https://typescript-eslint.io/rules/consistent-indexed-object-style/ ## Documentation References - TypeScript index signatures: https://www.typescriptlang.org/docs/handbook/2/objects.html#index-signatures - Record utility type: https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
## Summary - Uncommented the `consistent-type-exports.test.ts` test file in the rstest configuration (line 44 of `packages/rslint-test-tools/rstest.config.mts`) - This enables testing for the `consistent-type-exports` rule, which enforces the use of type-only exports when exporting only types ## Background The `consistent-type-exports` rule from TypeScript-ESLint helps improve code clarity and enables better tree-shaking by enforcing the use of `export type` syntax when exporting only type definitions. Reference: https://typescript-eslint.io/rules/consistent-type-exports/ ## Test Plan - [ ] Verify CI passes with the new test enabled - [ ] If tests fail, investigate the Go implementation at the rule implementation location - [ ] Fix any issues in the implementation to make tests pass - [ ] Ensure all existing tests continue to pass ## Notes This PR follows the same pattern as #156 which enabled the `consistent-indexed-object-style` rule test. The change itself is minimal - just uncommenting a single line - but CI will validate that the rule implementation is complete and correct. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
Summary
rstest.config.mtsContext
This PR enables the test suite for consistent-indexed-object-style rule, which enforces consistent usage of indexed object types in TypeScript.
Changes
Test Configuration (rstest.config.mts:40)
Implementation Status
The Go implementation at
internal/plugins/typescript/rules/consistent_indexed_object_style/already supports all required features:Default 'record' style: Enforces use of
Record<K, V>utility typetype Foo = Record<string, any>;'index-signature' style option: Enforces use of index signatures
type Foo = { [key: string]: any };'mapped-type' style option: Enforces use of mapped types
type Foo = { [K in string]: any };Comprehensive coverage:
TypeScript-ESLint Reference
The implementation follows the behavior of the TypeScript-ESLint consistent-indexed-object-style rule:
https://typescript-eslint.io/rules/consistent-indexed-object-style/
Documentation References
🤖 Generated with Claude Code