Skip to content

fix(lint/prefer-includes): handle escaped backslashes in regex patterns - #918

Merged
camc314 merged 1 commit into
mainfrom
codex/prefer-includes-regex-escapes
Nov 5, 2026
Merged

camc314 merged 1 commit into
mainfrom
codex/prefer-includes-regex-escapes

Conversation

@camc314

@camc314 camc314 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Ports oxc-project/tsgolint#1285. Track escaped backslashes so patterns such as /a\\?b/ no longer suggest includes().

Decode regex escapes before quoting the replacement string: /a\\b\.c/.test(a) becomes a.includes('a\\b.c'). Preserve apostrophes, octal escapes and control characters, and withhold fixes for lone surrogates. Remove character-class and group parsing made unreachable by the corrected filter.

Imports 14 upstream regression cases. All 79 rule cases match the patched Go oracle; 574 additional edge patterns match in all four fix modes.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 16:08

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T16:10:08.929330Z 37faf25 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.

@codspeed

codspeed Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing codex/prefer-includes-regex-escapes (37faf25) with main (4b41ebd)

Open in CodSpeed

Footnotes

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

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Performance change vs main

Workflow run · main 4b41ebdddbf3 → PR merge ddb3b08fe0ff (head 37faf2553be7)

Clef gate: Running benchmarks because the decision was unavailable (crates/tsrs_lint/src/rules/prefer_includes.rs: patch exceeds the Clef context limit (8779 bytes)).

Release builds in fast mode (TSRS_FAST=1) with Hyperfine 2 hardware counters. After warming each binary, alternating main/PR pairs measure wall time at both the fast preset's default checker count and with --singleThreaded, with ten pairs per configuration by default. Instructions come from the single-threaded runs; peak RSS comes from the default-count runs.
Incremental runs start with fresh build info before every invocation; check runs disable incremental compilation.

Project Mode Single-thread wall time Δ Single-thread instructions Δ Default wall time Δ Default peak RSS Δ
vscode check +0.2% +0.001% +3.6% +0.1%
vscode incremental -0.9% 0.000% -4.9% +0.2%
xstate-main check +4.7% -0.001% -2.1% +0.4%
xstate-main incremental +0.1% +0.002% -0.7% -0.5%
webpack check +0.3% +0.001% +0.5% +0.4%
webpack incremental -4.5% +0.002% -0.4% 0.0%
mui-docs check +0.4% +0.005% -2.0% +0.2%
mui-docs incremental -0.9% +0.007% -1.6% -0.4%
Compiler check 0.0% 0.000% -0.5% +2.2%
Compiler incremental -2.1% 0.000% +1.8% +0.2%
Compiler-Unions check -4.4% -0.001% -0.3% -0.1%
Compiler-Unions incremental +1.0% 0.000% +3.7% 0.0%
cal-diy check +1.2% -0.002% +1.5% -0.5%
cal-diy incremental +1.0% -0.004% -1.6% +0.1%
formbricks-web check +1.5% -0.002% +0.1% -0.4%
formbricks-web incremental +2.3% 0.000% -0.2% -0.1%
supabase-studio check +0.1% +0.001% +0.7% -0.3%
supabase-studio incremental -0.2% -0.001% -2.2% -0.1%
t3code-server check -2.3% +0.002% +0.6% +0.3%
t3code-server incremental -0.9% 0.000% +0.6% +0.1%
mikro-orm check -1.1% 0.000% +3.3% -0.2%
mikro-orm incremental +3.0% -0.002% +0.9% +0.1%
next-packages-next check +3.4% 0.000% +1.0% -0.1%
next-packages-next incremental +3.4% +0.001% -2.2% 0.0%
next-root check +0.2% -0.001% -1.7% -0.5%
next-root incremental +3.8% 0.000% -4.8% 0.0%
storybook check -3.9% +0.001% +6.4% +0.3%
storybook incremental +0.4% -0.002% +0.3% 0.0%
nuxt check +4.6% -0.003% -3.6% 0.0%
nuxt incremental -3.7% +0.001% +5.3% +0.2%
playwright check +0.9% -0.001% +4.7% +0.5%
playwright incremental +5.1% +0.005% -1.5% 0.0%
drizzle-orm check -1.4% +0.001% +3.8% +1.0%
drizzle-orm incremental +1.4% 0.000% +1.0% +0.1%
typeorm check -1.8% +0.001% +3.5% -0.2%
typeorm incremental +1.2% -0.002% -3.5% +0.4%
date-fns check -0.7% -0.001% -2.4% +1.2%
date-fns incremental +0.3% +0.012% -0.5% -0.1%

