Skip to content

eslint-factory: complete test suite for require-parseInt-radix - #42042

Merged
pelikhan merged 2 commits into
mainfrom
copilot/add-test-suite-require-parseint-radix
Jun 28, 2026
Merged

eslint-factory: complete test suite for require-parseInt-radix#42042
pelikhan merged 2 commits into
mainfrom
copilot/add-test-suite-require-parseint-radix

Conversation

Copilot AI commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

require-parseInt-radix shipped with no tests, leaving the rule regression-prone. This adds the missing cases to require-parseInt-radix.test.ts to meet the full acceptance criteria.

Added test cases

Valid (should not flag):

  • parseInt(str, 16) — hex radix
  • foo.parseInt(x) — non-global object, not in scope
  • parseFloat(x) — different function entirely

Invalid (must report requireRadix):

  • parseInt(str) — bare global call, no radix
  • parseInt(str.trim()) — computed arg, still no radix
  • Number.parseInt(str) — direct member access without radix (computed Number["parseInt"] was already covered)

Test count goes from 10 → 12, covering both commonjs and module sourceType.

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
Copilot AI requested a review from pelikhan June 28, 2026 09:28
@pelikhan
pelikhan marked this pull request as ready for review June 28, 2026 09:31
Copilot AI review requested due to automatic review settings June 28, 2026 09:31
@pelikhan
pelikhan merged commit 6c47601 into main Jun 28, 2026
@pelikhan
pelikhan deleted the copilot/add-test-suite-require-parseint-radix branch June 28, 2026 09:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants