From dae3a449122951590016ac09b743c6b329cf702d Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 14 Oct 2016 16:53:22 +0700 Subject: [PATCH] make XO happy Locking the version as 0.17.0 requires Node.js 4 --- bench/run.js | 2 +- lib/babel-config.js | 2 +- lib/process-adapter.js | 2 +- lib/reporters/mini.js | 6 +++--- lib/test-worker.js | 3 ++- lib/throws-helper.js | 2 +- package.json | 16 +++------------- test/assert.js | 2 +- test/runner.js | 2 +- test/test.js | 2 +- test/watcher.js | 2 +- 11 files changed, 16 insertions(+), 25 deletions(-) diff --git a/bench/run.js b/bench/run.js index 32484045f..204fee5e1 100644 --- a/bench/run.js +++ b/bench/run.js @@ -76,7 +76,7 @@ if (process.argv.length === 2) { } currentArgs.push(arg); }); - if (currentArgs.length) { + if (currentArgs.length > 0) { list.push({ args: currentArgs, shouldFail: shouldFail diff --git a/lib/babel-config.js b/lib/babel-config.js index 7cac97720..1bfdafb7f 100644 --- a/lib/babel-config.js +++ b/lib/babel-config.js @@ -47,7 +47,7 @@ var defaultPresets = lazy(function () { return [ require('babel-preset-stage-2'), - require(esPreset) + require(esPreset) // eslint-disable-line import/no-dynamic-require ]; }); diff --git a/lib/process-adapter.js b/lib/process-adapter.js index 4919fb008..1e73b591d 100644 --- a/lib/process-adapter.js +++ b/lib/process-adapter.js @@ -59,7 +59,7 @@ if (debug.enabled) { process.argv.push('--sorted'); } - require('time-require'); + require('time-require'); // eslint-disable-line import/no-unassigned-import } var sourceMapCache = Object.create(null); diff --git a/lib/reporters/mini.js b/lib/reporters/mini.js index f4d347fcb..c5d53415f 100644 --- a/lib/reporters/mini.js +++ b/lib/reporters/mini.js @@ -260,7 +260,7 @@ MiniReporter.prototype._update = function (data) { lastLine = lastLine.substring(lastLine.length - (lastLine.length % columns)); // Don't delete the last log line if it's completely empty. - if (lastLine.length) { + if (lastLine.length > 0) { ct++; } @@ -270,7 +270,7 @@ MiniReporter.prototype._update = function (data) { // Rewrite the last log line. str += lastLine; - if (str.length) { + if (str.length > 0) { this.stream.write(str); } @@ -282,7 +282,7 @@ MiniReporter.prototype._update = function (data) { var currentStatus = this.currentStatus; - if (currentStatus.length) { + if (currentStatus.length > 0) { lastLine = this.lastLineTracker.lastLine(); // We need a newline at the end of the last log line, before the status message. // However, if the last log line is the exact width of the terminal a newline is implied, diff --git a/lib/test-worker.js b/lib/test-worker.js index dbdddf3a3..2428bf6d5 100644 --- a/lib/test-worker.js +++ b/lib/test-worker.js @@ -1,6 +1,7 @@ 'use strict'; /* eslint-disable import/order */ var process = require('./process-adapter'); + var opts = process.opts; var testPath = opts.file; @@ -29,7 +30,7 @@ process.installPrecompilerHook(); var dependencies = []; process.installDependencyTracking(dependencies, testPath); -require(testPath); +require(testPath); // eslint-disable-line import/no-dynamic-require process.on('unhandledRejection', throwsHelper); diff --git a/lib/throws-helper.js b/lib/throws-helper.js index c8ff5e527..4335b5f9a 100644 --- a/lib/throws-helper.js +++ b/lib/throws-helper.js @@ -4,7 +4,7 @@ var path = require('path'); var chalk = require('chalk'); var globals = require('./globals'); -module.exports = function throwsHelper(error) { +module.exports = function (error) { if (!error || !error._avaThrowsHelperData) { return; } diff --git a/package.json b/package.json index d2628e01d..1d78dd2b9 100644 --- a/package.json +++ b/package.json @@ -184,22 +184,12 @@ "source-map-fixtures": "^2.1.0", "tap": "^7.1.2", "touch": "^1.0.0", - "xo": "*", + "xo": "^0.16.0", "zen-observable": "^0.3.0" }, "xo": { "rules": { - "import/newline-after-import": 0 - }, - "overrides": [ - { - "files": [ - "test/**/*.js" - ], - "rules": { - "max-lines": 0 - } - } - ] + "import/newline-after-import": "off" + } } } diff --git a/test/assert.js b/test/assert.js index 557b82d0e..3568c92c9 100644 --- a/test/assert.js +++ b/test/assert.js @@ -259,7 +259,7 @@ test('.deepEqual()', function (t) { }); t.throws(function () { - assert.deepEqual(function a() {}, function a() {}); + assert.deepEqual(function () {}, function () {}); }); t.doesNotThrow(function () { diff --git a/test/runner.js b/test/runner.js index c6778e531..d960c4621 100644 --- a/test/runner.js +++ b/test/runner.js @@ -52,7 +52,7 @@ test('tests must be declared synchronously', function (t) { test('runner emits a "test" event', function (t) { var runner = new Runner(); - runner.test(function foo(a) { + runner.test('foo', function (a) { a.pass(); }); diff --git a/test/test.js b/test/test.js index 6fb41cd9f..e284ce86e 100644 --- a/test/test.js +++ b/test/test.js @@ -87,7 +87,7 @@ test('callback is required', function (t) { }); test('infer name from function', function (t) { - var result = ava(function foo(a) { + var result = ava(function foo(a) { // eslint-disable-line func-names a.pass(); }).run(); diff --git a/test/watcher.js b/test/watcher.js index a835940da..b03e9edd1 100644 --- a/test/watcher.js +++ b/test/watcher.js @@ -14,7 +14,7 @@ var setImmediate = require('../lib/globals').setImmediate; // Helper to make using beforeEach less arduous. function makeGroup(test) { - return function group(desc, fn) { + return function (desc, fn) { test(desc, function (t) { var beforeEach = function (fn) { t.beforeEach(function (done) {