Skip to content
This repository was archived by the owner on Jun 3, 2019. It is now read-only.

Commit 61e34bf

Browse files
committed
Running eslint-prettier on all files
1 parent 88370f2 commit 61e34bf

File tree

25 files changed

+212
-133
lines changed

25 files changed

+212
-133
lines changed

config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function resolveConfigForBrowserOrNode() {
6666
* This function wraps up the boilerplate needed to access the correct
6767
* configuration depending on whether your code will get executed in the
6868
* browser/node.
69-
*
69+
*
7070
* - For the browser the config values are accessible from "window.__CLIENT_CONFIG__"
7171
* - For a node process they are accessible from "<root>/config/values.js".
7272
*

config/utils/envVars.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ function registerEnvFile() {
3232
// Is there an environment config file at the app root for our target
3333
// environment name?
3434
// e.g. /projects/react-universally/.env.staging
35-
ifElse(DEPLOYMENT)(path.resolve(appRootDir.get(), `${envFile}.${DEPLOYMENT}`)),
35+
ifElse(DEPLOYMENT)(
36+
path.resolve(appRootDir.get(), `${envFile}.${DEPLOYMENT}`),
37+
),
3638
]);
3739

3840
// Find the first env file path match.
39-
const envFilePath = envFileResolutionOrder.find(filePath => fs.existsSync(filePath));
41+
const envFilePath = envFileResolutionOrder.find(filePath =>
42+
fs.existsSync(filePath),
43+
);
4044

