Is there a tool to validate ECMAScript and confirm it is compatible with ECMAScript Language Specification 3rd edition?

dgolovin picture dgolovin · Sep 17, 2013 · Viewed 7k times · Source

I am currently trying to figure out why JSDT posts errors like 'JavaScript error on valid regex'.

While I was testing I realized that it works fine for simple files like this:

var a = {
    urlParseRE: /^\s*(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
    test: b.replace(/^\/|(\/[^\/]*|[^\/]+)$/g, "")
};

and reports errors on complex files like jQuery.mobile-1.3.1.min.js.

I used online tool to format mimified jQuery script and then deleted almost all content out of it to make a simple example which would help to replicate the problem. When size of file was reduced from around 3000 to 300 lines some new validation errors were posted before original one above. I ended up my experiment with completely different problem. Validation error was posted on ',' in example below:

!function(){
    window.alert("passed 1");
}(),
function(){
    window.alert("passed 2");
}();
window.alert("passed 3");

I understand that JSDT project was dormant for a while and supports only ECMAScript v3 so before I create new issue I'd like to be sure this last simple js example is correct for ECMAScript Language Specification 3rd edition. Is there any online or offline tool to verify that?

Answer

pkuzhel picture pkuzhel · Apr 6, 2020

A little dated, but https://jshint.com/ points out ES3 and ES5 issues