**Problem**
AbuseFilter has its own [[ https://www.mediawiki.org/wiki/Extension:AbuseFilter/Rules_format | domain-specific language ]]. This language must be learned by admins and maintained by developers.
**Proposed Solution**
If admins are more familiar with JavaScript, perhaps it would be better to allow them to write JavaScript. These scripts could be executed in a [[ https://github.com/patriksimek/vm2 | secure vm ]] and function similar to a [[ https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers | Service Worker ]]:
```
lang=javascript
addEventListener('filter', (event) => (
event.action === 'edit' && event.old_wikitext.length > 0 && event.new_wikitext.length === 0 && !event.user_groups.includes('user')
));
```
or we could even make the script itself the handler and the `event` object as the global, which would make it like this:
```
lang=javascript
action === 'edit' && old_wikitext.length > 0 && new_wikitext.length === 0 && !user_groups.includes('user')
```
Or ideally, both syntax options would be allowed with a config when creating the filter.
This would give admins the ability to write filters in standard JavaScript while also maintaining a secure environment for our infrastructure. Doing this should open up the number admins who can write filters, provide additional linting and testing tools, and also remove the amount of code that AbuseFilter has to maintain.