Negative means the PR used less; positive means it used more. Deltas are medians of paired PR/main ratios for wall time and instructions. Single-threaded runs reduce scheduling noise; shared CI machines can still add noise to wall time.

Measured medians (main → PR)
Project Mode Single-thread wall time (s) Single-thread instructions Default wall time (s) Default peak RSS (MiB)
vscode check 12.138 → 11.936 82,405,452,112.5 → 82,406,527,503.5 1.855 → 2.135 1842.3 → 1843.9
vscode incremental 11.520 → 11.211 84,822,369,507.5 → 84,822,042,272 3.063 → 3.036 2162.6 → 2166.6
xstate-main check 0.745 → 0.813 5,570,788,223.5 → 5,570,718,993 0.150 → 0.147 240.7 → 241.8
xstate-main incremental 0.600 → 0.600 5,733,446,475 → 5,733,578,325 0.171 → 0.170 244.2 → 242.9
webpack check 2.840 → 2.294 10,899,970,140.5 → 10,900,142,960 0.226 → 0.231 402.7 → 404.5
webpack incremental 1.145 → 1.104 11,123,481,047.5 → 11,123,737,921 0.281 → 0.277 402.7 → 402.5
mui-docs check 3.052 → 3.058 33,124,827,282 → 33,124,847,370 1.123 → 1.091 1232.2 → 1235.0
mui-docs incremental 4.037 → 4.161 34,468,348,320 → 34,468,153,606 1.745 → 1.729 1162.6 → 1158.0
Compiler check 0.165 → 0.167 1,776,331,362.5 → 1,776,335,220 0.068 → 0.069 76.0 → 77.7
Compiler incremental 0.168 → 0.168 1,789,144,853.5 → 1,789,148,988 0.070 → 0.072 79.5 → 79.7
Compiler-Unions check 0.313 → 0.292 3,054,455,076.5 → 3,054,430,369 0.164 → 0.165 81.2 → 81.1
Compiler-Unions incremental 0.272 → 0.279 3,066,279,437.5 → 3,066,292,326.5 0.115 → 0.113 84.8 → 84.8
cal-diy check 4.023 → 4.036 28,974,300,908.5 → 28,974,349,752.5 2.356 → 2.298 1360.0 → 1353.7
cal-diy incremental 3.201 → 3.267 30,595,976,597.5 → 30,595,111,387.5 1.249 → 1.211 1268.8 → 1270.3
formbricks-web check 4.551 → 4.609 37,110,046,681 → 37,109,223,686 1.903 → 1.936 1587.6 → 1581.5
formbricks-web incremental 3.734 → 3.798 39,708,900,483 → 39,709,187,611.5 1.120 → 1.110 1628.6 → 1627.3
supabase-studio check 5.426 → 5.445 40,842,244,690 → 40,842,806,786.5 2.320 → 2.356 1316.2 → 1312.5
supabase-studio incremental 4.015 → 4.008 43,791,233,348.5 → 43,789,795,358.5 1.589 → 1.556 1368.5 → 1367.5
t3code-server check 5.170 → 5.084 41,107,679,742.5 → 41,108,867,109.5 1.729 → 1.738 1449.5 → 1454.0
t3code-server incremental 3.750 → 3.720 41,631,922,398.5 → 41,632,030,746 1.438 → 1.586 1307.7 → 1309.5
mikro-orm check 5.657 → 5.714 44,562,705,910 → 44,561,934,851.5 0.998 → 1.042 1285.0 → 1282.7
mikro-orm incremental 4.776 → 4.861 44,870,105,694.5 → 44,869,502,268 1.229 → 1.242 1253.9 → 1255.5
next-packages-next check 1.996 → 2.089 17,410,383,606 → 17,410,258,361 0.469 → 0.461 558.2 → 557.7
next-packages-next incremental 1.650 → 1.741 17,736,122,280 → 17,735,986,443.5 0.508 → 0.520 562.9 → 563.0
next-root check 1.585 → 1.616 13,969,200,389.5 → 13,969,057,691.5 0.321 → 0.317 432.8 → 430.7
next-root incremental 1.852 → 1.910 14,431,365,998 → 14,431,131,589.5 0.588 → 0.583 474.1 → 473.8
storybook check 1.212 → 1.131 8,875,322,053.5 → 8,875,367,351 0.285 → 0.310 398.5 → 399.6
storybook incremental 0.871 → 0.864 9,201,754,157 → 9,201,308,787 0.263 → 0.263 377.1 → 377.2
nuxt check 1.399 → 1.362 8,507,102,950.5 → 8,506,932,125.5 0.236 → 0.223 391.3 → 391.2
nuxt incremental 1.152 → 1.092 8,909,217,547.5 → 8,909,067,220 0.268 → 0.271 392.4 → 393.2
playwright check 1.119 → 1.193 7,408,089,587.5 → 7,407,984,353 0.245 → 0.245 362.5 → 364.1
playwright incremental 0.848 → 0.903 7,581,373,643.5 → 7,581,658,267 0.242 → 0.238 339.9 → 339.9
drizzle-orm check 0.633 → 0.629 5,952,363,808.5 → 5,952,512,639 0.201 → 0.211 380.7 → 384.7
drizzle-orm incremental 0.595 → 0.608 6,124,089,463.5 → 6,124,218,530 0.190 → 0.185 344.9 → 345.3
typeorm check 0.711 → 0.708 6,400,054,756.5 → 6,400,061,695 0.148 → 0.151 227.3 → 227.0
typeorm incremental 1.140 → 1.165 6,777,311,939 → 6,777,401,585 0.294 → 0.275 233.8 → 234.6
date-fns check 0.335 → 0.334 3,357,007,418.5 → 3,357,023,638 0.117 → 0.118 151.2 → 153.0
date-fns incremental 0.415 → 0.414 3,593,549,210.5 → 3,594,197,196.5 0.190 → 0.191 163.1 → 162.9

