AdguardTeam / AdguardTeam/AGLint

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

Đang mở
#265 0 bình luận 1 reaction 1 người được giao Được @maximtop nhận Xem trên GitHub
Priority: P4 T: Linter rule
Ngôn ngữ chính
TypeScript
Star
70
Fork
4
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.