diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-09 21:52:47 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-09 21:52:47 -0800 |
commit | d77b868584c988483fdb7892ccc5af09c6d99f1c (patch) | |
tree | a74d5d5a78e671f6a094906917912c0cd5e25364 /js/bin | |
parent | 0e8c3fc0f2878ad45023dc53d1fbbc53b82b94d2 (diff) |
JS linter improvements.
Diffstat (limited to 'js/bin')
-rwxr-xr-x | js/bin/commonmark | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/js/bin/commonmark b/js/bin/commonmark index 4fcb09d..f0c427c 100755 --- a/js/bin/commonmark +++ b/js/bin/commonmark @@ -10,15 +10,14 @@ var renderer = new commonmark.HtmlRenderer(); var inps = []; var file; var files = []; -var options = { sourcepos: false, }; +var options = { sourcepos: false }; +var i; -for (var i = 2; i < process.argv.length; i++) { +for (i = 2; i < process.argv.length; i++) { var arg = process.argv[i]; - if (arg == '--ast') { - renderer = { render: function(x) { - return util.inspect(x.toAST(), null, 20, true) + '\n'; - } }; - } else if (arg == '--sourcepos') { + if (arg === '--ast') { + renderer = { render: commonmark.ASTRenderer }; + } else if (arg === '--sourcepos') { options.sourcepos = true; } else if (/^--/.test(arg)) { process.stderr.write('Unknown option ' + arg + '\n'); @@ -32,7 +31,7 @@ if (files.length === 0) { files = ['/dev/stdin']; } -for (var i = 0; i < files.length; i++) { +for (i = 0; i < files.length; i++) { file = files[i]; inps.push(fs.readFileSync(file, 'utf8')); } |