4145
// If we found an env file match the register it.
4246
if (envFilePath) {
@@ -81,5 +85,7 @@ export function number(name, defaultVal) {
8185
}
8286

8387
export function bool(name, defaultVal) {
84-
return process.env[name] ? process.env[name] === 'true' || process.env[name] === '1' : defaultVal;
88+
return process.env[name]
89+
? process.env[name] === 'true' || process.env[name] === '1'
90+
: defaultVal;
8591
}

internal/development/createVendorDLL.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ function createVendorDLL(bundleName, bundleConfig) {
1919
// the vendor dll.
2020
const currentDependenciesHash = md5(
2121
JSON.stringify(
22-
devDLLDependencies.map(dep => [dep, pkg.dependencies[dep], pkg.devDependencies[dep]]),
22+
devDLLDependencies.map(dep => [
23+
dep,
24+
pkg.dependencies[dep],
25+
pkg.devDependencies[dep],
26+
]),
2327
// We do this to include any possible version numbers we may have for
2428
// a dependency. If these change then our hash should too, which will
2529
// result in a new dev dll build.
@@ -46,7 +50,11 @@ function createVendorDLL(bundleName, bundleConfig) {
4650
},
4751
plugins: [
4852
new webpack.DllPlugin({
49-
path: pathResolve(appRootDir.get(), bundleConfig.outputPath, `./${dllConfig.name}.json`),
53+
path: pathResolve(
54+
appRootDir.get(),
55+
bundleConfig.outputPath,
56+
`./${dllConfig.name}.json`,
57+
),
5058
name: dllConfig.name,
5159
}),
5260
],
@@ -65,7 +73,7 @@ function createVendorDLL(bundleName, bundleConfig) {
6573

6674
const webpackConfig = webpackConfigFactory();
6775
const vendorDLLCompiler = webpack(webpackConfig);
68-
vendorDLLCompiler.run((err) => {
76+
vendorDLLCompiler.run(err => {
6977
if (err) {
7078
reject(err);
7179
return;

internal/development/hotDevelopment.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import config from '../../config';
1111
const usesDevVendorDLL = bundleConfig =>
1212
bundleConfig.devVendorDLL != null && bundleConfig.devVendorDLL.enabled;
1313

14-
const vendorDLLsFailed = (err) => {
14+
const vendorDLLsFailed = err => {
1515
log({
1616
title: 'vendorDLL',
1717
level: 'error',
18-
message: 'Unfortunately an error occured whilst trying to build the vendor dll(s) used by the development server. Please check the console for more information.',
18+
message:
19+
'Unfortunately an error occured whilst trying to build the vendor dll(s) used by the development server. Please check the console for more information.',
1920
notify: true,
2021
});
2122
if (err) {
@@ -49,7 +50,8 @@ const initializeBundle = (name, bundleConfig) => {
4950
log({
5051
title: 'development',
5152
level: 'error',
52-
message: 'Webpack config is invalid, please check the console for more information.',
53+
message:
54+
'Webpack config is invalid, please check the console for more information.',
5355
notify: true,
5456
});
5557
console.error(err);
@@ -67,7 +69,9 @@ class HotDevelopment {
6769

6870
const clientBundle = initializeBundle('client', config('bundles.client'));
6971

70-
const nodeBundles = [initializeBundle('server', config('bundles.server'))].concat(
72+
const nodeBundles = [
73+
initializeBundle('server', config('bundles.server')),
74+
].concat(
7175
Object.keys(config('additionalNodeBundles')).map(name =>
7276
initializeBundle(name, config('additionalNodeBundles')[name]),
7377
),
@@ -82,10 +86,10 @@ class HotDevelopment {
8286
// Then start the client development server.
8387
.then(
8488
() =>
85-
new Promise((resolve) => {
89+
new Promise(resolve => {
8690
const { createCompiler } = clientBundle;
8791
const compiler = createCompiler();
88-
compiler.plugin('done', (stats) => {
92+
compiler.plugin('done', stats => {
8993
if (!stats.hasErrors()) {
9094
resolve(compiler);
9195
}
@@ -95,7 +99,7 @@ class HotDevelopment {
9599
vendorDLLsFailed,
96100
)
97101
// Then start the node development server(s).
98-
.then((clientCompiler) => {
102+
.then(clientCompiler => {
99103
this.hotNodeServers = nodeBundles.map(
100104
({ name, createCompiler }) =>
101105
// $FlowFixMe
@@ -105,7 +109,8 @@ class HotDevelopment {
105109
}
106110

107111
dispose() {
108-
const safeDisposer = server => (server ? server.dispose() : Promise.resolve());
112+
const safeDisposer = server =>
113+
server ? server.dispose() : Promise.resolve();
109114

110115
// First the hot client server.
111116
return (

internal/development/hotNodeServer.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ class HotNodeServer {
3232
});
3333

3434
newServer.stdout.on('data', data => console.log(data.toString().trim()));
35-
newServer.stderr.on('data', (data) => {
35+
newServer.stderr.on('data', data => {
3636
log({
3737
title: name,
3838
level: 'error',
39-
message: 'Error in server execution, check the console for more info.',
39+
message:
40+
'Error in server execution, check the console for more info.',
4041
});
4142
console.error(data.toString().trim());
4243
});
@@ -62,7 +63,7 @@ class HotNodeServer {
6263
this.clientCompiling = true;
6364
});
6465

65-
clientCompiler.plugin('done', (stats) => {
66+
clientCompiler.plugin('done', stats => {
6667
if (!stats.hasErrors()) {
6768
this.clientCompiling = false;
6869
}
@@ -77,7 +78,7 @@ class HotNodeServer {
7778
});
7879
});
7980

80-
compiler.plugin('done', (stats) => {
81+
compiler.plugin('done', stats => {
8182
this.serverCompiling = false;
8283

8384
if (this.disposing) {
@@ -101,7 +102,8 @@ class HotNodeServer {
101102
log({
102103
title: name,
103104
level: 'error',
104-
message: 'Failed to start, please check the console for more information.',
105+
message:
106+
'Failed to start, please check the console for more information.',
105107
notify: true,
106108
});
107109
console.error(err);
@@ -115,7 +117,7 @@ class HotNodeServer {
115117
dispose() {
116118
this.disposing = true;
117119

118-
const stopWatcher = new Promise((resolve) => {
120+
const stopWatcher = new Promise(resolve => {
119121
this.watcher.close(resolve);
120122
});
121123

internal/development/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ watcher.on('ready', () => {
1717
log({
1818
title: 'webpack',
1919
level: 'warn',
20-
message: 'Project build configuration has changed. Restarting the development devServer...',
20+
message:
21+
'Project build configuration has changed. Restarting the development devServer...',
2122
});
2223
devServer.dispose().then(() => {
2324
// Make sure our new webpack bundleConfigs aren't in the module cache.
24-
Object.keys(require.cache).forEach((modulePath) => {
25+
Object.keys(require.cache).forEach(modulePath => {
2526
if (modulePath.indexOf('config') !== -1) {
2627
delete require.cache[modulePath];
2728
} else if (modulePath.indexOf('internal') !== -1) {
@@ -39,4 +40,7 @@ watcher.on('ready', () => {
3940
});
4041

4142
// If we receive a kill cmd then we will first try to dispose our listeners.
42-
process.on('SIGTERM', () => devServer && devServer.dispose().then(() => process.exit(0)));
43+
process.on(
44+
'SIGTERM',
45+
() => devServer && devServer.dispose().then(() => process.exit(0)),
46+
);

internal/development/listenerManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ListenerManager {
88
this.listener = listener;
99

1010
// Track all connections to our server so that we can close them when needed.
11-
this.listener.on('connection', (connection) => {
11+
this.listener.on('connection', connection => {
1212
// Increment the connection key.
1313
this.lastConnectionKey += 1;
1414
// Generate a new key to represent the connection
@@ -23,13 +23,13 @@ class ListenerManager {
2323
}
2424

2525
killAllConnections() {
26-
Object.keys(this.connectionMap).forEach((connectionKey) => {
26+
Object.keys(this.connectionMap).forEach(connectionKey => {
2727
this.connectionMap[connectionKey].destroy();
2828
});
2929
}
3030

3131
dispose() {
32-
return new Promise((resolve) => {
32+
return new Promise(resolve => {
3333
if (this.listener) {
3434
this.killAllConnections();
3535

internal/scripts/analyze.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,24 @@ const anaylzeFilePath = pathResolve(
3131
'__analyze__.json',
3232
);
3333

34-
const clientCompiler = webpack(webpackConfigFactory({ target, optimize: true }));
34+
const clientCompiler = webpack(
35+
webpackConfigFactory({ target, optimize: true }),
36+
);
3537

3638
clientCompiler.run((err, stats) => {
3739
if (err) {
3840
console.error(err);
3941
} else {
4042
// Write out the json stats file.
41-
fs.writeFileSync(anaylzeFilePath, JSON.stringify(stats.toJson('verbose'), null, 4));
43+
fs.writeFileSync(
44+
anaylzeFilePath,
45+
JSON.stringify(stats.toJson('verbose'), null, 4),
46+
);
4247

4348
// Run the bundle analyzer against the stats file.
44-
const cmd = `webpack-bundle-analyzer ${anaylzeFilePath} ${config('bundles.client.outputPath')}`;
49+
const cmd = `webpack-bundle-analyzer ${anaylzeFilePath} ${config(
50+
'bundles.client.outputPath',
51+
)}`;
4552
exec(cmd);
4653
}
4754
});

internal/scripts/build.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ Object.keys(config('bundles'))
2222
// And the "additional" bundle names
2323
.concat(Object.keys(config('additionalNodeBundles')))
2424
// And then build them all.
25-
.forEach((bundleName) => {
26-
const compiler = webpack(webpackConfigFactory({ target: bundleName, optimize }));
25+
.forEach(bundleName => {
26+
const compiler = webpack(
27+
webpackConfigFactory({ target: bundleName, optimize }),
28+
);
2729
compiler.run((err, stats) => {
2830
if (err) {
2931
console.error(err.stack || err);

internal/scripts/clean.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import config from '../../config';
99

1010
function clean() {
1111
rimraf(pathResolve(appRootDir.get(), config('buildOutputPath')), () => {
12-
console.log(`Cleaned ${pathResolve(appRootDir.get(), config('buildOutputPath'))}`);
12+
console.log(
13+
`Cleaned ${pathResolve(appRootDir.get(), config('buildOutputPath'))}`,
14+
);
1315
});
1416
}
1517

0 commit comments

Comments
 (0)