Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added --once option to autolint.

 - reports all errors in all files
 - prints summary
 - then exits, no auto
  • Loading branch information...
commit f05bf7fdeed26df88e04bc4a092896fcf537d666 1 parent 70ab1fc
@magnars authored
Showing with 32 additions and 4 deletions.
  1. +4 −2 bin/autolint
  2. +19 −0 lib/lint-once.js
  3. +9 −2 todo.md
View
6 bin/autolint
@@ -1,12 +1,14 @@
#!/usr/bin/env node
-var startAutolint = require('../lib/start-autolint');
+var lintOnce = process.argv[2] === "--once";
+var lint = lintOnce ? require('../lib/lint-once') : require('../lib/start-autolint');
+
var configuration = require('../lib/configuration');
var cliConfirm = require("../lib/cli-confirm");
var util = require('util');
if (configuration.exists()) {
- startAutolint(configuration.load());
+ lint(configuration.load());
} else {
util.puts("No configuration file (autolint.js) found in this directory.");
util.puts("Autolint can create a default config file for you.");
View
19 lib/lint-once.js
@@ -0,0 +1,19 @@
+var glob = require('glob');
+
+module.exports = function (conf) {
+ var linter = require('./' + conf.linter + '-linter').create(conf.linterOptions);
+
+ var lintScanner = require('./lint-scanner').create(linter, glob, conf.excludes);
+ var repository = require('./repository').create(linter);
+
+ var lintReporter = require('./lint-reporter').create(repository);
+ var summaryReporter = require('./summary-reporter').create(repository);
+
+ repository.listen();
+ lintReporter.listen();
+
+ lintScanner.scan(conf.paths).then(function () {
+ summaryReporter.print();
+ });
+
+};
View
11 todo.md
@@ -1,11 +1,18 @@
Todo
====
+* default config files for both jslint and jshint
+
+* rename to drylint
+
+* create plugin for js2-mode.el that sets global-externs
+
+* a website
+
* being blamed for introducing an error, AND praised for fixing it,
- when changing around whitespace (changes lines)
+ when changing around whitespace (changes line numbers)
* keep getting "nice cleanup!" in a file with too many errors
* files with more than 50 errors are reported as having 52 errors.
* switching git branches can be spammy, any way around that?
-
Please sign in to comment.
Something went wrong with that request. Please try again.