AdguardTeam / AdguardTeam/AGLint

Add support for config overrides

Open
#273 0 comments 0 reactions 1 assignee Assigned to @scripthunter7 View on GitHub
Priority: P4 T: Config Version: AGLint v4.0
Dominant language
TypeScript
Stars
70
Forks
4
PR merge metrics
No merged PRs in 30d

Description

If you keep multiple files in the same folder, you cannot define platform-specific configuration per file (e.g., having `adguard-filter.txt` and `ublock-filter.txt` in the same directory). This could be solved with a sub-config file (creating a folder, like `adguard` with a sub-config file and move `adguard-filter.txt` there), but its not always ideal.

We must introduce a way to apply custom configurations for specific files. [Similar to ESLint](https://eslint.org/docs/v8.x/use/configure/configuration-files#how-do-overrides-work), this can be achieved by adding an overrides section.

Suppose you have a directory containing both `adguard-filter.txt` and `ublock-filter.txt`. You need to be able to assign different platforms to them. Something like this:

```yaml
root: true
extends:
- aglint:recommended
overrides:
- files: ['ublock-filter.txt']
platforms: ubo_any
# Also, rules should be customizable
rules:
some-rule: off
- files: ['adguard-filter.txt']
platforms: adg_any
```

The overrides mechanism allows you to define custom linter configurations for individual files or glob patterns.

Reference: https://github.com/AdguardTeam/AGLint/issues/271#issuecomment-3640998219

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.