Skip to content

[eslint-miner] Add no-map-parseint-callback rule - #69608

Merged
pelikhan merged 1 commit into
mainfrom
eslint-miner/no-map-parseint-callback-879fb5ef74e694dc
Oct 17, 2026
Merged

pelikhan merged 1 commit into
mainfrom
eslint-miner/no-map-parseint-callback-879fb5ef74e694dc

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Adds gh-aw-custom/no-map-parseint-callback (warn), flagging .map(parseInt) / .map(Number.parseInt) where the element index becomes the radix (["10","10","10"].map(parseInt) → [10, NaN, 2]).

Evidence: actions/setup/js already uses .map(Number) for version/date parsing (e.g. check_version_updates.cjs, pi_runtime.cjs); the neighbouring parseInt radix rule does not cover this callback form. Low false-positive risk: only fires on a bare unshadowed parseInt as the first argument to .map.

Validation: npm run build, npm run lint:setup-js (0 errors, no new warnings from this rule), and the rule unit test pass.

Generated by ESLint Miner · copilot · auto · 16.5 AIC · ⌖ 0.654 AIC · ⊞ 9K · ◷

  • expires on Oct 23, 2026, 7:34 PM UTC-08:00

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor Author

Great work — the new no-map-parseint-callback rule is focused and well tested. Looks ready for review!

Generated by ✅ Contribution Check · copilot · auto · 36 AIC · ⌖ 0.636 AIC · ⊞ 10.6K · ◷

@pelikhan
pelikhan marked this pull request as ready for review October 17, 2026 14:01
Copilot AI max review requested due to automatic review settings October 17, 2026 14:01
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · haiku45 · 6.02 AIC · ⌖ 9.63 AIC · ◇ 3.69 AIC · ⊞ 9.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · opus55 · 11.1 AIC · ⌖ 36.3 AIC · ◇ 13.9 AIC · ⊞ 1.9K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · gpt56 · 8.29 AIC · ⌖ 5.34 AIC · ⊞ 14.6K · ◷

Generated by Ponytail Reviewer for #69608

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verdict

I don't see a merge-blocking issue in the changed lines from this static diff review.

Why I'm not blocking The rule is wired into the plugin and config, and the added tests cover the primary bad patterns (`parseInt` and `Number.parseInt`) plus the obvious non-issues. I reviewed only the capped diff and did not execute code, so this is limited to static evidence from the patch.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 35.8 AIC · ⌖ 5.73 AIC · ⊞ 15.9K
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /codebase-design and /tdd (fallback heuristic used; pr-triage was skipped as triage would add no new signal on this small, well-scoped rule-addition PR). Requesting changes for one CI-breaking omission plus a minor scope gap.

📋 Key Themes & Highlights

Key Themes

  • Breaks CI: src/index-readme-parity.test.ts asserts every rule registered in index.ts has a matching ### \rule-name`section inREADME.md. This PR registers no-map-parseint-callbackbut never touchesREADME.md`, so the parity test will fail.
  • Coverage gap: the rule only checks .map(parseInt); .flatMap(parseInt) has the identical index-as-radix bug and isn't covered by a test or the implementation, even though a sibling rule in this same codebase (no-ad-hoc-jsonl-parser.ts) already treats map/flatMap as equivalent array callbacks.
  • Minor duplication: the local isShadowed scope-walk duplicates the same logic already present in prefer-number-isnan.ts and require-parseInt-radix.ts — not blocking, flagged as a future extraction opportunity.

Positive Highlights

  • ✅ Well-targeted rule with a clear, low-false-positive detection surface (bare unshadowed parseInt/Number.parseInt as the first .map() argument).
  • ✅ Good test coverage of the shadowing edge case (function f(parseInt) { ... }) and the thisArg form (.map(parseInt, null)).
  • ✅ Message is clear and actionable, explaining the exact failure mode with a concrete example.

Please update README.md to keep the parity test green, and consider extending to flatMap for full coverage of the bug class.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 48.4 AIC · ⌖ 14 AIC · ⊞ 10.1K
Comment /matt to run again

Comments that could not be inline-anchored

eslint-factory/src/index.ts:90

[/codebase-design] This rule is registered in index.ts but README.md is never updated, which will break the automated parity test (src/index-readme-parity.test.ts) that asserts every exported rule has a matching ### rule-name`` heading in the README.

<details>
<summary>💡 Fix</summary>

Add a table row and a ### \no-map-parseint-callback`section toREADME.md, following the format used for the neighbouring prefer-number-isnan` rule (flagged forms, rationale, and any intentio…

eslint-factory/src/rules/no-map-parseint-callback.ts:86

[/codebase-design] isShadowed duplicates the hasLocalBinding scope-walk already implemented in prefer-number-isnan.ts and require-parseInt-radix.ts. Minor duplication, but worth noting since this codebase already has 3+ copies of the same scope-chain lookup.

<details>
<summary>💡 Suggestion</summary>

Not blocking for this PR, but a good /improve-codebase-architecture follow-up would be extracting a shared hasLocalBinding(sourceCode, node, name) helper (e.g. in a `scope-utils.t…

eslint-factory/src/rules/no-map-parseint-callback.ts:99

[/tdd] The rule only matches callee property name &quot;map&quot;, but .flatMap(parseInt) has the exact same index-as-radix bug and is used elsewhere in this very codebase (no-ad-hoc-jsonl-parser.ts treats map/flatMap/forEach/etc. as equivalent array callbacks). No test exercises flatMap, so this gap is currently undetected.

<details>
<summary>💡 Suggested fix</summary>

const arrayCallbacks = new Set([&quot;map&quot;, &quot;flatMap&quot;]);
// ...
if (callee.type !== &quot;MemberExpression&quot; || callee.co…

</details>

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.

🟡 Changes recommended

Missing rule documentation breaks the existing README/export parity test.

2 open issues
What changed in this PR

Adds a custom ESLint warning to prevent incorrect parsing when .map() passes an element index to parseInt as its radix.

Changes:

  • Detects unshadowed parseInt and Number.parseInt callbacks.
  • Adds rule tests.
  • Registers and enables the rule at warning level.
File Description
eslint-factory/​src/​rules/​no-map-parseint-callback.ts Implements callback detection and diagnostics.
eslint-factory/​src/​rules/​no-map-parseint-callback.test.ts Tests matching, exclusions, and documentation URL.
eslint-factory/​src/​index.ts Registers the rule in the plugin.
eslint-factory/​eslint.config.cjs Enables the warning.

Review effort: Max

"prefer-get-error-message": preferGetErrorMessageRule,
"prefer-get-error-message-over-string": preferGetErrorMessageOverStringRule,
"prefer-number-isnan": preferNumberIsNanRule,
"no-map-parseint-callback": noMapParseIntCallbackRule,
if (node.type === "Identifier") {
return node.name === "parseInt" && !isShadowed(node, "parseInt");
}
return node.type === "MemberExpression" && !node.computed && node.object.type === "Identifier" && node.object.name === "Number" && !isShadowed(node, "Number") && node.property.type === "Identifier" && node.property.name === "parseInt";
@pelikhan
pelikhan merged commit 7752db8 into main Oct 17, 2026
51 checks passed
@pelikhan
pelikhan deleted the eslint-miner/no-map-parseint-callback-879fb5ef74e694dc branch October 17, 2026 14:27
@github-actions

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v0.92.5

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

Labels

automation cookie Issue Monster Loves Cookies! eslint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants