From 4ba9a93ddc17dc00f7ba9925c500359d62375d46 Mon Sep 17 00:00:00 2001 From: Magnar Sveen Date: Thu, 21 Mar 2013 09:38:07 +0100 Subject: [PATCH] Support config files named autolint-config.js Fixes #13 --- README.md | 7 +++++++ autolint.js => autolint-config.js | 0 buster.js | 2 +- lib/configuration.js | 8 +++++--- lib/lint-reporter.js | 4 ---- watch-tests.watchr | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) rename autolint.js => autolint-config.js (100%) diff --git a/README.md b/README.md index 666416f..b41fbec 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,13 @@ Autolint watches your files for jslint-errors. DRY up your js-files, freeing them of all those linting config comments. Gather all your linting preferences in one place per project. +Latest changes +--------------------------- + +* The configuration file can now also be called `autolint-config.js` + to avoid issues where Windows will try to execute the `autolint.js` + config file when running `autolint`. + Changes from 0.1.5 to 1.0.0 --------------------------- diff --git a/autolint.js b/autolint-config.js similarity index 100% rename from autolint.js rename to autolint-config.js diff --git a/buster.js b/buster.js index f47badb..cf556f0 100644 --- a/buster.js +++ b/buster.js @@ -4,5 +4,5 @@ config["Node tests"] = { environment: "node", tests: ["test/*.js"], extensions: [require("buster-lint")], - "buster-lint": require("./autolint") + "buster-lint": require("./autolint-config") }; \ No newline at end of file diff --git a/lib/configuration.js b/lib/configuration.js index f8a8dcb..367b2c6 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -10,7 +10,7 @@ if (!fs.existsSync) { module.exports = { exists: function () { - return fs.existsSync("./autolint.js"); + return fs.existsSync("./autolint.js") || fs.existsSync("./autolint-config.js"); }, defaultsPlus: function (config) { @@ -24,13 +24,15 @@ module.exports = { }, load: function () { - var fileConfig = require(process.cwd() + "/autolint"); + var fileConfig = fs.existsSync("./autolint.js") ? + require(process.cwd() + "/autolint") : + require(process.cwd() + "/autolint-config"); return this.defaultsPlus(fileConfig); }, createDefaultConfigFile: function () { if (this.exists()) { - throw new Error("autolint.js already exists in " + process.cwd()); + throw new Error("autolint.js (or autolint-config.js) already exists in " + process.cwd()); } var newFile = fs.createWriteStream('./autolint.js'); diff --git a/lib/lint-reporter.js b/lib/lint-reporter.js index 7b225bf..b8134d2 100644 --- a/lib/lint-reporter.js +++ b/lib/lint-reporter.js @@ -6,10 +6,6 @@ function create(repository) { }); } -function tooManyErrors(errors) { - return errors[errors.length - 1] === null; -} - function printHeader(file) { print.red('', 'Lint in ' + file.name + ', ' + file.errorDescription() + ':'); } diff --git a/watch-tests.watchr b/watch-tests.watchr index 8543cc0..b70500a 100644 --- a/watch-tests.watchr +++ b/watch-tests.watchr @@ -7,7 +7,7 @@ end def run_all_tests system('clear') - result = run "buster test" + result = run "buster test -F warning" puts result end