Skip to content

Commit

Permalink
Replace all "var" with "const" & "let" in "resources/*.js" files
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed May 19, 2019
1 parent 236cb83 commit 0ffab0e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.yml
Expand Up @@ -363,9 +363,7 @@ overrides:
no-console: off
no-sync: off
global-require: off
no-var: off #TODO
no-shadow: off #TODO
vars-on-top: off #TODO
no-unused-vars: off #TODO
no-else-return: off #TODO
object-shorthand: off #TODO
Expand Down
6 changes: 3 additions & 3 deletions resources/inline-invariant.js
Expand Up @@ -26,14 +26,14 @@ module.exports = function inlineInvariant(context) {
return {
visitor: {
CallExpression: function(path) {
var node = path.node;
var parent = path.parent;
const node = path.node;
const parent = path.parent;

if (!isAppropriateInvariantCall(node, parent)) {
return;
}

var args = node.arguments.slice(0);
const args = node.arguments.slice(0);
args[0] = t.numericLiteral(0);

path.replaceWith(
Expand Down
30 changes: 15 additions & 15 deletions resources/watch.js
Expand Up @@ -16,12 +16,12 @@ const flowBinPath = require('flow-bin');

process.env.PATH += ':./node_modules/.bin';

var cmd = resolvePath(__dirname);
var srcDir = resolvePath(cmd, '../src');
const cmd = resolvePath(__dirname);
const srcDir = resolvePath(cmd, '../src');

function exec(command, options) {
return new Promise((resolve, reject) => {
var child = spawn(command, options, {
const child = spawn(command, options, {
cmd: cmd,
env: process.env,
stdio: 'inherit'
Expand All @@ -36,12 +36,12 @@ function exec(command, options) {
});
}

var flowServer = spawn(flowBinPath, ['server'], {
const flowServer = spawn(flowBinPath, ['server'], {
cmd: cmd,
env: process.env
});

var watcher = sane(srcDir, { glob: ['**/*.js', '**/*.graphql'] })
const watcher = sane(srcDir, { glob: ['**/*.js', '**/*.graphql'] })
.on('ready', startWatch)
.on('add', changeFile)
.on('delete', deleteFile)
Expand All @@ -54,10 +54,10 @@ process.on('SIGINT', () => {
process.exit();
});

var isChecking;
var needsCheck;
var toCheck = {};
var timeout;
let isChecking;
let needsCheck;
let toCheck = {};
let timeout;

function startWatch() {
process.stdout.write(CLEARSCREEN + green(invert('watching...')));
Expand Down Expand Up @@ -86,7 +86,7 @@ function guardedCheck() {
return;
}
isChecking = true;
var filepaths = Object.keys(toCheck);
const filepaths = Object.keys(toCheck);
toCheck = {};
needsCheck = false;
checkFiles(filepaths).then(() => {
Expand Down Expand Up @@ -150,18 +150,18 @@ function allTests(filepaths) {
return filepaths.length > 0 && filepaths.every(isTest);
}

var TEST_PATH_RX = /^(?:.*?\/)?__tests__\/.+?-test\.js$/;
const TEST_PATH_RX = /^(?:.*?\/)?__tests__\/.+?-test\.js$/;

function isTest(filepath) {
return TEST_PATH_RX.test(filepath);
}

// Print helpers

var CLEARSCREEN = '\u001b[2J';
var CLEARLINE = '\r\x1B[K';
var CHECK = green('\u2713');
var X = red('\u2718');
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`;
Expand Down

0 comments on commit 0ffab0e

Please sign in to comment.