tsrs-lint

Release tsrs-lint linting each project's source files with all 61 rules. After a warmup run of each binary, alternating main/PR pairs (10 per mode) measure wall time, CPU time and peak RSS with TSRS_FAST unset and with TSRS_FAST=1.

Project Mode Wall time Δ CPU time Δ Peak RSS Δ Diagnostics (main → PR)
webpack default +2.0% +2.9% -0.2% 37261, identical
webpack TSRS_FAST=1 -0.4% +1.4% 0.0% 37261, identical
drizzle-orm default -1.7% +0.4% -0.1% 7079, identical
drizzle-orm TSRS_FAST=1 +0.3% +2.7% +0.2% 7079, identical
xstate-main default 0.0% +0.9% -0.3% 6491, identical
xstate-main TSRS_FAST=1 -0.3% +0.2% -0.1% 6491, identical

Negative means the PR used less. Wall and CPU time deltas are medians of paired PR/main ratios; peak RSS compares medians.

Measured lint medians (main → PR)
Project Mode Wall time (s) CPU time (s) Peak RSS (MiB)
webpack default 1.019 → 1.082 3.198 → 3.284 409.4 → 408.6
webpack TSRS_FAST=1 0.696 → 0.691 3.555 → 3.486 435.8 → 435.6
drizzle-orm default 0.409 → 0.407 1.327 → 1.330 429.3 → 429.0
drizzle-orm TSRS_FAST=1 0.243 → 0.236 1.267 → 1.290 391.1 → 391.7
xstate-main default 0.554 → 0.696 1.677 → 2.029 612.4 → 610.8
xstate-main TSRS_FAST=1 0.474 → 0.476 1.706 → 1.712 598.6 → 597.8

@camc314
camc314 added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit d46d6c0 Nov 5, 2026
71 checks passed
@camc314
camc314 deleted the codex/prefer-includes-regex-escapes branch November 5, 2026 16:42
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