AdguardTeam / AdguardTeam/AGLint

Add linter rule for detecting useless filter anchors at start/end of network rule patterns

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

描述

Certain network filter patterns contain meaningless or redundant anchors that do not affect matching and should be removed. Two cases should be detected:

### 1. Useless filter start

Patterns starting with `|*`, e.g.:

```adblock
|*foo
```

This combination is semantically useless (`|` anchors to the start, `*` matches anything).

### 2. Useless filter end

Patterns ending with sequences like:

```adblock
foo*^
foo*|
foo*^|
foo*^^|
*|
***^
```

These endings provide no meaningful restriction and are effectively redundant.

We should introduce a linter rule that:
- detects useless start/end constructs
- reports them as warnings,
- provides autofix by removing the redundant part of the pattern.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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