Skip to content

Commit

Permalink
Support config files named autolint-config.js
Browse files Browse the repository at this point in the history
Fixes #13
  • Loading branch information
magnars committed Mar 21, 2013
1 parent 0c6f754 commit 4ba9a93
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -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 them of all those linting config comments. Gather all your linting preferences
in one place per project. 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 Changes from 0.1.5 to 1.0.0
--------------------------- ---------------------------


Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion buster.js
Expand Up @@ -4,5 +4,5 @@ config["Node tests"] = {
environment: "node", environment: "node",
tests: ["test/*.js"], tests: ["test/*.js"],
extensions: [require("buster-lint")], extensions: [require("buster-lint")],
"buster-lint": require("./autolint") "buster-lint": require("./autolint-config")
}; };
8 changes: 5 additions & 3 deletions lib/configuration.js
Expand Up @@ -10,7 +10,7 @@ if (!fs.existsSync) {


module.exports = { module.exports = {
exists: function () { exists: function () {
return fs.existsSync("./autolint.js"); return fs.existsSync("./autolint.js") || fs.existsSync("./autolint-config.js");
}, },


defaultsPlus: function (config) { defaultsPlus: function (config) {
Expand All @@ -24,13 +24,15 @@ module.exports = {
}, },


load: function () { 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); return this.defaultsPlus(fileConfig);
}, },


createDefaultConfigFile: function () { createDefaultConfigFile: function () {
if (this.exists()) { 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'); var newFile = fs.createWriteStream('./autolint.js');
Expand Down
4 changes: 0 additions & 4 deletions lib/lint-reporter.js
Expand Up @@ -6,10 +6,6 @@ function create(repository) {
}); });
} }


function tooManyErrors(errors) {
return errors[errors.length - 1] === null;
}

function printHeader(file) { function printHeader(file) {
print.red('', 'Lint in ' + file.name + ', ' + file.errorDescription() + ':'); print.red('', 'Lint in ' + file.name + ', ' + file.errorDescription() + ':');
} }
Expand Down
2 changes: 1 addition & 1 deletion watch-tests.watchr
Expand Up @@ -7,7 +7,7 @@ end


def run_all_tests def run_all_tests
system('clear') system('clear')
result = run "buster test" result = run "buster test -F warning"
puts result puts result
end end


Expand Down

0 comments on commit 4ba9a93

Please sign in to comment.