Skip to content

fix(lint/no-base-to-string): look through parentheses around operands and callees - #1203

Merged
camc314 merged 1 commit into
fix/lint-no-deprecated-1455from
fix/lint-no-base-to-string-1448
Dec 1, 2026
Merged

camc314 merged 1 commit into
fix/lint-no-deprecated-1455from
fix/lint-no-base-to-string-1448

Conversation

@camc314

@camc314 camc314 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Ports oxc-project/tsgolint#1448 (a3ff7d40), including its baseline update.

Parentheses around stringified operands, String callees and toString or join callees weren't skipped, so multiline reports started at the opening parenthesis, and grouped callees such as (String)(obj) or (obj.toString)() weren't checked. Like typescript-eslint, which drops these parentheses, the rule now skips them. A grouped optional-chain callee such as (obj?.toString)() is still not checked, as in typescript-eslint.

const obj = { id: 1 };
(String)(obj); // now reported
(obj.toString)(); // now reported
String(
  (
    obj // reported here, not on the `(`
  )
);

Copilot AI balanced review requested due to automatic review settings December 1, 2026 12:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T12:05:44.797522Z 041b640 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the parenthesized-expression handling changes.

No open issues 🎉

What changed in this PR

Updates no-base-to-string to match upstream handling of parenthesized operands and callees, improving diagnostic locations and detecting previously missed stringification calls.

Changes:

  • Unwraps parentheses when checking operands and recognizing String, toString, toLocaleString, and join calls.
  • Preserves the exclusion for grouped optional-chain callees.
  • Updates regression baselines and upstream tracking to a3ff7d40.
File Description
crates/​tsrs_lint/​tests/​baselines/​PROGRESS.md Records the updated upstream revision.
crates/​tsrs_lint/​tests/​baselines/​no-base-to-string/​REFERENCE Pins the baseline’s new tsgolint reference commit.
crates/​tsrs_lint/​tests/​baselines/​no-base-to-string/​baseline.json Adds grouped-call cases and updates diagnostic ranges and text.
crates/​tsrs_lint/​src/​rules/​no_base_to_string.rs Skips parentheses while preserving optional-chain exclusions.

Review effort: Balanced

@camc314
camc314 added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 784814e Dec 1, 2026
19 checks passed
@camc314
camc314 deleted the fix/lint-no-base-to-string-1448 branch December 1, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants