ESLintify Part 3 (#846)

* ESLintify Part 3

* ESLintify Part 3

* ESLintify Part 3
This commit is contained in:
Yangshun Tay 2018-07-11 03:21:31 -07:00 committed by Endilie Yacop Sucipto
parent 5ac2cee658
commit a7a214fb3a
54 changed files with 435 additions and 497 deletions

View file

@ -9,7 +9,7 @@
require('babel-register')({
babelrc: false,
only: [__dirname, process.cwd() + '/core'],
only: [__dirname, `${process.cwd()}/core`],
plugins: [
require('./server/translate-plugin.js'),
'transform-class-properties',
@ -27,7 +27,7 @@ const tcpPortUsed = require('tcp-port-used');
const CWD = process.cwd();
const env = require('./server/env.js');
if (!fs.existsSync(CWD + '/siteConfig.js')) {
if (!fs.existsSync(`${CWD}/siteConfig.js`)) {
console.error(
chalk.red('Error: No siteConfig.js file found in website folder!')
);
@ -51,7 +51,7 @@ const MAX_ATTEMPTS = 10;
function checkPort() {
tcpPortUsed
.check(port, 'localhost')
.then(function(inUse) {
.then(inUse => {
if (inUse && numAttempts >= MAX_ATTEMPTS) {
console.log(
'Reached max attempts, exiting. Please open up some ports or ' +
@ -59,7 +59,7 @@ function checkPort() {
);
process.exit(1);
} else if (inUse) {
console.error(chalk.red('Port ' + port + ' is in use'));
console.error(chalk.red(`Port ${port} is in use`));
// Try again but with port + 1
port += 1;
numAttempts += 1;
@ -68,14 +68,14 @@ function checkPort() {
// start local server on specified port
const server = require('./server/server.js');
server(port, program.opts());
const {baseUrl} = require(CWD + '/siteConfig.js');
const {baseUrl} = require(`${CWD}/siteConfig.js`);
const host = `http://localhost:${port}${baseUrl}`;
console.log('Docusaurus server started on port %d', port);
openBrowser(host);
}
})
.catch(function(ex) {
setTimeout(function() {
.catch(ex => {
setTimeout(() => {
throw ex;
}, 0);
});