diff --git a/.eslintrc.yml b/.eslintrc.yml index 8c7f05ca78..54c975459e 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -363,9 +363,5 @@ overrides: no-console: off no-sync: off global-require: off - no-shadow: off #TODO - no-unused-vars: off #TODO - no-else-return: off #TODO - object-shorthand: off #TODO no-inner-declarations: off #TODO prettier/prettier: off #TODO diff --git a/resources/benchmark.js b/resources/benchmark.js index e383bcd282..50dfb330c3 100644 --- a/resources/benchmark.js +++ b/resources/benchmark.js @@ -50,30 +50,30 @@ function prepareRevision(revision) { if (revision === LOCAL) { return babelBuild(LOCAL_DIR()); - } else { - if (!fs.existsSync(TEMP_DIR())) { - fs.mkdirSync(TEMP_DIR()); - } + } - const hash = hashForRevision(revision); - const dir = TEMP_DIR(hash); + if (!fs.existsSync(TEMP_DIR())) { + fs.mkdirSync(TEMP_DIR()); + } - if (!fs.existsSync(dir)) { - fs.mkdirSync(dir); - execSync(`git archive "${hash}" | tar -xC "${dir}"`); - execSync('yarn install', { cwd: dir }); - } - for (const file of findFiles(LOCAL_DIR('src'), '*/__tests__/*')) { - const from = LOCAL_DIR('src', file); - const to = path.join(dir, 'src', file); - fs.copyFileSync(from, to); - } - execSync( - `cp -R "${LOCAL_DIR()}/src/__fixtures__/" "${dir}/src/__fixtures__/"` - ); + const hash = hashForRevision(revision); + const dir = TEMP_DIR(hash); - return babelBuild(dir); + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir); + execSync(`git archive "${hash}" | tar -xC "${dir}"`); + execSync('yarn install', { cwd: dir }); } + for (const file of findFiles(LOCAL_DIR('src'), '*/__tests__/*')) { + const from = LOCAL_DIR('src', file); + const to = path.join(dir, 'src', file); + fs.copyFileSync(from, to); + } + execSync( + `cp -R "${LOCAL_DIR()}/src/__fixtures__/" "${dir}/src/__fixtures__/"` + ); + + return babelBuild(dir); } function babelBuild(dir) { diff --git a/resources/build.js b/resources/build.js index 3181aa9e9c..90acfaac18 100644 --- a/resources/build.js +++ b/resources/build.js @@ -9,7 +9,6 @@ 'use strict'; -const fs = require('fs'); const path = require('path'); const assert = require('assert'); const babel = require('@babel/core'); diff --git a/resources/fs-utils.js b/resources/fs-utils.js index 60d0eeb9f8..310292388a 100644 --- a/resources/fs-utils.js +++ b/resources/fs-utils.js @@ -12,8 +12,8 @@ const fs = require('fs'); const path = require('path'); -function mkdirRecursive(path) { - fs.mkdirSync(path, { recursive: true }); +function mkdirRecursive(dirPath) { + fs.mkdirSync(dirPath, { recursive: true }); } function rmdirRecursive(dirPath) { diff --git a/resources/inline-invariant.js b/resources/inline-invariant.js index 93ea54593f..88d1da8f95 100644 --- a/resources/inline-invariant.js +++ b/resources/inline-invariant.js @@ -25,7 +25,7 @@ module.exports = function inlineInvariant(context) { return { visitor: { - CallExpression: function(path) { + CallExpression(path) { const node = path.node; const parent = path.parent; diff --git a/resources/watch.js b/resources/watch.js index f135f3e364..365c0bc2fb 100644 --- a/resources/watch.js +++ b/resources/watch.js @@ -22,7 +22,7 @@ const srcDir = resolvePath(cmd, '../src'); function exec(command, options) { return new Promise((resolve, reject) => { const child = spawn(command, options, { - cmd: cmd, + cmd, env: process.env, stdio: 'inherit' }); @@ -37,7 +37,7 @@ function exec(command, options) { } const flowServer = spawn(flowBinPath, ['server'], { - cmd: cmd, + cmd, env: process.env }); @@ -160,17 +160,11 @@ function isTest(filepath) { const CLEARSCREEN = '\u001b[2J'; const CLEARLINE = '\r\x1B[K'; -const CHECK = green('\u2713'); -const X = red('\u2718'); function invert(str) { return `\u001b[7m ${str} \u001b[27m`; } -function red(str) { - return `\x1B[K\u001b[1m\u001b[31m${str}\u001b[39m\u001b[22m`; -} - function green(str) { return `\x1B[K\u001b[1m\u001b[32m${str}\u001b[39m\u001b[22m`; }