Skip to content

Commit fa49190

Browse files
committed
style: prettify codebase
1 parent ffa2569 commit fa49190

File tree

485 files changed

+3455
-3600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

485 files changed

+3455
-3600
lines changed

.github/actions/generators-integration-tests/index.js

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
const core = require('@actions/core');
2-
const {spawn} = require('child_process');
2+
const { spawn } = require('child_process');
33

44
async function run() {
55
try {
6-
const packageCommand = core.getInput('packageCommand', {required: true});
7-
const successRegexp = core.getInput('successRegexp', {required: true});
6+
const packageCommand = core.getInput('packageCommand', { required: true });
7+
const successRegexp = core.getInput('successRegexp', { required: true });
88
let timeoutId;
99

1010
const child = spawn(packageCommand, {
1111
shell: true,
1212
});
1313

1414
console.log('###', successRegexp);
15-
child.stdout.on('data', data => {
15+
child.stdout.on('data', (data) => {
1616
console.log(data.toString());
1717
if (data.toString().includes(successRegexp)) {
1818
clearTimeout(timeoutId);
@@ -21,14 +21,17 @@ async function run() {
2121
}
2222
});
2323

24-
child.stderr.on('data', data => {
24+
child.stderr.on('data', (data) => {
2525
console.error(data.toString());
2626
});
2727

28-
timeoutId = setTimeout(() => {
29-
child.kill('SIGTERM');
30-
core.setFailed('Command timeout');
31-
}, 8 * 60 * 1000); // 8 minutes
28+
timeoutId = setTimeout(
29+
() => {
30+
child.kill('SIGTERM');
31+
core.setFailed('Command timeout');
32+
},
33+
8 * 60 * 1000,
34+
); // 8 minutes
3235
} catch (error) {
3336
core.setFailed(error.message);
3437
}

.storybook/events/register.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function getDividedItems(items) {
2626

2727
return acc;
2828
},
29-
[[], []]
29+
[[], []],
3030
);
3131
}
3232

.storybook/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ module.exports = {
5252
webpackFinal: async (config) => {
5353
// removes default file-loader
5454
const rules = config.module.rules.filter(
55-
(rule) => !rule.loader || !rule.loader.includes('file-loader')
55+
(rule) => !rule.loader || !rule.loader.includes('file-loader'),
5656
);
5757

5858
const tsPaths = new TsconfigPathsPlugin({
@@ -74,7 +74,7 @@ module.exports = {
7474
fs: false,
7575
stream: false,
7676
os: false,
77-
zlib: false
77+
zlib: false,
7878
},
7979
},
8080
module: {

.storybook/preview.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { addParameters } from '@storybook/react';
2-
import { RouterContext } from "next/dist/shared/lib/router-context.shared-runtime";
2+
import { RouterContext } from 'next/dist/shared/lib/router-context.shared-runtime';
33
import { rest } from 'msw';
44
import { mswDecorator } from 'msw-storybook-addon';
55

CODE_OF_CONDUCT.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Contributor Covenant Code of Conduct
32

43
## Our Pledge
@@ -18,23 +17,23 @@ diverse, inclusive, and healthy community.
1817
Examples of behavior that contributes to a positive environment for our
1918
community include:
2019

21-
* Demonstrating empathy and kindness toward other people
22-
* Being respectful of differing opinions, viewpoints, and experiences
23-
* Giving and gracefully accepting constructive feedback
24-
* Accepting responsibility and apologizing to those affected by our mistakes,
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
2524
and learning from the experience
26-
* Focusing on what is best not just for us as individuals, but for the overall
25+
- Focusing on what is best not just for us as individuals, but for the overall
2726
community
2827

2928
Examples of unacceptable behavior include:
3029

31-
* The use of sexualized language or imagery, and sexual attention or advances of
30+
- The use of sexualized language or imagery, and sexual attention or advances of
3231
any kind
33-
* Trolling, insulting or derogatory comments, and personal or political attacks
34-
* Public or private harassment
35-
* Publishing others' private information, such as a physical or email address,
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email address,
3635
without their explicit permission
37-
* Other conduct which could reasonably be considered inappropriate in a
36+
- Other conduct which could reasonably be considered inappropriate in a
3837
professional setting
3938

4039
## Enforcement Responsibilities

TRADEMARK.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ This policy encompasses all trademarks and service marks, whether they are regis
1212

1313
## 1. GENERAL GUIDELINES
1414

15-
* Whenever you use one of our marks, you must always do so in a way that does not mislead anyone about what they are getting and from whom. For example, you cannot say you are distributing the Brainly Gene software when you’re distributing a modified version of it, because recipients may not understand the differences between your modified versions and our own.
15+
- Whenever you use one of our marks, you must always do so in a way that does not mislead anyone about what they are getting and from whom. For example, you cannot say you are distributing the Brainly Gene software when you’re distributing a modified version of it, because recipients may not understand the differences between your modified versions and our own.
1616

17-
* You also cannot use our logo on your website in a way that suggests that your website is an official website or that we endorse your website. You may not use or register our marks, or variations of them as part of your own trademark, service mark, domain name, company name, trade name, product name or service name.
17+
- You also cannot use our logo on your website in a way that suggests that your website is an official website or that we endorse your website. You may not use or register our marks, or variations of them as part of your own trademark, service mark, domain name, company name, trade name, product name or service name.
1818

19-
* You can, though, say you like the Brainly Gene software, that you participate in the Brainly Gene community, that you are providing an unmodified version of the Brainly Gene software.
19+
- You can, though, say you like the Brainly Gene software, that you participate in the Brainly Gene community, that you are providing an unmodified version of the Brainly Gene software.
2020

21-
* Trademark law does not allow your use of names or trademarks that are too similar to ours. You therefore may not use an obvious variation of any of our marks or any phonetic equivalent, foreign language equivalent, takeoff, or abbreviation for a similar or compatible product or service.
21+
- Trademark law does not allow your use of names or trademarks that are too similar to ours. You therefore may not use an obvious variation of any of our marks or any phonetic equivalent, foreign language equivalent, takeoff, or abbreviation for a similar or compatible product or service.
2222

23-
* You are not authorized to use the Brainly marks or logos to convey or imply an endorsement by or partnership with Brainly without Brainly’s prior written approval.
23+
- You are not authorized to use the Brainly marks or logos to convey or imply an endorsement by or partnership with Brainly without Brainly’s prior written approval.
2424

2525
## 2. ACCEPTABLE USES
2626

@@ -32,7 +32,7 @@ When you redistribute an unmodified copy of our software \-- the exact form in w
3232

3333
If you distribute a modified version of our software, you must **remove** all of our logos from it. To assist you with this, we have removed our logos from our source trees, and include them only in our binaries.You may use our word marks, but not our logos, to truthfully describe the origin of the software that you are providing.
3434

35-
For example, if the code you are distributing is a modification of our software, you may say, “*This software is derived from the source code for Brainly Gene software*.”
35+
For example, if the code you are distributing is a modification of our software, you may say, “_This software is derived from the source code for Brainly Gene software_.”
3636

3737
### Statements about compatibility
3838

@@ -42,11 +42,11 @@ You may use the word marks and Brainly Gene logo s to truthfully describe the re
4242

4343
If you wish to describe your product with reference to the Brainly Gene software, here are the conditions under which you may do so. You may call your software “XYZ” (where “XYZ” is your product name) for Brainly Gene only if:
4444

45-
* All versions of the Brainly Gene software you deliver with your product are the exact binaries provided by us.
45+
- All versions of the Brainly Gene software you deliver with your product are the exact binaries provided by us.
4646

47-
* Your product is fully compatible with the APIs for the Brainly Gene software described at <https://github.com/brainly/gene>.
47+
- Your product is fully compatible with the APIs for the Brainly Gene software described at <https://github.com/brainly/gene>.
4848

49-
* You use the following legend in marketing materials or product descriptions: “Brainly is a trademark of Brainly sp. z o.o. <https://github.com/brainly/gene”>
49+
- You use the following legend in marketing materials or product descriptions: “Brainly is a trademark of Brainly sp. z o.o. <https://github.com/brainly/gene”>
5050

5151
### No Domain Names
5252

@@ -58,7 +58,7 @@ When you have the right to use our mark, here is how to display it.
5858

5959
### Trademark marking and legends
6060

61-
Place the following notice at the foot of the page where you have used the mark: “*Brainly is trademark of Brainly sp. z o.o.*
61+
Place the following notice at the foot of the page where you have used the mark: “_Brainly is trademark of Brainly sp. z o.o._
6262

6363
### Use of trademarks in text
6464

@@ -76,4 +76,4 @@ However, when the context requires the use of black-and-white graphics and the l
7676

7777
### This Document
7878

79-
These guidelines are based on the Model Trademark Guidelines, available at <http://www.modeltrademarkguidelines.org>, used under a Creative Commons Attribution 3.0 Unported license: [https://creativecommons.org/licenses/by/3.0/deed.en\_US](https://creativecommons.org/licenses/by/3.0/deed.en_US).
79+
These guidelines are based on the Model Trademark Guidelines, available at <http://www.modeltrademarkguidelines.org>, used under a Creative Commons Attribution 3.0 Unported license: [https://creativecommons.org/licenses/by/3.0/deed.en_US](https://creativecommons.org/licenses/by/3.0/deed.en_US).

certs/source.MD

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Generated with:
2+
23
```sh
34
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname"
4-
```
5+
```

docs/docs-site/.eslintrc.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
"project": ["docs/docs-site/tsconfig(.*)?.json"]
1515
},
1616
"rules": {
17-
"@next/next/no-html-link-for-pages": [
18-
"error",
19-
"docs/docs-site/pages"
20-
]
17+
"@next/next/no-html-link-for-pages": ["error", "docs/docs-site/pages"]
2118
}
2219
},
2320
{
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
21
.results {
3-
/* top: 2.2rem; */
2+
/* top: 2.2rem; */
43
}
54

65
.results a {
7-
color: unset;
6+
color: unset;
87
}

docs/docs-site/components/search.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const Search = () => {
8686

8787
const results = React.useMemo(
8888
() => searchDocs(debouncedSearch),
89-
[searchDocs, debouncedSearch]
89+
[searchDocs, debouncedSearch],
9090
);
9191

9292
const input = React.useRef<HTMLInputElement | null>(null);
@@ -125,7 +125,7 @@ const Search = () => {
125125
<ul
126126
className={cx(
127127
css.results,
128-
'nextra-scrollbar nx-border nx-border-gray-200 nx-bg-white nx-text-gray-100 dark:nx-border-neutral-800 dark:nx-bg-neutral-900 nx-absolute nx-top-full nx-z-20 nx-mt-2 nx-overflow-auto nx-overscroll-contain nx-rounded-xl nx-py-2.5 nx-shadow-xl nx-max-h-[min(calc(50vh-11rem-env(safe-area-inset-bottom)),400px)] md:nx-max-h-[min(calc(100vh-5rem-env(safe-area-inset-bottom)),400px)] nx-inset-x-0 ltr:md:nx-left-auto rtl:md:nx-right-auto contrast-more:nx-border contrast-more:nx-border-gray-900 contrast-more:dark:nx-border-gray-50 nx-w-screen nx-min-h-[100px] nx-max-w-[min(calc(100vw-2rem),calc(100%+20rem))]'
128+
'nextra-scrollbar nx-border nx-border-gray-200 nx-bg-white nx-text-gray-100 dark:nx-border-neutral-800 dark:nx-bg-neutral-900 nx-absolute nx-top-full nx-z-20 nx-mt-2 nx-overflow-auto nx-overscroll-contain nx-rounded-xl nx-py-2.5 nx-shadow-xl nx-max-h-[min(calc(50vh-11rem-env(safe-area-inset-bottom)),400px)] md:nx-max-h-[min(calc(100vh-5rem-env(safe-area-inset-bottom)),400px)] nx-inset-x-0 ltr:md:nx-left-auto rtl:md:nx-right-auto contrast-more:nx-border contrast-more:nx-border-gray-900 contrast-more:dark:nx-border-gray-50 nx-w-screen nx-min-h-[100px] nx-max-w-[min(calc(100vw-2rem),calc(100%+20rem))]',
129129
)}
130130
>
131131
{results.map((res, i) => {

docs/docs-site/components/ui/button.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const buttonVariants = cva(
3232
variant: 'default',
3333
size: 'default',
3434
},
35-
}
35+
},
3636
);
3737

3838
export interface ButtonProps
@@ -51,7 +51,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
5151
{...props}
5252
/>
5353
);
54-
}
54+
},
5555
);
5656
Button.displayName = 'Button';
5757

docs/docs-site/components/ui/card.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const Card = React.forwardRef<
1010
ref={ref}
1111
className={cn(
1212
'rounded-lg border border-neutral-200 bg-white text-neutral-950 shadow-sm dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50',
13-
className
13+
className,
1414
)}
1515
{...props}
1616
/>
@@ -37,7 +37,7 @@ const CardTitle = React.forwardRef<
3737
ref={ref}
3838
className={cn(
3939
'text-2xl font-semibold leading-none tracking-tight',
40-
className
40+
className,
4141
)}
4242
{...props}
4343
/>

docs/docs-site/components/useSearchResults.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export const useSearchResults = () => {
2222
React.useEffect(() => {
2323
if (!docs || !docs.length) {
2424
fetch('/data.json')
25-
.then(data => data.json())
26-
.then(json => setDocs(json));
25+
.then((data) => data.json())
26+
.then((json) => setDocs(json));
2727
}
2828
}, [docs]);
2929

@@ -34,34 +34,34 @@ export const useSearchResults = () => {
3434
}
3535

3636
const contentResults = keyword
37-
? docs.filter(doc =>
38-
doc.content.toLowerCase().includes(keyword.toLowerCase())
37+
? docs.filter((doc) =>
38+
doc.content.toLowerCase().includes(keyword.toLowerCase()),
3939
)
4040
: [];
4141

4242
const withSubstrContent = contentResults.map(
43-
({route, title, content}) => {
43+
({ route, title, content }) => {
4444
const index = content.toLowerCase().indexOf(keyword.toLowerCase());
4545
const substr = slice(content, index, 15, 15 + keyword.length);
4646

47-
return {route, title, content: substr, type: 'content'};
48-
}
47+
return { route, title, content: substr, type: 'content' };
48+
},
4949
);
5050

5151
const titleResults = keyword
52-
? docs.filter(doc =>
53-
doc.title?.toLowerCase().includes(keyword.toLowerCase())
52+
? docs.filter((doc) =>
53+
doc.title?.toLowerCase().includes(keyword.toLowerCase()),
5454
)
5555
: [];
5656

57-
const withNoContent = titleResults.map(result => {
58-
return {...result, content: undefined, type: 'title'};
57+
const withNoContent = titleResults.map((result) => {
58+
return { ...result, content: undefined, type: 'title' };
5959
});
6060

6161
return [...withNoContent, ...withSubstrContent].slice(0, 10);
6262
},
63-
[docs]
63+
[docs],
6464
);
6565

66-
return {searchDocs};
66+
return { searchDocs };
6767
};

docs/docs-site/pages/gene/backend-for-frontend/create.mdx

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Running the command above initiates a prompt to gather the required details for
2626
✔ What is the BFF name? (e.g. web, ios, android) · my-first-bff
2727
✔ Application tittle · Example BFF Application
2828
✔ Application description · Example BFF Application for the US web
29-
✔ Specify the path to the BFF directory relative to '/apps'? ·
29+
✔ Specify the path to the BFF directory relative to '/apps'? ·
3030
✔ What are tags of the application?
3131
✔ Should the application routes be translated? (y/N) · false
3232
✔ Should include apollo client config? (Y/n) · true
@@ -74,4 +74,3 @@ CREATE apps/my-first-bff/.storybook/manager.js
7474
CREATE apps/my-first-bff/.storybook/preview.js
7575
CREATE apps/my-first-bff/.storybook/tsconfig.json
7676
```
77-

docs/docs-site/pages/gene/backend-for-frontend/handlers.mdx

+8-8
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { apiHandlerConnect } from '@brainly-gene/next';
3636
import {
3737
getQuestion,
3838
postQuestion,
39-
deleteQuestion
39+
deleteQuestion,
4040
} from '@acme/simple-cms/api';
4141

4242
export default apiHandlerConnect()
@@ -51,10 +51,7 @@ export default apiHandlerConnect()
5151
```typescript
5252
import cors from 'cors';
5353
import { apiHandlerConnect } from '@brainly-gene/next';
54-
import {
55-
getUser,
56-
deleteUser
57-
} from '@acme/simple-cms/api';
54+
import { getUser, deleteUser } from '@acme/simple-cms/api';
5855

5956
export default apiHandlerConnect()
6057
.use(cors())
@@ -88,7 +85,7 @@ Below is an example of custom middleware that intercepts requests to add an auth
8885
export function customMiddleware(
8986
req: NextApiRequest,
9087
res: NextApiResponse,
91-
next: () => void
88+
next: () => void,
9289
) {
9390
const apiKey = process.env.API_KEY;
9491

@@ -119,7 +116,10 @@ export async function getQuestion(req: NextApiRequest, res: NextApiResponse) {
119116
}
120117
}
121118

122-
export async function deleteQuestion(req: NextApiRequest, res: NextApiResponse) {
119+
export async function deleteQuestion(
120+
req: NextApiRequest,
121+
res: NextApiResponse,
122+
) {
123123
// Delete question logic here
124124
}
125125

@@ -128,4 +128,4 @@ export async function postQuestion(req: NextApiRequest, res: NextApiResponse) {
128128
}
129129
```
130130

131-
This structure provides a clear and maintainable way to add new handlers for each route in the BFF, utilizing standard REST practices and custom middleware as needed.
131+
This structure provides a clear and maintainable way to add new handlers for each route in the BFF, utilizing standard REST practices and custom middleware as needed.

docs/docs-site/pages/gene/backend-for-frontend/index.mdx

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ title: Backend for Frontend (BFF) - core concept
66

77
The Backend for Frontend (BFF) pattern is an architectural approach where a dedicated backend service is built specifically to serve a particular frontend application (e.g., mobile app, web app). BFFs help streamline the communication between frontend and backend, enabling tailored responses, optimized data handling, and simplified security for each client type. This approach can improve performance and user experience by reducing the amount of data transferred and simplifying API calls.
88

9-
109
In our implementation, we use a Next.js application for creating the BFF because our development team is already familiar with the framework. Additionally, Next.js makes it easy to add API routes directly within the app, which simplifies backend development and reduces setup time.
1110

12-
13-
**Note:** This section is a work in progress and will be expanded with more examples and use cases.
11+
**Note:** This section is a work in progress and will be expanded with more examples and use cases.

0 commit comments

Comments
 (0)