AdguardTeam / AGLint

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

Validate regexp values of `$domain` modifier #202

Open zloyden opened 7 months ago

zloyden commented 7 months ago

The linter won't let the rule below through because of a supposedly incorrect value in the domain, but that's not true.

/xyzsports\d+\.xyz\/assets\/images\/\w{3}\//$image,domain=/xyzsports\d+\.xyz/
Screenshot: ![image](https://github.com/AdguardTeam/AGLint/assets/33488229/f6c0676a-2f2c-4884-a680-e3efd5b0c7e2)

scripthunter7 commented 7 months ago

Currently regexp items are not validated for $domain modifier: https://github.com/AdguardTeam/tsurlfilter/blob/e27098b4d328a910a2bf3e2b1649a8675fd89e1f/packages/agtree/src/validator/value.ts#L177-L187

Please temporarily disable the invalid-modifiers rule for this type of filtering rule by adding a ! aglint-disable-next-line invalid-modifiers line before them.

cc @Alex-302

Alex-302 commented 7 months ago

It was added with the necessary rule and comment https://github.com/AdguardTeam/AdguardFilters/commit/c859bcdf68609620d217804a8819012a781ca385#diff-9447c6eb8cb0810a43523b3b8ac678e57f51cabe845101b5c45ab28dc29090e7R3971-R3974

scripthunter7 commented 7 months ago

No need to disable the linter completely for that filtering rule, specifying problematic linter rule name is enough

zloyden commented 7 months ago

I've updated it, thank you)