Skip to content

fix(linter): search string values without UTF-8 conversion - #26716

Merged
graphite-app[bot] merged 1 commit into
mainfrom
jsstr-search-helpers
Oct 19, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
jsstr-search-helpers

Conversation

@Dunqing

@Dunqing Dunqing commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

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.

Dunqing commented Sep 16, 2026 •

Copy link
Copy Markdown
Member 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.

@Dunqing Dunqing changed the title feat(str): add search methods to JSStr fix(linter): search string values without UTF-8 conversion Sep 16, 2026
@github-actions github-actions Bot added A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details A-formatter Area - Formatter (oxfmt). Add F-* labels for details labels Sep 16, 2026
@codspeed

codspeed Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 8.37%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 7 improved benchmarks
✅ 80 untouched benchmarks
⏩ 9 skipped benchmarks1

Performance Changes

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

Open in CodSpeed

Footnotes

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

  2. 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. ↩

@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from 74154df to c9ee0e1 Compare September 16, 2026 06:31
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from c9ee0e1 to 9519400 Compare September 16, 2026 06:39
@Dunqing
Dunqing force-pushed the jsstr-jsx-entities branch 2 times, most recently from 61c79ec to febec45 Compare September 16, 2026 07:19
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from 9519400 to af887ee Compare September 16, 2026 07:19
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from af887ee to f6fcadc Compare September 16, 2026 07:29
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from f6fcadc to 0fe1de4 Compare September 17, 2026 00:23
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from 0fe1de4 to 0f7511e Compare September 18, 2026 02:19
@Dunqing
Dunqing force-pushed the jsstr-jsx-entities branch 2 times, most recently from 4433f9f to 6584a8a Compare September 18, 2026 15:14
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch 2 times, most recently from 30fc5e1 to 5751fa9 Compare September 21, 2026 01:14
@Dunqing
Dunqing changed the base branch from graphite-base/26716 to jsstr-jsx-entities September 27, 2026 06:44
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch 2 times, most recently from 6925617 to a034bd5 Compare September 27, 2026 15:46
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from a034bd5 to c562135 Compare September 27, 2026 23:45
@Dunqing
Dunqing force-pushed the jsstr-jsx-entities branch 2 times, most recently from 206e403 to 4f39e1f Compare September 28, 2026 00:21
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from c562135 to 401c71d Compare September 28, 2026 00:21
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from 401c71d to 16d470a Compare September 28, 2026 15:42
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from 16d470a to cc36758 Compare September 28, 2026 16:15
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch 3 times, most recently from b0489bf to 9162dd5 Compare September 29, 2026 02:18
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from 9162dd5 to e328b55 Compare September 29, 2026 08:36
@Dunqing
Dunqing force-pushed the jsstr-search-helpers branch from e328b55 to 3f9a934 Compare September 30, 2026 03:12
@graphite-app

graphite-app Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter (oxfmt). Add F-* labels for details A-linter Area - Linter (oxlint): rules, config, diagnostics, fixes. Add L-* labels for details

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant