Skip to content

Commit

Permalink
refactor: update format with new prettier version
Browse files Browse the repository at this point in the history
  • Loading branch information
GoetzGoerisch committed Nov 12, 2024
1 parent 7e6c9a7 commit b243629
Show file tree
Hide file tree
Showing 88 changed files with 583 additions and 566 deletions.
2 changes: 1 addition & 1 deletion docusaurus/docs/proxying-api-requests-in-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module.exports = function (app) {
createProxyMiddleware({
target: 'http://localhost:5000',
changeOrigin: true,
})
}),
);
};
```
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/title-and-meta-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you use a custom server for your app in production and want to modify the tit
Since Create React App doesn’t support server rendering, you might be wondering how to make `<meta>` tags dynamic and reflect the current URL. To solve this, we recommend to add placeholders into the HTML, like this:

```html
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta property="og:title" content="__OG_TITLE__" />
Expand Down
24 changes: 14 additions & 10 deletions packages/babel-plugin-named-asset-import/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function namedAssetImportPlugin({ types: t }) {
visited.add(newSpecifier);

return newSpecifier;
})
}),
);
}
}
Expand All @@ -44,7 +44,7 @@ function namedAssetImportPlugin({ types: t }) {
if (t.isExportDefaultSpecifier(specifier)) {
return t.exportDeclaration(
[t.exportDefaultSpecifier(t.identifier(specifier.local.name))],
t.stringLiteral(sourcePath)
t.stringLiteral(sourcePath),
);
}

Expand All @@ -53,12 +53,16 @@ function namedAssetImportPlugin({ types: t }) {
[
t.exportSpecifier(
t.identifier(specifier.local.name),
t.identifier(specifier.exported.name)
t.identifier(specifier.exported.name),
),
],
t.stringLiteral(
generateNewSourcePath(loaderMap, specifier.local.name, sourcePath)
)
generateNewSourcePath(
loaderMap,
specifier.local.name,
sourcePath,
),
),
);
});
},
Expand All @@ -67,24 +71,24 @@ function namedAssetImportPlugin({ types: t }) {
if (t.isImportDefaultSpecifier(specifier)) {
return t.importDeclaration(
[t.importDefaultSpecifier(t.identifier(specifier.local.name))],
t.stringLiteral(sourcePath)
t.stringLiteral(sourcePath),
);
}

return t.importDeclaration(
[
t.importSpecifier(
t.identifier(specifier.local.name),
t.identifier(specifier.imported.name)
t.identifier(specifier.imported.name),
),
],
t.stringLiteral(
generateNewSourcePath(
loaderMap,
specifier.imported.name,
sourcePath
)
)
sourcePath,
),
),
);
});
},
Expand Down
10 changes: 5 additions & 5 deletions packages/babel-preset-react-app/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@ module.exports = function (api, opts, env) {
var useESModules = validateBoolOption(
'useESModules',
opts.useESModules,
isEnvDevelopment || isEnvProduction
isEnvDevelopment || isEnvProduction,
);
var isFlowEnabled = validateBoolOption('flow', opts.flow, true);
var isTypeScriptEnabled = validateBoolOption(
'typescript',
opts.typescript,
true
true,
);
var areHelpersEnabled = validateBoolOption('helpers', opts.helpers, true);
var useAbsoluteRuntime = validateBoolOption(
'absoluteRuntime',
opts.absoluteRuntime,
true
true,
);

var absoluteRuntimePath = undefined;
if (useAbsoluteRuntime) {
absoluteRuntimePath = path.dirname(
require.resolve('@babel/runtime/package.json')
require.resolve('@babel/runtime/package.json'),
);
}

Expand All @@ -60,7 +60,7 @@ module.exports = function (api, opts, env) {
'`BABEL_ENV` environment variables. Valid values are "development", ' +
'"test", and "production". Instead, received: ' +
JSON.stringify(env) +
'.'
'.',
);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/babel-preset-react-app/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ module.exports = function (api, opts) {
var useAbsoluteRuntime = validateBoolOption(
'absoluteRuntime',
opts.absoluteRuntime,
true
true,
);

var absoluteRuntimePath = undefined;
if (useAbsoluteRuntime) {
absoluteRuntimePath = path.dirname(
require.resolve('@babel/runtime/package.json')
require.resolve('@babel/runtime/package.json'),
);
}

Expand All @@ -56,7 +56,7 @@ module.exports = function (api, opts) {
'`BABEL_ENV` environment variables. Valid values are "development", ' +
'"test", and "production". Instead, received: ' +
JSON.stringify(env) +
'.'
'.',
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
4 changes: 2 additions & 2 deletions packages/cra-template-typescript/template/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
document.getElementById('root') as HTMLElement,
);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
</React.StrictMode>,
);

// If you want to start measuring performance in your app, pass a function
Expand Down
2 changes: 1 addition & 1 deletion packages/cra-template/template/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion packages/cra-template/template/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
</React.StrictMode>,
);

