This task is about the JavaScript portion of T394965: Provide API-powered linting of supported languages in CodeMirror. See parent task for details applicable to all modes/languages we plan to support.
The Peast PHP package is what is used to validate on-wiki JS. It looks like in order to make it available to client, we'll need to create our own API module for it and call Peast::ES2017() directly.
Testing needs to be done to see if this is quick enough to query continuously in the background, like we are doing for T407153. If it's too slow, linting can be provided by a call-to-action (keyboard shortcut, or a button in the WikiEditor toolbar).