Permalink
Browse files

Attempts to get Esprima validation working.

  • Loading branch information...
arthurakay committed Dec 19, 2012
1 parent 40864ac commit 0197d17700b14a62f53e6a8cf01d5e7c32bbdea8
Showing with 32 additions and 6 deletions.
  1. +27 −0 examples/esprima.js
  2. +5 −6 src/esprima.js
View
@@ -0,0 +1,27 @@
+var LintRoller = require('../src/LintRoller');
+
+var config = {
+ verbose : false,
+ stopOnFirstError : false,
+ logFile : './error.log',
+
+ //recursively include JS files in these folders
+ filepaths : [
+ './'
+ ],
+
+ //but ignore anything in these folders
+ exclusions : [
+ './node_modules/',
+ './assets/',
+ './docs/'
+ ],
+
+ linters : [
+ {
+ type : 'esprima'
+ }
+ ]
+};
+
+LintRoller.init(config);
View
@@ -8,7 +8,7 @@ var linter = {
* @cfg
*/
options : {
-
+ //tolerant: true
},
/**
@@ -43,22 +43,21 @@ var linter = {
file = parentModule.files[j];
js = parentModule.fs.readFileSync(file, 'utf8');
- //TODO: make this work... is that possible?
var i = 0,
result = this.lib.parse(js, this.options),
totalErrors = (result.errors) ? result.errors.length : 0,
error;
if (!result) {
for (i; i < totalErrors; i++) {
- error = this.lib.errors[i];
+ error = result.errors[i];
if (error) {
errorList.push(
file,
- ' Line #: ' + error.line,
- ' Char #: ' + error.character,
- ' Reason: ' + error.reason,
+ ' Line #: ' + error.lineNumber,
+ //' Char #: ' + error.character,
+ ' Reason: ' + error.message,
'',
''
);

0 comments on commit 0197d17

Please sign in to comment.