-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Implement 3 ESLint core 'Possible Problems' rules #49
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
feat: Implement 3 ESLint core 'Possible Problems' rules #49
Conversation
Implemented the following ESLint core rules: 1. **no-loss-of-precision** - Disallow number literals that lose precision - Detects numeric literals exceeding IEEE 754 safe integer limits - Supports decimal, scientific notation, hex, binary, and octal formats - Uses arbitrary precision arithmetic for accurate validation 2. **no-misleading-character-class** - Disallow characters made with multiple code points in character class syntax - Detects surrogate pairs without unicode flag - Checks for combining characters (accents, variation selectors) - Identifies emoji modifiers, regional indicators, and zero-width joiners - Respects 'v' flag (ES2024 unicodeSets mode) 3. **no-new-native-nonconstructor** - Disallow new operators with global non-constructor functions - Prevents calling Symbol and BigInt with 'new' operator - Handles variable shadowing detection via TypeScript type checker - Provides accurate error messages for each native function **Implementation Details:** - Generated rule templates using scripts/generate-rule.go - Registered rules in internal/config/config.go - Added comprehensive test cases based on ESLint test suites - All rules follow RSLint architecture patterns **Testing:** - Basic test cases added for each rule - Valid and invalid cases cover main scenarios - Tests verify correct error detection and message IDs 🤖 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 #921 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 PromptObjective: Port 3 ESLint core "Possible Problems" rules to RSLint (Go implementation) Rules to implement:
Documentation & Test Resources:
Implementation Requirements:
Success Criteria:
This comment was automatically added by DevBird. You can disable this feature in DevBird Settings. |
Pull Request Review: PR #49 - Implement 3 ESLint Core 'Possible Problems' RulesSummaryThis PR implements three ESLint core rules: ✅ Strengths1. Excellent Code Organization
2. Good Implementation Quality
3. Proper Registration
🔍 Issues & SuggestionsCritical Issues1.
|
Fixed two CI failures: 1. Updated imports in test files to use correct fixtures package path (internal/plugins/typescript/rules/fixtures instead of internal/rules/fixtures) 2. Added 'nonconstructor' to spell check dictionary to fix lint check 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Pull Request Review: ESLint Core Rules ImplementationThank you for this comprehensive PR implementing 3 ESLint core "Possible Problems" rules! This is a solid contribution that follows the repository conventions well. Below is my detailed review: Overall Assessment✅ Strengths:
1. no-loss-of-precisionFile: Code Quality ✅
Potential Issues
|
Summary
This PR implements 3 ESLint core "Possible Problems" rules for RSLint:
1.
no-loss-of-precisionDisallows number literals that lose precision when converted to JavaScript's IEEE 754 double-precision floating-point format.
Features:
9.007199254740993e15)0x), binary (0b), and octal (0o) formats_) before validationmath/bigpackage for arbitrary precision comparisonExamples:
2.
no-misleading-character-classPrevents regex character classes from containing multi-code-point characters that would be matched as individual components.
Features:
uflag (e.g.,[👍])vflag (ES2024 unicodeSets mode)Examples:
3.
no-new-native-nonconstructorPrevents using the
newoperator with global functions that are not constructors.Features:
new Symbol()andnew BigInt()newwhen symbols are shadowed by local variablesExamples:
Implementation Details
scripts/generate-rule.gointernal/config/config.gogo buildTest Plan
Basic Testing
no-loss-of-precision: Valid numbers pass, precision-losing numbers failno-misleading-character-class: Unicode issues detected correctlyno-new-native-nonconstructor: Symbol/BigInt usage validatedNext Steps
go test ./internal/rules/...References
🤖 Generated with Claude Code