Skip to content

Commit d8217c8

Browse files
committed
biome format
1 parent 2e7285d commit d8217c8

8 files changed

Lines changed: 31 additions & 61 deletions

File tree

config/babel-preset-extended.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = function (api, opts) {
88
const jsxImportSource = process.env.JSX_IMPORT_SOURCE;
99

1010
if (jsxImportSource) {
11-
const preset = original.presets.find(x => x[0] === babelPresetReact);
11+
const preset = original.presets.find((x) => x[0] === babelPresetReact);
1212

1313
if (preset && preset[1]) {
1414
preset[1].importSource = jsxImportSource;

config/env.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ delete require.cache[require.resolve('./paths')];
1717

1818
const NODE_ENV = process.env.NODE_ENV;
1919
if (!NODE_ENV) {
20-
throw new Error(
21-
'The NODE_ENV environment variable is required but was not specified.'
22-
);
20+
throw new Error('The NODE_ENV environment variable is required but was not specified.');
2321
}
2422

2523
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
@@ -38,12 +36,12 @@ const dotenvFiles = [
3836
// that have already been set. Variable expansion is supported in .env files.
3937
// https://github.com/motdotla/dotenv
4038
// https://github.com/motdotla/dotenv-expand
41-
dotenvFiles.forEach(dotenvFile => {
39+
dotenvFiles.forEach((dotenvFile) => {
4240
if (fs.existsSync(dotenvFile)) {
4341
require('dotenv-expand').expand(
4442
require('dotenv').config({
4543
path: dotenvFile,
46-
})
44+
}),
4745
);
4846
}
4947
});
@@ -60,8 +58,8 @@ dotenvFiles.forEach(dotenvFile => {
6058
const appDirectory = fs.realpathSync(process.cwd());
6159
process.env.NODE_PATH = (process.env.NODE_PATH || '')
6260
.split(path.delimiter)
63-
.filter(folder => folder && !path.isAbsolute(folder))
64-
.map(folder => path.resolve(appDirectory, folder))
61+
.filter((folder) => folder && !path.isAbsolute(folder))
62+
.map((folder) => path.resolve(appDirectory, folder))
6563
.join(path.delimiter);
6664

6765
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
@@ -70,7 +68,7 @@ const REACT_APP = /^REACT_APP_/i;
7068

7169
function getClientEnvironment(publicUrl) {
7270
const raw = Object.keys(process.env)
73-
.filter(key => REACT_APP.test(key))
71+
.filter((key) => REACT_APP.test(key))
7472
.reduce(
7573
(env, key) => {
7674
env[key] = process.env[key];
@@ -96,7 +94,7 @@ function getClientEnvironment(publicUrl) {
9694
// Whether or not react-refresh is enabled.
9795
// It is defined here so it is available in the webpackHotDevClient.
9896
FAST_REFRESH: process.env.FAST_REFRESH !== 'false',
99-
}
97+
},
10098
);
10199
// Stringify all values so we can feed into webpack DefinePlugin
102100
const stringified = {

config/getHttpsConfig.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,21 @@ function validateKeyAndCerts({ cert, key, keyFile, crtFile }) {
2222
// publicEncrypt will throw an error with an invalid cert
2323
encrypted = crypto.publicEncrypt(cert, Buffer.from('test'));
2424
} catch (err) {
25-
throw new Error(
26-
`The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}`
27-
);
25+
throw new Error(`The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}`);
2826
}
2927

3028
try {
3129
// privateDecrypt will throw an error with an invalid key
3230
crypto.privateDecrypt(key, encrypted);
3331
} catch (err) {
34-
throw new Error(
35-
`The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${err.message}`
36-
);
32+
throw new Error(`The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${err.message}`);
3733
}
3834
}
3935

4036
// Read file and throw an error if it doesn't exist
4137
function readEnvFile(file, type) {
4238
if (!fs.existsSync(file)) {
43-
throw new Error(
44-
`You specified ${chalk.cyan(
45-
type
46-
)} in your env, but the file "${chalk.yellow(file)}" can't be found.`
47-
);
39+
throw new Error(`You specified ${chalk.cyan(type)} in your env, but the file "${chalk.yellow(file)}" can't be found.`);
4840
}
4941
return fs.readFileSync(file);
5042
}

config/modules.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ function getAdditionalModulePaths(options = {}) {
5252
throw new Error(
5353
chalk.red.bold(
5454
"Your project's `baseUrl` can only be set to `src` or `node_modules`." +
55-
' Create React App does not support other values at this time.'
56-
)
55+
' Create React App does not support other values at this time.',
56+
),
5757
);
5858
}
5959

@@ -106,7 +106,7 @@ function getModules() {
106106

107107
if (hasTsConfig && hasJsConfig) {
108108
throw new Error(
109-
'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
109+
'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.',
110110
);
111111
}
112112

@@ -116,9 +116,11 @@ function getModules() {
116116
// TypeScript project and set up the config
117117
// based on tsconfig.json
118118
if (hasTsConfig) {
119-
const ts = require(resolve.sync('typescript', {
120-
basedir: paths.appNodeModules,
121-
}));
119+
const ts = require(
120+
resolve.sync('typescript', {
121+
basedir: paths.appNodeModules,
122+
}),
123+
);
122124
config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
123125
// Otherwise we'll check if there is jsconfig.json
124126
// for non TS projects.

config/paths.js

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
1515
// Make sure any symlinks in the project folder are resolved:
1616
// https://github.com/facebook/create-react-app/issues/637
1717
const appDirectory = fs.realpathSync(process.cwd());
18-
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
18+
const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);
1919

2020
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
2121
// "public path" at which the app is served.
@@ -26,31 +26,17 @@ const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
2626
const publicUrlOrPath = getPublicUrlOrPath(
2727
process.env.NODE_ENV === 'development',
2828
require(resolveApp('package.json')).homepage,
29-
process.env.PUBLIC_URL
29+
process.env.PUBLIC_URL,
3030
);
3131

3232
const buildPath = process.env.BUILD_PATH || '../Assets/Resources/react';
3333
const manifestPath = path.join(buildPath, 'asset-manifest.json');
3434

35-
const moduleFileExtensions = [
36-
'web.mjs',
37-
'mjs',
38-
'web.js',
39-
'js',
40-
'web.ts',
41-
'ts',
42-
'web.tsx',
43-
'tsx',
44-
'json',
45-
'web.jsx',
46-
'jsx',
47-
];
35+
const moduleFileExtensions = ['web.mjs', 'mjs', 'web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx'];
4836

4937
// Resolve file paths in the same order as webpack
5038
const resolveModule = (resolveFn, filePath) => {
51-
const extension = moduleFileExtensions.find(extension =>
52-
fs.existsSync(resolveFn(`${filePath}.${extension}`))
53-
);
39+
const extension = moduleFileExtensions.find((extension) => fs.existsSync(resolveFn(`${filePath}.${extension}`)));
5440

5541
if (extension) {
5642
return resolveFn(`${filePath}.${extension}`);
@@ -85,7 +71,7 @@ module.exports = {
8571
};
8672

8773
// @remove-on-eject-begin
88-
const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath);
74+
const resolveOwn = (relativePath) => path.resolve(__dirname, '..', relativePath);
8975

9076
// config before eject: we're in ./node_modules/react-unity-scripts/config/
9177
module.exports = {
@@ -119,15 +105,10 @@ module.exports = {
119105

120106
const ownPackageJson = require('../package.json');
121107
const reactScriptsPath = resolveApp(`node_modules/${ownPackageJson.name}`);
122-
const reactScriptsLinked =
123-
fs.existsSync(reactScriptsPath) &&
124-
fs.lstatSync(reactScriptsPath).isSymbolicLink();
108+
const reactScriptsLinked = fs.existsSync(reactScriptsPath) && fs.lstatSync(reactScriptsPath).isSymbolicLink();
125109

126110
// config before publish: we're in ./packages/react-unity-scripts/config/
127-
if (
128-
!reactScriptsLinked &&
129-
__dirname.indexOf(path.join('packages', 'react-unity-scripts', 'config')) !== -1
130-
) {
111+
if (!reactScriptsLinked && __dirname.indexOf(path.join('packages', 'react-unity-scripts', 'config')) !== -1) {
131112
const templatePath = '../cra-template/template';
132113
module.exports = {
133114
dotenv: resolveOwn(`${templatePath}/.env`),

config/webpack/persistentCache/createEnvironmentHash.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
const { createHash } = require('crypto');
33

4-
module.exports = env => {
4+
module.exports = (env) => {
55
const hash = createHash('md5');
66
hash.update(JSON.stringify(env));
77

config/webpackDevServer.config.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ function servePreviewerIfExists() {
2828
const previewerPath = path.dirname(require.resolve('@reactunity/previewer', { paths: [paths.appPath] }));
2929
console.log('Using @reactunity/previewer');
3030
return [{ directory: path.join(previewerPath, 'public') }];
31-
} catch (err) { }
31+
} catch (err) {}
3232
return [];
3333
}
3434

3535
module.exports = function (proxy, allowedHost) {
36-
const disableFirewall =
37-
!proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true';
36+
const disableFirewall = !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true';
3837
return {
3938
// WebpackDevServer 2.4.3 introduced a security fix that prevents remote
4039
// websites from potentially accessing local content through DNS rebinding:
@@ -101,7 +100,7 @@ module.exports = function (proxy, allowedHost) {
101100
...servePreviewerIfExists(),
102101

103102
// Serve the fallback of web previewer as the index page
104-
{ directory: path.join(__dirname, 'public'), },
103+
{ directory: path.join(__dirname, 'public') },
105104
],
106105
client: {
107106
webSocketURL: {

lib/types/base.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ declare module '*.webp' {
4848
declare module '*.svg' {
4949
import * as React from 'react';
5050

51-
export const ReactComponent: React.FunctionComponent<React.SVGProps<
52-
SVGSVGElement
53-
> & { title?: string }>;
51+
export const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement> & { title?: string }>;
5452

5553
const src: string;
5654
export default src;

0 commit comments

Comments
 (0)