// If you want to start measuring performance in your app, pass a function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,67 +16,67 @@ describe('getTemplateInstallPackage', () => {

it('cra-template gives cra-template', async () => {
await expect(getTemplateInstallPackage('cra-template')).resolves.toBe(
'cra-template'
'cra-template',
);
});

it('cra-template-typescript gives cra-template-typescript', async () => {
await expect(
getTemplateInstallPackage('cra-template-typescript')
getTemplateInstallPackage('cra-template-typescript'),
).resolves.toBe('cra-template-typescript');
});

it('typescript gives cra-template-typescript', async () => {
await expect(getTemplateInstallPackage('typescript')).resolves.toBe(
'cra-template-typescript'
'cra-template-typescript',
);
});

it('typescript@next gives cra-template-typescript@next', async () => {
await expect(getTemplateInstallPackage('typescript@next')).resolves.toBe(
'cra-template-typescript@next'
'cra-template-typescript@next',
);
});

it('cra-template@next gives cra-template@next', async () => {
await expect(getTemplateInstallPackage('cra-template@next')).resolves.toBe(
'cra-template@next'
'cra-template@next',
);
});

it('cra-template-typescript@next gives cra-template-typescript@next', async () => {
await expect(
getTemplateInstallPackage('cra-template-typescript@next')
getTemplateInstallPackage('cra-template-typescript@next'),
).resolves.toBe('cra-template-typescript@next');
});

it('@iansu gives @iansu/cra-template', async () => {
await expect(getTemplateInstallPackage('@iansu')).resolves.toBe(
'@iansu/cra-template'
'@iansu/cra-template',
);
});

it('@iansu/cra-template gives @iansu/cra-template', async () => {
await expect(
getTemplateInstallPackage('@iansu/cra-template')
getTemplateInstallPackage('@iansu/cra-template'),
).resolves.toBe('@iansu/cra-template');
});

it('@iansu/cra-template@next gives @iansu/cra-template@next', async () => {
await expect(
getTemplateInstallPackage('@iansu/cra-template@next')
getTemplateInstallPackage('@iansu/cra-template@next'),
).resolves.toBe('@iansu/cra-template@next');
});

it('@iansu/cra-template-typescript@next gives @iansu/cra-template-typescript@next', async () => {
await expect(
getTemplateInstallPackage('@iansu/cra-template-typescript@next')
getTemplateInstallPackage('@iansu/cra-template-typescript@next'),
).resolves.toBe('@iansu/cra-template-typescript@next');
});

it('http://example.com/cra-template.tar.gz gives http://example.com/cra-template.tar.gz', async () => {
await expect(
getTemplateInstallPackage('http://example.com/cra-template.tar.gz')
getTemplateInstallPackage('http://example.com/cra-template.tar.gz'),
).resolves.toBe('http://example.com/cra-template.tar.gz');
});
});
Loading

0 comments on commit b243629

Please sign in to comment.