Skip to content

refactor(linter/prefer-template): simplify string expression checks#21505

Merged
graphite-app[bot] merged 1 commit into
mainfrom
c/04-16-refactor_linter_prefer-template_simplify_string_expression_checks
Apr 16, 2026
Merged

refactor(linter/prefer-template): simplify string expression checks#21505
graphite-app[bot] merged 1 commit into
mainfrom
c/04-16-refactor_linter_prefer-template_simplify_string_expression_checks

Conversation

@camc314

@camc314 camc314 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

taken from #21502 to reduce the diff

camc314 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Apr 16, 2026
@camc314 camc314 self-assigned this Apr 16, 2026
@camc314
camc314 marked this pull request as ready for review April 16, 2026 15:57
Copilot AI review requested due to automatic review settings April 16, 2026 15:57

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

Refactors the prefer-template linter rule’s internal “string expression” detection logic to use AST helper APIs and simplify recursive checks, reducing diff size ahead of the larger autofix work in #21502.

Changes:

  • Replaced explicit matches!(Expression::StringLiteral | Expression::TemplateLiteral) checks with Expression::is_string_literal().
  • Refactored recursive helpers for traversing + binary expression trees to a guard-style if let ... && ... structure.

Comment thread crates/oxc_linter/src/rules/eslint/prefer_template.rs
@graphite-app

graphite-app Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Merge activity

@graphite-app
graphite-app Bot force-pushed the c/04-16-refactor_linter_prefer-template_simplify_string_expression_checks branch from 1a48040 to a5cab18 Compare April 16, 2026 16:05
@graphite-app
graphite-app Bot merged commit a5cab18 into main Apr 16, 2026
26 checks passed
@graphite-app
graphite-app Bot deleted the c/04-16-refactor_linter_prefer-template_simplify_string_expression_checks branch April 16, 2026 16:10
@codspeed-hq

codspeed-hq Bot commented Apr 16, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing c/04-16-refactor_linter_prefer-template_simplify_string_expression_checks (a5cab18) with main (be2b392)2

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (a5cab18) during the generation of this report, so be2b392 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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

Labels

A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants