Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace all "var" with "const" & "let" in "resources/*.js" files #1872

Merged
merged 1 commit into from May 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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