Simple JavaScript linter.
varblint=require("blint");blint.checkFile("foo.js");blint.checkDir("src");
When the linter encounters problems, it will write something tostdout, and set a flag, which you can retrieve withblint.success()
.
process.exit(blint.success() ?0 :1);
BothcheckFile
andcheckDir
take a second optional optionsargument. These are the defaults:
vardefaultOptions={// Version of the language to parseecmaVersion:6,// Whitelist globals exported by the browserbrowser:false,// Allow tabstabs:false,// Allow trailing whitespacetrailingSpace:false,// True to require semicolons, false to disallow themsemicolons:null,// Allow trailing commastrailingCommas:true,// Allow unquoted properties that are reserved wordsreservedProps:true,// Whether to allow console.* expressionsconsole:false,// An array of global variables to allowallowedGlobals:[],// Allow the code to declare top-level variablesdeclareGlobals:true};
Released under an MIT license.