Repository navigation
fix(linter): search string values without UTF-8 conversion - #26716
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
Merging this PR will improve performance by 8.37%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | formatter[index.tsx] |
7.3 ms | 6.7 ms | +9.46% |
| ⚡ | Simulation | formatter[next.ts] |
4.4 ms | 4.1 ms | +8.97% |
| ⚡ | Simulation | formatter[handle-comments.js] |
5.4 ms | 4.9 ms | +8.91% |
| ⚡ | Simulation | formatter[core.js] |
3.1 ms | 2.9 ms | +8.64% |
| ⚡ | Simulation | formatter[Search.tsx] |
3.3 ms | 3.1 ms | +8.03% |
| ⚡ | Simulation | formatter[App.tsx] |
98.7 ms | 91.9 ms | +7.32% |
| ⚡ | Simulation | formatter[errors.ts] |
1.1 ms | 1.1 ms | +7.3% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing jsstr-search-helpers (5c8caf1) with jsstr-jsx-entities (7a75108)2
Footnotes
-
9 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. ↩
-
No successful run was found on
jsstr-jsx-entities(729bbb3) during the generation of this report, so bd622f2 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
74154df to
c9ee0e1
Compare
a6f0e92 to
024c0c9
Compare
c9ee0e1 to
9519400
Compare
61c79ec to
febec45
Compare
9519400 to
af887ee
Compare
febec45 to
3f8fe1c
Compare
af887ee to
f6fcadc
Compare
3f8fe1c to
3cbb8a4
Compare
f6fcadc to
0fe1de4
Compare
0fe1de4 to
0f7511e
Compare
4433f9f to
6584a8a
Compare
30fc5e1 to
5751fa9
Compare
f4dd05c to
965563a
Compare
6925617 to
a034bd5
Compare
965563a to
5d48604
Compare
a034bd5 to
c562135
Compare
206e403 to
4f39e1f
Compare
c562135 to
401c71d
Compare
4f39e1f to
0af3182
Compare
401c71d to
16d470a
Compare
0af3182 to
6e58b65
Compare
16d470a to
cc36758
Compare
6e58b65 to
c5bac79
Compare
b0489bf to
9162dd5
Compare
4e4d6a7 to
31be9f5
Compare
9162dd5 to
e328b55
Compare
b609778 to
e164b38
Compare
e328b55 to
3f9a934
Compare
Merge activity
|
A lone surrogate anywhere in a string made `as_str()` return `None`, so rules skipped checks on ordinary text elsewhere in the value. For example, `test(" \uD800 my title ", () => {})` got no leading/trailing-space diagnostic.
This adds `contains`, `starts_with`, `ends_with`, `find` and `rfind` to `JSStr`. They take a `&str`, a `char` or a predicate, search the WTF-8 bytes without converting or allocating, and never match a lone surrogate with a character pattern. Seven linter rules and the formatter's JSX attribute checks use them. Lowercase-title fixes now check the source spelling, so an escaped first letter is reported without a fix.
Based on #26712. Part of #26242.
Implemented with AI assistance.

A lone surrogate anywhere in a string made
as_str()returnNone, so rules skipped checks on ordinary text elsewhere in the value. For example,test(" \uD800 my title ", () => {})got no leading/trailing-space diagnostic.This adds
contains,starts_with,ends_with,findandrfindtoJSStr. They take a&str, acharor a predicate, search the WTF-8 bytes without converting or allocating, and never match a lone surrogate with a character pattern. Seven linter rules and the formatter's JSX attribute checks use them. Lowercase-title fixes now check the source spelling, so an escaped first letter is reported without a fix.Based on #26712. Part of #26242.
Implemented with AI assistance.