Skip to content

Instantly share code, notes, and snippets.

@lorenzoongithub
Created May 28, 2015 20:18
Show Gist options
  • Save lorenzoongithub/ab80cb31fd77ba277d48 to your computer and use it in GitHub Desktop.
Save lorenzoongithub/ab80cb31fd77ba277d48 to your computer and use it in GitHub Desktop.
jshint.js
//
// http://jshint.com - a JavaScript Code Quality Tool
//
load('https://cdnjs.cloudflare.com/ajax/libs/jshint/2.7.0/jshint.js');
JSHINT('var a=0;');
if (JSHINT.errors.length != 0) throw '';
JSHINT('var a=0');
if (JSHINT.errors.length != 1) throw '';
if (JSHINT.errors[0].raw !== 'Missing semicolon.') throw '';
JSHINT('function f() { }');
if (JSHINT.errors.length != 0) throw '';
JSHINT('function f() { ; }');
if (JSHINT.errors.length != 1) throw '';
if (JSHINT.errors[0].raw !== 'Unnecessary semicolon.') throw '';
JSHINT('broken');
if (JSHINT.errors[0].raw !== 'Expected an assignment or function call and instead saw an expression.') throw '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment