Skip to content

perf(linter): no-multi-str: skip searching strings when in jsx attribute#17327

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-23-perf_linter_no-multi-str_skip_searching_strings_when_in_jsx_attribute
Dec 26, 2025
Merged

perf(linter): no-multi-str: skip searching strings when in jsx attribute#17327
graphite-app[bot] merged 1 commit intomainfrom
12-23-perf_linter_no-multi-str_skip_searching_strings_when_in_jsx_attribute

Conversation

@camchenry
Copy link
Member

@camchenry camchenry commented Dec 24, 2025

Optimization for JSX files: we can skip looking at string literals right away if it's inside of a JSX attribute, instead of searching the whole value first.

@github-actions github-actions bot added A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance labels Dec 24, 2025
Copy link
Member Author

camchenry commented Dec 24, 2025


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 hot fixes, skip the queue and merge this PR next

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.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 24, 2025

CodSpeed Performance Report

Merging #17327 will not alter performance

Comparing 12-23-perf_linter_no-multi-str_skip_searching_strings_when_in_jsx_attribute (120c867) with main (3ed6d94)

Summary

✅ 4 untouched
⏩ 41 skipped1

Footnotes

  1. 41 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.

@camchenry camchenry force-pushed the 12-23-perf_linter_no-multi-str_skip_searching_strings_when_in_jsx_attribute branch from a6ba999 to 120c867 Compare December 26, 2025 16:26
@camchenry camchenry marked this pull request as ready for review December 26, 2025 16:30
@camchenry camchenry requested a review from camc314 as a code owner December 26, 2025 16:30
Copilot AI review requested due to automatic review settings December 26, 2025 16:30
Copy link
Contributor

Copilot AI left a comment

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 optimizes the no-multi-str linter rule for JSX files by performing an early check for JSX attributes before searching string contents for multiline patterns. This avoids unnecessary string scanning operations when the string is inside a JSX attribute (where multiline strings are allowed).

Key Changes:

  • Early return when string literal is within a JSX attribute, avoiding expensive string search
  • Refactored string search logic to use idiomatic Option handling instead of unwrap_or(0) pattern
  • Inlined and removed the is_within_jsx_attribute helper function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 26, 2025
@camc314 camc314 self-assigned this Dec 26, 2025
Copy link
Contributor

camc314 commented Dec 26, 2025

Merge activity

…ute (#17327)

Optimization for JSX files: we can skip looking at string literals right away if it's inside of a JSX attribute, instead of searching the whole value first.
@graphite-app graphite-app bot force-pushed the 12-23-perf_linter_no-multi-str_skip_searching_strings_when_in_jsx_attribute branch from 120c867 to d2abc78 Compare December 26, 2025 16:33
@graphite-app graphite-app bot merged commit d2abc78 into main Dec 26, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 12-23-perf_linter_no-multi-str_skip_searching_strings_when_in_jsx_attribute branch December 26, 2025 16:38
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants