eslint-factory: complete test suite for require-parseInt-radix - #42042
Merged
Conversation
Add missing test cases per acceptance criteria in issue #42015: - Valid: parseInt(str, 16) (hex radix), foo.parseInt(x), parseFloat(x) - New test: 'valid: non-parseInt calls are not flagged' - New test: 'invalid: global parseInt without radix is flagged' covering parseInt(str) and parseInt(str.trim()) - Expanded Number.parseInt test to cover direct member access (Number.parseInt(str)) alongside existing computed access 12 tests now pass (up from 10), both CJS and ESM sourceType covered. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add test suite for require-parseInt-radix rule
eslint-factory: complete test suite for require-parseInt-radix
Jun 28, 2026
pelikhan
marked this pull request as ready for review
June 28, 2026 09:31
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the missing test coverage for the require-parseInt-radix ESLint rule in eslint-factory, reducing regression risk by adding explicit valid/invalid cases that match the stated acceptance criteria.
Changes:
- Adds valid coverage for non-decimal radix (
parseInt(str, 16)) and for non-target calls that must not be flagged (foo.parseInt(x),parseFloat(x)). - Adds invalid coverage for bare global
parseInt(...)calls without radix, including computed arguments (str.trim()). - Adds invalid coverage for
Number.parseInt(...)direct member access without radix (alongside the existing computed access case).
Show a summary per file
| File | Description |
|---|---|
| eslint-factory/src/rules/require-parseInt-radix.test.ts | Adds missing valid/invalid test cases for require-parseInt-radix to cover the rule’s key detection paths and acceptance criteria. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Low
Contributor
|
🎉 This pull request is included in a new release. Release: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
require-parseInt-radixshipped with no tests, leaving the rule regression-prone. This adds the missing cases torequire-parseInt-radix.test.tsto meet the full acceptance criteria.Added test cases
Valid (should not flag):
parseInt(str, 16)— hex radixfoo.parseInt(x)— non-global object, not in scopeparseFloat(x)— different function entirelyInvalid (must report
requireRadix):parseInt(str)— bare global call, no radixparseInt(str.trim())— computed arg, still no radixNumber.parseInt(str)— direct member access without radix (computedNumber["parseInt"]was already covered)Test count goes from 10 → 12, covering both
commonjsandmodulesourceType.