A pattern uses \p{...} without the u or v flag, so it matches the letters p{...} instead of a Unicode property

tx0/ts:property-escape-without-unicode-flagdefaultwarningreliability/strings-and-regexdepth fastbug

What it finds

Unicode property escapes such as \p{L} only work in patterns with the u or v flag. Without it, \p is an escaped p, so /\p{L}+/ matches p{L}, p{LL} and so on, and never a letter.

Reported are patterns with \p{ or \P{ and flags without u and v.

From the rule's source, property_escape_without_unicode_flag.rs.

Example from the rule's tests
export const word = /\p{L}+/;tx0 reports: without the u flagexport const fine = /\p{L}+/u;
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:property-escape-without-unicode-flag" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:property-escape-without-unicode-flag] reason="..."

tx0 explain tx0/ts:property-escape-without-unicode-flag shows the same in the terminal. Found a false positive? Report it.