return 42; // Return statement not inside a function function f() { 'use strict'; // No more octal var x = 042; // Duplicate property var y = { x: 1, x: 2 }; // With statement can't be used with (z) {} }
Unlike a typical code linter, this syntax validator does not care about coding styles and formatting.
If there is a syntax error, the sign will be shown in the left-side gutter. Placing the mouse cursor over that sign will reveal the complete error description.
For a command-line usage, check esvalidate from Esprima package (for Node.js). There is also a plugin for Grunt called grunt-jsvalidate. Ant users can take a look at an exemplary Ant task for syntax validation.
Esprima is created and mantained by Ariya Hidayat.