AdguardTeam / AdguardTeam/AGLint

Add new rule for detecting some unescaped dots

Aperta
#242 0 commenti 1 reazione 1 assegnatario Rivendicata da @maximtop Vedi su GitHub
Priority: P4 T: Linter rule
Lingua principale
TypeScript
Stelle
70
Fork
4
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.