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
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

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

  • Loading branch information...
IvanGoncharov committed May 19, 2019
commit 0ffab0e7493d2dbab0353ab8bf38a034815eaa67
@@ -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
@@ -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(
@@ -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'
@@ -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)
@@ -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...')));
@@ -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(() => {
@@ -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`;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.