From 24c2fb2afcf70c5910d55b0521ec623d57b7f209 Mon Sep 17 00:00:00 2001 From: Breno Calazans Date: Thu, 15 Oct 2015 22:00:44 -0300 Subject: [PATCH] Fix linter errors and warnings from resources files --- resources/interfaces/express.js | 1 + resources/mocha-bootload.js | 3 ++- resources/watch.js | 21 ++++++++++++--------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/resources/interfaces/express.js b/resources/interfaces/express.js index 67013a3d..5d648960 100644 --- a/resources/interfaces/express.js +++ b/resources/interfaces/express.js @@ -1,5 +1,6 @@ /* @flow */ /* Flow declarations for express requests and responses */ +/* eslint-disable no-unused-vars */ declare class Request { method: String; body: Object; diff --git a/resources/mocha-bootload.js b/resources/mocha-bootload.js index c86a7558..3ecd23e3 100644 --- a/resources/mocha-bootload.js +++ b/resources/mocha-bootload.js @@ -6,9 +6,10 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +/* eslint-disable no-console */ require('babel/register')({ - optional: ['es7.asyncFunctions'] + optional: [ 'es7.asyncFunctions' ] }); process.on('unhandledRejection', function (error) { diff --git a/resources/watch.js b/resources/watch.js index 33c6fe9e..43482b0a 100644 --- a/resources/watch.js +++ b/resources/watch.js @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +/* eslint-disable no-console */ import sane from 'sane'; import { resolve as resolvePath } from 'path'; @@ -21,7 +22,7 @@ var srcDir = resolvePath(cmd, './src'); function exec(command, options) { return new Promise(function (resolve, reject) { var child = spawn(command, options, { - cmd: cmd, + cmd, env: process.env, stdio: 'inherit' }); @@ -35,12 +36,12 @@ function exec(command, options) { }); } -var flowServer = spawn(flowBinPath, ['server'], { - cmd: cmd, +var flowServer = spawn(flowBinPath, [ 'server' ], { + cmd, env: process.env }); -var watcher = sane(srcDir, { glob: ['**/*.js', '**/*.graphql'] }) +var watcher = sane(srcDir, { glob: [ '**/*.js', '**/*.graphql' ] }) .on('ready', startWatch) .on('add', changeFile) .on('delete', deleteFile) @@ -134,7 +135,8 @@ function runTests(filepaths) { '--reporter', 'progress', '--require', 'resources/mocha-bootload' ].concat( - allTests(filepaths) ? filepaths.map(srcPath) : ['src/**/__tests__/**/*.js'] + allTests(filepaths) ? filepaths.map(srcPath) : + [ 'src/**/__tests__/**/*.js' ] )).catch(() => false); } @@ -144,10 +146,11 @@ function lintFiles(filepaths) { return filepaths.reduce((prev, filepath) => prev.then(prevSuccess => { if (isJS(filepath)) { process.stdout.write(' ' + filepath + ' ...'); - return exec('eslint', [srcPath(filepath)]) + return exec('eslint', [ srcPath(filepath) ]) .catch(() => false) .then(success => { - console.log(CLEARLINE + ' ' + (success ? CHECK : X) + ' ' + filepath); + let msg = CLEARLINE + ' ' + (success ? CHECK : X) + ' ' + filepath; + console.log(msg); return prevSuccess && success; }); } @@ -157,7 +160,7 @@ function lintFiles(filepaths) { function typecheckStatus() { console.log('\nType Checking\n'); - return exec(flowBinPath, ['status']).catch(() => false); + return exec(flowBinPath, [ 'status' ]).catch(() => false); } // Filepath @@ -177,7 +180,7 @@ function allTests(filepaths) { } function isTest(filepath) { - return isJS(filepath) && ~filepath.indexOf('__tests__/'); + return isJS(filepath) && filepath.indexOf('__tests__/') !== -1; } // Print helpers