diff --git a/packages/create-react-app/createReactApp.js b/packages/create-react-app/createReactApp.js index 10935928b4c..d6b6b2edbc0 100755 --- a/packages/create-react-app/createReactApp.js +++ b/packages/create-react-app/createReactApp.js @@ -85,19 +85,13 @@ const program = new commander.Command(packageJson.name) ); console.log(` - a specific npm version: ${chalk.green('0.8.2')}`); console.log( - ` - a custom fork published on npm: ${chalk.green( - 'my-react-scripts' - )}` + ` - a custom fork published on npm: ${chalk.green('my-react-scripts')}` ); console.log( - ` - a .tgz archive: ${chalk.green( - 'https://mysite.com/my-react-scripts-0.8.2.tgz' - )}` + ` - a .tgz archive: ${chalk.green('https://mysite.com/my-react-scripts-0.8.2.tgz')}` ); console.log( - ` - a .tar.gz archive: ${chalk.green( - 'https://mysite.com/my-react-scripts-0.8.2.tar.gz' - )}` + ` - a .tar.gz archive: ${chalk.green('https://mysite.com/my-react-scripts-0.8.2.tar.gz')}` ); console.log( ` It is not needed unless you specifically want to use a fork.` @@ -107,9 +101,7 @@ const program = new commander.Command(packageJson.name) ` If you have any problems, do not hesitate to file an issue:` ); console.log( - ` ${chalk.cyan( - 'https://github.com/facebookincubator/create-react-app/issues/new' - )}` + ` ${chalk.cyan('https://github.com/facebookincubator/create-react-app/issues/new')}` ); console.log(); }) @@ -297,19 +289,15 @@ function run( console.log('Installing packages. This might take a couple of minutes.'); getPackageName(packageToInstall) - .then(packageName => - checkIfOnline(useYarn).then(isOnline => ({ - isOnline: isOnline, - packageName: packageName, - })) - ) + .then(packageName => checkIfOnline(useYarn).then(isOnline => ({ + isOnline: isOnline, + packageName: packageName, + }))) .then(info => { const isOnline = info.isOnline; const packageName = info.packageName; console.log( - `Installing ${chalk.cyan('react')}, ${chalk.cyan( - 'react-dom' - )}, and ${chalk.cyan(packageName)}...` + `Installing ${chalk.cyan('react')}, ${chalk.cyan('react-dom')}, and ${chalk.cyan(packageName)}...` ); console.log(); @@ -367,9 +355,7 @@ function run( if (!remainingFiles.length) { // Delete target folder if empty console.log( - `Deleting ${chalk.cyan(`${appName}/`)} from ${chalk.cyan( - path.resolve(root, '..') - )}` + `Deleting ${chalk.cyan(`${appName}/`)} from ${chalk.cyan(path.resolve(root, '..'))}` ); process.chdir(path.resolve(root, '..')); fs.removeSync(path.join(root)); @@ -385,10 +371,7 @@ function getInstallPackage(version, originalDirectory) { if (validSemver) { packageToInstall += `@${validSemver}`; } else if (version && version.match(/^file:/)) { - packageToInstall = `file:${path.resolve( - originalDirectory, - version.match(/^file:(.*)?$/)[1] - )}`; + packageToInstall = `file:${path.resolve(originalDirectory, version.match(/^file:(.*)?$/)[1])}`; } else if (version) { // for tar.gz or alternative paths packageToInstall = version; @@ -462,9 +445,7 @@ function getPackageName(installPackage) { /^.+\/(.+?)(?:-\d+.+)?\.(tgz|tar\.gz)$/ )[1]; console.log( - `Based on the filename, assuming it is "${chalk.cyan( - assumedProjectName - )}"` + `Based on the filename, assuming it is "${chalk.cyan(assumedProjectName)}"` ); return Promise.resolve(assumedProjectName); }); @@ -493,9 +474,7 @@ function checkNpmVersion() { let hasMinNpm = false; let npmVersion = null; try { - npmVersion = execSync('npm --version') - .toString() - .trim(); + npmVersion = execSync('npm --version').toString().trim(); hasMinNpm = semver.gte(npmVersion, '3.0.0'); } catch (err) { // ignore @@ -536,9 +515,7 @@ function checkAppName(appName) { const validationResult = validateProjectName(appName); if (!validationResult.validForNewPackages) { console.error( - `Could not create a project called ${chalk.red( - `"${appName}"` - )} because of npm naming restrictions:` + `Could not create a project called ${chalk.red(`"${appName}"`)} because of npm naming restrictions:` ); printValidationResults(validationResult.errors); printValidationResults(validationResult.warnings); @@ -550,9 +527,7 @@ function checkAppName(appName) { if (dependencies.indexOf(appName) >= 0) { console.error( chalk.red( - `We cannot create a project called ${chalk.green( - appName - )} because a dependency with the same name exists.\n` + + `We cannot create a project called ${chalk.green(appName)} because a dependency with the same name exists.\n` + `Due to the way npm works, the following names are not allowed:\n\n` ) + chalk.cyan(dependencies.map(depName => ` ${depName}`).join('\n')) + @@ -574,9 +549,7 @@ function makeCaretRange(dependencies, name) { if (!semver.validRange(patchedVersion)) { console.error( - `Unable to patch ${name} dependency version because version ${chalk.red( - version - )} will become invalid ${chalk.red(patchedVersion)}` + `Unable to patch ${name} dependency version because version ${chalk.red(version)} will become invalid ${chalk.red(patchedVersion)}` ); patchedVersion = version; } @@ -675,9 +648,7 @@ function getProxy() { } else { try { // Trying to read https-proxy from .npmrc - let httpsProxy = execSync('npm config get https-proxy') - .toString() - .trim(); + let httpsProxy = execSync('npm config get https-proxy').toString().trim(); return httpsProxy !== 'null' ? httpsProxy : undefined; } catch (e) { return; @@ -721,21 +692,15 @@ function checkThatNpmCanReadCwd() { chalk.red( `Could not start an npm process in the right directory.\n\n` + `The current directory is: ${chalk.bold(cwd)}\n` + - `However, a newly started npm process runs in: ${chalk.bold( - npmCWD - )}\n\n` + + `However, a newly started npm process runs in: ${chalk.bold(npmCWD)}\n\n` + `This is probably caused by a misconfigured system terminal shell.` ) ); if (process.platform === 'win32') { console.error( chalk.red(`On Windows, this can usually be fixed by running:\n\n`) + - ` ${chalk.cyan( - 'reg' - )} delete "HKCU\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n` + - ` ${chalk.cyan( - 'reg' - )} delete "HKLM\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n\n` + + ` ${chalk.cyan('reg')} delete "HKCU\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n` + + ` ${chalk.cyan('reg')} delete "HKLM\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n\n` + chalk.red(`Try to run the above two lines in the terminal.\n`) + chalk.red( `To learn more about this problem, read: https://blogs.msdn.microsoft.com/oldnewthing/20071121-00/?p=24433/` diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index de803cf72e7..b69a01a4f55 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -168,14 +168,12 @@ module.exports = { { object: 'require', property: 'ensure', - message: - 'Please use import() instead. More info: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting', + message: 'Please use import() instead. More info: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting', }, { object: 'System', property: 'import', - message: - 'Please use import() instead. More info: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting', + message: 'Please use import() instead. More info: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting', }, ], 'getter-return': 'warn', diff --git a/packages/react-dev-utils/FileSizeReporter.js b/packages/react-dev-utils/FileSizeReporter.js index 68aae411f12..2f0846c66d8 100644 --- a/packages/react-dev-utils/FileSizeReporter.js +++ b/packages/react-dev-utils/FileSizeReporter.js @@ -42,11 +42,10 @@ function printFileSizesAfterBuild( ), name: path.basename(asset.name), size: size, - sizeLabel: - filesize(size) + (difference ? ' (' + difference + ')' : '') + sizeLabel: filesize(size) + + (difference ? ' (' + difference + ')' : ''), }; - }) - ) + })) .reduce((single, all) => all.concat(single), []); assets.sort((a, b) => b.size - a.size); var longestSizeLabelLength = Math.max.apply( @@ -128,12 +127,15 @@ function measureFileSizesBeforeBuild(buildFolder) { if (!err && fileNames) { sizes = fileNames .filter(fileName => /\.(js|css)$/.test(fileName)) - .reduce((memo, fileName) => { - var contents = fs.readFileSync(fileName); - var key = removeFileNameHash(buildFolder, fileName); - memo[key] = gzipSize(contents); - return memo; - }, {}); + .reduce( + (memo, fileName) => { + var contents = fs.readFileSync(fileName); + var key = removeFileNameHash(buildFolder, fileName); + memo[key] = gzipSize(contents); + return memo; + }, + {} + ); } resolve({ root: buildFolder, diff --git a/packages/react-dev-utils/ModuleScopePlugin.js b/packages/react-dev-utils/ModuleScopePlugin.js index 101a30a1fb9..39cd8903011 100644 --- a/packages/react-dev-utils/ModuleScopePlugin.js +++ b/packages/react-dev-utils/ModuleScopePlugin.js @@ -50,24 +50,13 @@ class ModuleScopePlugin { // Error if in a parent directory of src/ const requestRelative = path.relative(appSrc, requestFullPath); if ( - requestRelative.startsWith('../') || - requestRelative.startsWith('..\\') + requestRelative.startsWith('../') || requestRelative.startsWith('..\\') ) { callback( new Error( - `You attempted to import ${chalk.cyan( - request.__innerRequest_request - )} which falls outside of the project ${chalk.cyan( - 'src/' - )} directory. ` + - `Relative imports outside of ${chalk.cyan( - 'src/' - )} are not supported. ` + - `You can either move it inside ${chalk.cyan( - 'src/' - )}, or add a symlink to it from project's ${chalk.cyan( - 'node_modules/' - )}.` + `You attempted to import ${chalk.cyan(request.__innerRequest_request)} which falls outside of the project ${chalk.cyan('src/')} directory. ` + + `Relative imports outside of ${chalk.cyan('src/')} are not supported. ` + + `You can either move it inside ${chalk.cyan('src/')}, or add a symlink to it from project's ${chalk.cyan('node_modules/')}.` ), request ); diff --git a/packages/react-dev-utils/WebpackDevServerUtils.js b/packages/react-dev-utils/WebpackDevServerUtils.js index 1208d7fc776..29beb9a48ba 100644 --- a/packages/react-dev-utils/WebpackDevServerUtils.js +++ b/packages/react-dev-utils/WebpackDevServerUtils.js @@ -35,20 +35,18 @@ if (isSmokeTest) { } function prepareUrls(protocol, host, port) { - const formatUrl = hostname => - url.format({ - protocol, - hostname, - port, - pathname: '/', - }); - const prettyPrintUrl = hostname => - url.format({ - protocol, - hostname, - port: chalk.bold(port), - pathname: '/', - }); + const formatUrl = hostname => url.format({ + protocol, + hostname, + port, + pathname: '/', + }); + const prettyPrintUrl = hostname => url.format({ + protocol, + hostname, + port: chalk.bold(port), + pathname: '/', + }); const isUnspecifiedHost = host === '0.0.0.0' || host === '::'; let prettyHost, lanUrlForConfig, lanUrlForTerminal; @@ -325,12 +323,10 @@ function prepareProxy(proxy, appPublicFolder) { // However API calls like `fetch()` won’t generally accept text/html. // If this heuristic doesn’t work well for you, use a custom `proxy` object. context: function(pathname, req) { - return ( - req.method !== 'GET' || + return req.method !== 'GET' || (mayProxy(pathname) && req.headers.accept && - req.headers.accept.indexOf('text/html') === -1) - ); + req.headers.accept.indexOf('text/html') === -1); }, onProxyReq: proxyReq => { // Browers may send Origin headers even with same-origin @@ -386,40 +382,39 @@ function prepareProxy(proxy, appPublicFolder) { function choosePort(host, defaultPort) { return detect(defaultPort, host).then( - port => - new Promise(resolve => { - if (port === defaultPort) { - return resolve(port); - } - const message = - process.platform !== 'win32' && defaultPort < 1024 && !isRoot() - ? `Admin permissions are required to run a server on a port below 1024.` - : `Something is already running on port ${defaultPort}.`; - if (isInteractive) { - clearConsole(); - const existingProcess = getProcessForPort(defaultPort); - const question = { - type: 'confirm', - name: 'shouldChangePort', - message: - chalk.yellow( - message + - `${existingProcess ? ` Probably:\n ${existingProcess}` : ''}` - ) + '\n\nWould you like to run the app on another port instead?', - default: true, - }; - inquirer.prompt(question).then(answer => { - if (answer.shouldChangePort) { - resolve(port); - } else { - resolve(null); - } - }); - } else { - console.log(chalk.red(message)); - resolve(null); - } - }), + port => new Promise(resolve => { + if (port === defaultPort) { + return resolve(port); + } + const message = process.platform !== 'win32' && + defaultPort < 1024 && + !isRoot() + ? `Admin permissions are required to run a server on a port below 1024.` + : `Something is already running on port ${defaultPort}.`; + if (isInteractive) { + clearConsole(); + const existingProcess = getProcessForPort(defaultPort); + const question = { + type: 'confirm', + name: 'shouldChangePort', + message: chalk.yellow( + message + + `${existingProcess ? ` Probably:\n ${existingProcess}` : ''}` + ) + '\n\nWould you like to run the app on another port instead?', + default: true, + }; + inquirer.prompt(question).then(answer => { + if (answer.shouldChangePort) { + resolve(port); + } else { + resolve(null); + } + }); + } else { + console.log(chalk.red(message)); + resolve(null); + } + }), err => { throw new Error( chalk.red(`Could not find an open port at ${chalk.bold(host)}.`) + diff --git a/packages/react-dev-utils/browsersHelper.js b/packages/react-dev-utils/browsersHelper.js index 02e46d3ecf5..b9891bc7f9e 100644 --- a/packages/react-dev-utils/browsersHelper.js +++ b/packages/react-dev-utils/browsersHelper.js @@ -33,9 +33,7 @@ function checkBrowsers(dir, retry = true) { 'As of react-scripts >=2 you must specify targeted browsers.' ) + os.EOL + - `Please add a ${chalk.underline( - 'browserslist' - )} key to your ${chalk.bold('package.json')}.` + `Please add a ${chalk.underline('browserslist')} key to your ${chalk.bold('package.json')}.` ) ); } @@ -43,45 +41,36 @@ function checkBrowsers(dir, retry = true) { const question = { type: 'confirm', name: 'shouldSetBrowsers', - message: - chalk.yellow("We're unable to detect target browsers.") + - `\n\nWould you like to add the defaults to your ${chalk.bold( - 'package.json' - )}?`, + message: chalk.yellow("We're unable to detect target browsers.") + + `\n\nWould you like to add the defaults to your ${chalk.bold('package.json')}?`, default: true, }; return inquirer.prompt(question).then(answer => { if (answer.shouldSetBrowsers) { - return ( - pkgUp(dir) - .then(filePath => { - if (filePath == null) { - return Promise.reject(); - } - const pkg = JSON.parse(fs.readFileSync(filePath)); - pkg['browserslist'] = defaultBrowsers; - fs.writeFileSync(filePath, JSON.stringify(pkg, null, 2) + os.EOL); + return pkgUp(dir) + .then(filePath => { + if (filePath == null) { + return Promise.reject(); + } + const pkg = JSON.parse(fs.readFileSync(filePath)); + pkg['browserslist'] = defaultBrowsers; + fs.writeFileSync(filePath, JSON.stringify(pkg, null, 2) + os.EOL); - browserslist.clearCaches(); - console.log(); - console.log(chalk.green('Set target browsers:')); - console.log(); - console.log( - `\t${chalk.bold('Production')}: ${chalk.cyan( - defaultBrowsers.production.join(', ') - )}` - ); - console.log( - `\t${chalk.bold('Development')}: ${chalk.cyan( - defaultBrowsers.development.join(', ') - )}` - ); - console.log(); - }) - // Swallow any error - .catch(() => {}) - .then(() => checkBrowsers(dir, false)) - ); + browserslist.clearCaches(); + console.log(); + console.log(chalk.green('Set target browsers:')); + console.log(); + console.log( + `\t${chalk.bold('Production')}: ${chalk.cyan(defaultBrowsers.production.join(', '))}` + ); + console.log( + `\t${chalk.bold('Development')}: ${chalk.cyan(defaultBrowsers.development.join(', '))}` + ); + console.log(); + }) + // Swallow any error + .catch(() => {}) + .then(() => checkBrowsers(dir, false)); } else { return checkBrowsers(dir, false); } diff --git a/packages/react-dev-utils/clearConsole.js b/packages/react-dev-utils/clearConsole.js index cb02af89237..2099a57ec35 100644 --- a/packages/react-dev-utils/clearConsole.js +++ b/packages/react-dev-utils/clearConsole.js @@ -8,7 +8,9 @@ 'use strict'; function clearConsole() { - process.stdout.write(process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H'); + process.stdout.write( + process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H' + ); } module.exports = clearConsole; diff --git a/packages/react-dev-utils/eslintFormatter.js b/packages/react-dev-utils/eslintFormatter.js index f18c7307081..17d9f1907b8 100644 --- a/packages/react-dev-utils/eslintFormatter.js +++ b/packages/react-dev-utils/eslintFormatter.js @@ -81,8 +81,7 @@ function formatter(results) { // it here because we always show at most one error, and // we can only be sure it's an ESLint error before exiting // this function. - output += - 'Search for the ' + + output += 'Search for the ' + chalk.underline(chalk.red('keywords')) + ' to learn more about each error.'; } diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js index f9eda7752b4..91e9e90fa39 100644 --- a/packages/react-dev-utils/getProcessForPort.js +++ b/packages/react-dev-utils/getProcessForPort.js @@ -58,7 +58,9 @@ function getProcessCommand(processId, processDirectory) { function getDirectoryOfProcessById(processId) { return execSync( - 'lsof -p ' + processId + ' | awk \'$4=="cwd" {for (i=9; i<=NF; i++) printf "%s ", $i}\'', + 'lsof -p ' + + processId + + ' | awk \'$4=="cwd" {for (i=9; i<=NF; i++) printf "%s ", $i}\'', execOptions ).trim(); } @@ -68,12 +70,10 @@ function getProcessForPort(port) { var processId = getProcessIdOnPort(port); var directory = getDirectoryOfProcessById(processId); var command = getProcessCommand(processId, directory); - return ( - chalk.cyan(command) + + return chalk.cyan(command) + chalk.grey(' (pid ' + processId + ')\n') + chalk.blue(' in ') + - chalk.cyan(directory) - ); + chalk.cyan(directory); } catch (e) { return null; } diff --git a/packages/react-dev-utils/ignoredFiles.js b/packages/react-dev-utils/ignoredFiles.js index 73a6e8bc5cf..59861501d54 100644 --- a/packages/react-dev-utils/ignoredFiles.js +++ b/packages/react-dev-utils/ignoredFiles.js @@ -12,9 +12,9 @@ const escape = require('escape-string-regexp'); module.exports = function ignoredFiles(appSrc) { return new RegExp( - `^(?!${escape( - path.normalize(appSrc + '/').replace(/[\\]+/g, '/') - )}).+/node_modules/`, + `^(?!${escape(path + .normalize(appSrc + '/') + .replace(/[\\]+/g, '/'))}).+/node_modules/`, 'g' ); }; diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/launchEditor.js index 933fc1d4d30..6d51ecadfef 100644 --- a/packages/react-dev-utils/launchEditor.js +++ b/packages/react-dev-utils/launchEditor.js @@ -28,34 +28,21 @@ function isTerminalEditor(editor) { // of the app every time const COMMON_EDITORS_OSX = { '/Applications/Atom.app/Contents/MacOS/Atom': 'atom', - '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': - '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta', + '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta', '/Applications/Brackets.app/Contents/MacOS/Brackets': 'brackets', - '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text': - '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl', - '/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text': - '/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl', - '/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2': - '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl', + '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text': '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl', + '/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text': '/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl', + '/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2': '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl', '/Applications/Visual Studio Code.app/Contents/MacOS/Electron': 'code', - '/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron': - 'code-insiders', - '/Applications/AppCode.app/Contents/MacOS/appcode': - '/Applications/AppCode.app/Contents/MacOS/appcode', - '/Applications/CLion.app/Contents/MacOS/clion': - '/Applications/CLion.app/Contents/MacOS/clion', - '/Applications/IntelliJ IDEA.app/Contents/MacOS/idea': - '/Applications/IntelliJ IDEA.app/Contents/MacOS/idea', - '/Applications/PhpStorm.app/Contents/MacOS/phpstorm': - '/Applications/PhpStorm.app/Contents/MacOS/phpstorm', - '/Applications/PyCharm.app/Contents/MacOS/pycharm': - '/Applications/PyCharm.app/Contents/MacOS/pycharm', - '/Applications/PyCharm CE.app/Contents/MacOS/pycharm': - '/Applications/PyCharm CE.app/Contents/MacOS/pycharm', - '/Applications/RubyMine.app/Contents/MacOS/rubymine': - '/Applications/RubyMine.app/Contents/MacOS/rubymine', - '/Applications/WebStorm.app/Contents/MacOS/webstorm': - '/Applications/WebStorm.app/Contents/MacOS/webstorm', + '/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron': 'code-insiders', + '/Applications/AppCode.app/Contents/MacOS/appcode': '/Applications/AppCode.app/Contents/MacOS/appcode', + '/Applications/CLion.app/Contents/MacOS/clion': '/Applications/CLion.app/Contents/MacOS/clion', + '/Applications/IntelliJ IDEA.app/Contents/MacOS/idea': '/Applications/IntelliJ IDEA.app/Contents/MacOS/idea', + '/Applications/PhpStorm.app/Contents/MacOS/phpstorm': '/Applications/PhpStorm.app/Contents/MacOS/phpstorm', + '/Applications/PyCharm.app/Contents/MacOS/pycharm': '/Applications/PyCharm.app/Contents/MacOS/pycharm', + '/Applications/PyCharm CE.app/Contents/MacOS/pycharm': '/Applications/PyCharm CE.app/Contents/MacOS/pycharm', + '/Applications/RubyMine.app/Contents/MacOS/rubymine': '/Applications/RubyMine.app/Contents/MacOS/rubymine', + '/Applications/WebStorm.app/Contents/MacOS/webstorm': '/Applications/WebStorm.app/Contents/MacOS/webstorm', '/Applications/MacVim.app/Contents/MacOS/MacVim': 'mvim', }; diff --git a/packages/react-dev-utils/openBrowser.js b/packages/react-dev-utils/openBrowser.js index cb9f32c6a85..2683b377d6a 100644 --- a/packages/react-dev-utils/openBrowser.js +++ b/packages/react-dev-utils/openBrowser.js @@ -66,8 +66,7 @@ function startBrowserProcess(browser, url) { // requested a different browser, we can try opening // Chrome with AppleScript. This lets us reuse an // existing tab when possible instead of creating a new one. - const shouldTryOpenChromeWithAppleScript = - process.platform === 'darwin' && + const shouldTryOpenChromeWithAppleScript = process.platform === 'darwin' && (typeof browser !== 'string' || browser === OSX_CHROME); if (shouldTryOpenChromeWithAppleScript) { diff --git a/packages/react-dev-utils/printHostingInstructions.js b/packages/react-dev-utils/printHostingInstructions.js index 7afb4af21e4..60753d812d2 100644 --- a/packages/react-dev-utils/printHostingInstructions.js +++ b/packages/react-dev-utils/printHostingInstructions.js @@ -45,14 +45,10 @@ function printHostingInstructions( function printBaseMessage(buildFolder, hostingLocation) { console.log( - `The project was built assuming it is hosted at ${chalk.green( - hostingLocation || 'the server root' - )}.` + `The project was built assuming it is hosted at ${chalk.green(hostingLocation || 'the server root')}.` ); console.log( - `You can control this with the ${chalk.green( - 'homepage' - )} field in your ${chalk.cyan('package.json')}.` + `You can control this with the ${chalk.green('homepage')} field in your ${chalk.cyan('package.json')}.` ); if (!hostingLocation) { @@ -60,9 +56,7 @@ function printBaseMessage(buildFolder, hostingLocation) { console.log(); console.log( - ` ${chalk.green('"homepage"')} ${chalk.cyan(':')} ${chalk.green( - '"http://myname.github.io/myapp"' - )}${chalk.cyan(',')}` + ` ${chalk.green('"homepage"')} ${chalk.cyan(':')} ${chalk.green('"http://myname.github.io/myapp"')}${chalk.cyan(',')}` ); } console.log(); @@ -91,14 +85,10 @@ function printDeployInstructions(publicUrl, hasDeployScript, useYarn) { console.log(` ${chalk.yellow('"scripts"')}: {`); console.log(` ${chalk.dim('// ...')}`); console.log( - ` ${chalk.yellow('"predeploy"')}: ${chalk.yellow( - '"npm run build",' - )}` + ` ${chalk.yellow('"predeploy"')}: ${chalk.yellow('"npm run build",')}` ); console.log( - ` ${chalk.yellow('"deploy"')}: ${chalk.yellow( - '"gh-pages -d build"' - )}` + ` ${chalk.yellow('"deploy"')}: ${chalk.yellow('"gh-pages -d build"')}` ); console.log(' }'); console.log(); diff --git a/packages/react-error-overlay/build.js b/packages/react-error-overlay/build.js index 592da141ffe..b49f3da1857 100644 --- a/packages/react-error-overlay/build.js +++ b/packages/react-error-overlay/build.js @@ -14,8 +14,7 @@ const chokidar = require('chokidar'); const args = process.argv.slice(2); const watchMode = args[0] === '--watch' || args[0] === '-w'; -const isCI = - process.env.CI && +const isCI = process.env.CI && (typeof process.env.CI !== 'string' || process.env.CI.toLowerCase() !== 'false'); diff --git a/packages/react-error-overlay/src/__tests__/mapper.js b/packages/react-error-overlay/src/__tests__/mapper.js index bd733487f8d..393633f988b 100644 --- a/packages/react-error-overlay/src/__tests__/mapper.js +++ b/packages/react-error-overlay/src/__tests__/mapper.js @@ -12,8 +12,7 @@ import { resolve } from 'path'; test('basic error; 0 context', async () => { expect.assertions(1); - const error = - 'TypeError: document.body.missing is not a function\n at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)\n at http://localhost:3000/static/js/bundle.js:30091:25\n at measureLifeCyclePerf (http://localhost:3000/static/js/bundle.js:29901:12)\n at http://localhost:3000/static/js/bundle.js:30090:11\n at CallbackQueue.notifyAll (http://localhost:3000/static/js/bundle.js:13256:22)\n at ReactReconcileTransaction.close (http://localhost:3000/static/js/bundle.js:35124:26)\n at ReactReconcileTransaction.closeAll (http://localhost:3000/static/js/bundle.js:7390:25)\n at ReactReconcileTransaction.perform (http://localhost:3000/static/js/bundle.js:7337:16)\n at batchedMountComponentIntoNode (http://localhost:3000/static/js/bundle.js:14204:15)\n at ReactDefaultBatchingStrategyTransaction.perform (http://localhost:3000/static/js/bundle.js:7324:20)\n at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:33900:26)\n at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:2181:27)\n at Object._renderNewRootComponent (http://localhost:3000/static/js/bundle.js:14398:18)\n at Object._renderSubtreeIntoContainer (http://localhost:3000/static/js/bundle.js:14479:32)\n at Object.render (http://localhost:3000/static/js/bundle.js:14500:23)\n at Object.friendlySyntaxErrorLabel (http://localhost:3000/static/js/bundle.js:17287:20)\n at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n at fn (http://localhost:3000/static/js/bundle.js:84:20)\n at Object. (http://localhost:3000/static/js/bundle.js:41219:18)\n at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n at validateFormat (http://localhost:3000/static/js/bundle.js:709:39)\n at http://localhost:3000/static/js/bundle.js:712:10'; + const error = 'TypeError: document.body.missing is not a function\n at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)\n at http://localhost:3000/static/js/bundle.js:30091:25\n at measureLifeCyclePerf (http://localhost:3000/static/js/bundle.js:29901:12)\n at http://localhost:3000/static/js/bundle.js:30090:11\n at CallbackQueue.notifyAll (http://localhost:3000/static/js/bundle.js:13256:22)\n at ReactReconcileTransaction.close (http://localhost:3000/static/js/bundle.js:35124:26)\n at ReactReconcileTransaction.closeAll (http://localhost:3000/static/js/bundle.js:7390:25)\n at ReactReconcileTransaction.perform (http://localhost:3000/static/js/bundle.js:7337:16)\n at batchedMountComponentIntoNode (http://localhost:3000/static/js/bundle.js:14204:15)\n at ReactDefaultBatchingStrategyTransaction.perform (http://localhost:3000/static/js/bundle.js:7324:20)\n at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:33900:26)\n at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:2181:27)\n at Object._renderNewRootComponent (http://localhost:3000/static/js/bundle.js:14398:18)\n at Object._renderSubtreeIntoContainer (http://localhost:3000/static/js/bundle.js:14479:32)\n at Object.render (http://localhost:3000/static/js/bundle.js:14500:23)\n at Object.friendlySyntaxErrorLabel (http://localhost:3000/static/js/bundle.js:17287:20)\n at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n at fn (http://localhost:3000/static/js/bundle.js:84:20)\n at Object. (http://localhost:3000/static/js/bundle.js:41219:18)\n at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n at validateFormat (http://localhost:3000/static/js/bundle.js:709:39)\n at http://localhost:3000/static/js/bundle.js:712:10'; fetch.mockResponseOnce( fs @@ -37,8 +36,7 @@ test('basic error; 0 context', async () => { test('default context (3)', async () => { expect.assertions(1); - const error = - 'TypeError: document.body.missing is not a function\n at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)'; + const error = 'TypeError: document.body.missing is not a function\n at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)'; fetch.mockResponseOnce( fs @@ -62,8 +60,7 @@ test('default context (3)', async () => { test('bad comes back same', async () => { expect.assertions(2); - const error = - 'TypeError: document.body.missing is not a function\n at App.componentDidMount (A:1:2)'; + const error = 'TypeError: document.body.missing is not a function\n at App.componentDidMount (A:1:2)'; const orig = parse(error); expect(orig).toEqual([ { diff --git a/packages/react-error-overlay/src/components/Collapsible.js b/packages/react-error-overlay/src/components/Collapsible.js index 016f3c7a708..0da3f64198c 100644 --- a/packages/react-error-overlay/src/components/Collapsible.js +++ b/packages/react-error-overlay/src/components/Collapsible.js @@ -65,9 +65,11 @@ class Collapsible extends Component { collapsed ? collapsibleCollapsedStyle : collapsibleExpandedStyle } > - {(collapsed ? '▶' : '▼') + - ` ${count} stack frames were ` + - (collapsed ? 'collapsed.' : 'expanded.')} + { + (collapsed ? '▶' : '▼') + + ` ${count} stack frames were ` + + (collapsed ? 'collapsed.' : 'expanded.') + }
{this.props.children} diff --git a/packages/react-error-overlay/src/containers/CompileErrorContainer.js b/packages/react-error-overlay/src/containers/CompileErrorContainer.js index 3e9d4611860..6952860c4f2 100644 --- a/packages/react-error-overlay/src/containers/CompileErrorContainer.js +++ b/packages/react-error-overlay/src/containers/CompileErrorContainer.js @@ -40,7 +40,9 @@ class CompileErrorContainer extends PureComponent { >
-