AdguardTeam / AGLint

Universal adblock filter list linter
https://www.npmjs.com/package/@adguard/aglint
MIT License
51 stars 3 forks source link

Add support for DNS filtering syntax validation #141

Open ameshkov opened 1 year ago

ameshkov commented 1 year ago

I suggest adding support for linting DNS filtering rules as well: https://adguard-dns.io/kb/general/dns-filtering-syntax/

We'll need to differentiate DNS lists from traditional lists and it seems that the "user agent" string can be used for that. For instance, [AdGuard DNS].

scripthunter7 commented 1 year ago

To achieve this, i think first we should extend the current NetworkRuleParser, e.g. to DnsRuleParser, which can parse /etc/hosts and domains-only syntax. We should also create the corresponding "sub-parsers":

Of course, NetworkRuleParser remains in its current form, we just introduce a new parser that also uses NetworkRuleParser.

pedrohgmacedo commented 1 year ago

A couple examples that don't work on adguard-dns.io dashboard and are not flagged by the linter:

@@/adguard.(com|org|info)/^
@@||/adguard.(com|org|info)/^