Validating custom Jenkinsfile
As far as I see, there are two possible approaches, either by misusing reusing the Blue Ocean plugin or using the Groovy-based Jenkinsfile unit test tool.

The groovy approach might be a bit of overhead, since it is not a client-side Javascript verification. An idea would be to run an async task, server side that tests the code the developer provides and returns the results to the client. You mentioned that the shared libraries are not being parsed properly. This might be resolvable through the use of mock Jenkins commands and objects. This might also avoid the security risk which is created through shared libraries, which requires users having push rights.

The client-side solution might be to provide a playground via the Blue Ocean plugin or directly present the Jenkinsfile that has been created via a redirect of the Jenkinsfile to Blue Ocean.

All in all, there is no straight forward JS library solution to your problem, as far as I can tell.