From 9690d4ecafff914c3640d0e34027065b6897fe5c Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Sat, 5 Sep 2015 23:15:48 +0200 Subject: [PATCH] chore: Fix linting after eslint updates --- lib/config.js | 10 +++++----- lib/file-list.js | 5 +---- lib/reporters/dots.js | 1 - lib/server.js | 8 ++++++-- scripts/init-dev-env.js | 6 ------ test/unit/config.spec.js | 4 +--- test/unit/middleware/runner.spec.js | 1 - test/unit/mocha-globals.js | 1 - test/unit/watcher.spec.js | 1 - test/unit/web-server.spec.js | 11 ----------- 10 files changed, 13 insertions(+), 35 deletions(-) diff --git a/lib/config.js b/lib/config.js index 885aa8751..57cf4aa04 100644 --- a/lib/config.js +++ b/lib/config.js @@ -41,9 +41,9 @@ var createPatternObject = function (pattern) { if (helper.isObject(pattern)) { if (pattern.pattern && helper.isString(pattern.pattern)) { - return helper.isUrlAbsolute(pattern.pattern) ? - new UrlPattern(pattern.pattern) : - new Pattern( + return helper.isUrlAbsolute(pattern.pattern) + ? new UrlPattern(pattern.pattern) + : new Pattern( pattern.pattern, pattern.served, pattern.included, @@ -166,8 +166,8 @@ var normalizeConfig = function (config, configFilePath) { Object.keys(preprocessors).forEach(function (pattern) { var normalizedPattern = helper.normalizeWinPath(basePathResolve(pattern)) - normalizedPreprocessors[normalizedPattern] = helper.isString(preprocessors[pattern]) ? - [preprocessors[pattern]] : preprocessors[pattern] + normalizedPreprocessors[normalizedPattern] = helper.isString(preprocessors[pattern]) + ? [preprocessors[pattern]] : preprocessors[pattern] }) // define custom launchers/preprocessors/reporters - create an inlined plugin diff --git a/lib/file-list.js b/lib/file-list.js index c0d9a9352..f02f2f77e 100644 --- a/lib/file-list.js +++ b/lib/file-list.js @@ -49,7 +49,6 @@ function byPath (a, b) { // preprocess - Function // batchInterval - Number var List = function (patterns, excludes, emitter, preprocess, batchInterval) { - // Store options this._patterns = patterns this._excludes = excludes @@ -80,8 +79,8 @@ var List = function (patterns, excludes, emitter, preprocess, batchInterval) { self._emitModified = function (immediate) { immediate ? emit() : throttledEmit() } - } + // Private Interface // ----------------- @@ -116,7 +115,6 @@ List.prototype._isIncluded = function (path) { // // Returns a File or undefined List.prototype._findFile = function (path, pattern) { - if (!path || !pattern) return if (!this.buckets.has(pattern.pattern)) return @@ -309,7 +307,6 @@ List.prototype.addFile = function (path) { fs.statAsync(path), this._refreshing ]).spread(function (stat) { - file.mtime = stat.mtime return self._preprocess(file) }) diff --git a/lib/reporters/dots.js b/lib/reporters/dots.js index cd80b3049..a0369cacf 100644 --- a/lib/reporters/dots.js +++ b/lib/reporters/dots.js @@ -21,7 +21,6 @@ var DotsReporter = function (formatError, reportSlow) { } this.write(msg) - } this.specSuccess = function () { diff --git a/lib/server.js b/lib/server.js index 6800fbd45..bc7cc11fd 100644 --- a/lib/server.js +++ b/lib/server.js @@ -75,8 +75,12 @@ var Server = function (cliOptions, done) { capturedBrowsers: ['type', BrowserCollection], args: ['value', {}], timer: ['value', { - setTimeout: function () { return setTimeout.apply(root, arguments)}, - clearTimeout: function (timeoutId) { clearTimeout(timeoutId)} + setTimeout: function () { + return setTimeout.apply(root, arguments) + }, + clearTimeout: function (timeoutId) { + clearTimeout(timeoutId) + } }] }] diff --git a/scripts/init-dev-env.js b/scripts/init-dev-env.js index 42d162ba0..a3d6772bc 100755 --- a/scripts/init-dev-env.js +++ b/scripts/init-dev-env.js @@ -40,12 +40,10 @@ var installGruntCli = function (callback) { } else { callback() } - }) gcli.stdout.pipe(process.stdout) gcli.stderr.pipe(process.stderr) - } var checkForGruntCli = function (callback) { @@ -59,7 +57,6 @@ var checkForGruntCli = function (callback) { console.log(stdout) callback() } - }) } @@ -88,7 +85,6 @@ var installDependencies = function () { install.stdout.pipe(process.stdout) install.stderr.pipe(process.stderr) - } var runInit = function () { @@ -96,7 +92,6 @@ var runInit = function () { checkForGruntCli(function cb () { installDependencies() }) - } if (isWin) { @@ -108,7 +103,6 @@ if (isWin) { runInit() } }) - } else { runInit() } diff --git a/test/unit/config.spec.js b/test/unit/config.spec.js index ef2740552..58e769392 100644 --- a/test/unit/config.spec.js +++ b/test/unit/config.spec.js @@ -38,7 +38,7 @@ describe('config', () => { '/home/config4.js': wrapCfg({port: 123, autoWatch: true, basePath: '/abs/base'}), '/home/config6.js': wrapCfg({reporters: 'junit'}), '/home/config7.js': wrapCfg({browsers: ['Chrome', 'Firefox']}), - '/conf/invalid.js': () => {throw new SyntaxError('Unexpected token =')}, + '/conf/invalid.js': () => { throw new SyntaxError('Unexpected token =') }, '/conf/exclude.js': wrapCfg({exclude: ['one.js', 'sub/two.js']}), '/conf/absolute.js': wrapCfg({files: ['http://some.com', 'https://more.org/file.js']}), '/conf/both.js': wrapCfg({files: ['one.js', 'two.js'], exclude: ['third.js']}), @@ -228,7 +228,6 @@ describe('config', () => { }) it('should validate and format the protocol', () => { - var config = normalizeConfigWithDefaults({}) expect(config.protocol).to.equal('http:') @@ -246,7 +245,6 @@ describe('config', () => { config = normalizeConfigWithDefaults({ protocol: 'unsupported:' }) expect(config.protocol).to.equal('http:') - }) }) diff --git a/test/unit/middleware/runner.spec.js b/test/unit/middleware/runner.spec.js index 74758c27f..7b31849d2 100644 --- a/test/unit/middleware/runner.spec.js +++ b/test/unit/middleware/runner.spec.js @@ -29,7 +29,6 @@ describe('middleware.runner', () => { }) beforeEach(() => { - mockReporter = { adapters: [], write (msg) { diff --git a/test/unit/mocha-globals.js b/test/unit/mocha-globals.js index b61c09596..41bddf2cb 100644 --- a/test/unit/mocha-globals.js +++ b/test/unit/mocha-globals.js @@ -44,7 +44,6 @@ chai.use((chai, utils) => { `expected response status to not be set, it was '#{response._status}'`) this.assert(response._body === null, `expected response body to not be set, it was '#{response._body}'`) - }) }) diff --git a/test/unit/watcher.spec.js b/test/unit/watcher.spec.js index 125a67574..5fec31915 100644 --- a/test/unit/watcher.spec.js +++ b/test/unit/watcher.spec.js @@ -2,7 +2,6 @@ import mocks from 'mocks' import path from 'path' describe('watcher', () => { - var config = require('../../lib/config') var m = null diff --git a/test/unit/web-server.spec.js b/test/unit/web-server.spec.js index 1cb9362be..a51c7a1e7 100644 --- a/test/unit/web-server.spec.js +++ b/test/unit/web-server.spec.js @@ -38,7 +38,6 @@ describe('web-server', () => { } describe('request', () => { - beforeEach(() => { customFileHandlers = [] emitter = new EventEmitter() @@ -119,13 +118,10 @@ describe('web-server', () => { .get('/non/existing.html') .expect(404) }) - }) describe('https', () => { - beforeEach(() => { - var credentials = { key: fs.readFileSync(__dirname + '/certificates/server.key'), cert: fs.readFileSync(__dirname + '/certificates/server.crt') @@ -146,17 +142,13 @@ describe('web-server', () => { }]) server = injector.invoke(m.createWebServer) - }) it('should be an instance of https.Server', () => { - expect(server instanceof require('https').Server).to.equal(true) - }) it('should serve client.html', () => { - servedFiles(new Set()) process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' @@ -164,9 +156,6 @@ describe('web-server', () => { return request(server) .get('/') .expect(200, 'CLIENT HTML') - }) - }) - })