AdguardTeam / AdguardTeam/AGLint

Add new rule for detecting some unescaped dots

未關閉
#242 0 則留言 1 個 reaction 已指派 1 人 已被 @maximtop 認領 在 GitHub 檢視
Priority: P4 T: Linter rule
主要語言
TypeScript
星號
71
分支
4
PR 合併指標
30 天內沒有已合併 PR

描述

If an unescaped dot (`.`) is found in a regex pattern, and it can be reasonably determined that the dot is still part of a valid domain or is followed by a valid TLD, a warning should be displayed, suggesting that the dot should be escaped.

For example, the following rules:

```adblock
/example.ru\/uploads\/banner\d+.png/
/example.(com|org)/
```
Should be rewritten as:

```adblock
/example\.ru\/uploads\/banner\d+.png/
/example\.(com|org)/
```

This is because an **unescaped dot (`.`)** in a regex pattern represents **any character**, while an **escaped dot (`\.`)** explicitly represents a **literal dot (`.`)**.

Can be autofixed.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。