Commit 3ee0da7
fix(lint): exclude [ from frag and alias classes too (linear scan)
Follow-up to the target-class fix (e03e322): the frag class #[^\]|]* and
alias class [^\]]+ still allowed [, so the same O(n^2) backtracking
survived on long ]-free runs seeded with [[a#... or [[a|... (a bare
[[a#*10000 hung ~15s per pass, and lint scans each file twice).
Extend the same [-exclusion to both inner classes:
frag #[^\]|]* -> #[^\[\]|]*
alias [^\]]+ -> [^\[\]]+
Every pathological shape is now linear (20k -> <20ms), and matching on
valid Obsidian syntax is byte-for-byte unchanged (headings, block refs,
aliases, note/attachment embeds, same-page fragments). Adds regression
tests for the frag/alias runs alongside the existing [-run one.
Addresses review follow-up on #180.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent e03e322 commit 3ee0da7
2 files changed
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | | - | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
704 | 728 | | |
705 | 729 | | |
706 | 730 | | |
| |||
0 commit comments