Skip to content

Commit 409b676

Browse files
committed
update docusaurus
1 parent e510e88 commit 409b676

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

website/src/pages/index.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ import type { MyClass } from 'some-library';
493493
494494
Documentation becomes outdated the moment it's written, and worse than no documentation is wrong documentation. The same applies to types when describing the modules your app interacts with, such as APIs, messaging systems, databases etc.
495495
496-
For external API services, such as REST, GraphQL etc. it's crucial to generate types from their contracts, whether they use Swagger, schemas, or other sources (e.g. [openapi-ts](https://github.com/drwpow/openapi-typescript), [graphql-config](https://github.com/kamilkisiela/graphql-config)...). Avoid manually declaring and maintaining types, as they can easily fall out of sync.
496+
For external API services, such as REST, GraphQL etc. it's crucial to generate types from their contracts, whether they use Swagger, schemas, or other sources (e.g. [openapi-ts](https://github.com/drwpow/openapi-typescript), [graphql-config](https://github.com/kamilkisiela/graphql-config) etc.). Avoid manually declaring and maintaining types, as they can easily fall out of sync.
497497
498498
As an exception manually declare types only when there is truly no documentation provided by external service.
499499
@@ -610,7 +610,7 @@ Strive to use const assertion `as const`:
610610
611611
Const assertion must be used over enum.
612612
613-
While enums can still cover use cases as const assertion would, we tend to avoid it. Some of the reasonings as mentioned in TypeScript documentation - [Const enum pitfalls](https://www.typescriptlang.org/docs/handbook/enums.html#const-enum-pitfalls), [Objects vs Enums](https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums), [Reverse mappings](https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings)...
613+
While enums can still cover use cases as const assertion would, we tend to avoid it. Some of the reasonings as mentioned in TypeScript documentation - [Const enum pitfalls](https://www.typescriptlang.org/docs/handbook/enums.html#const-enum-pitfalls), [Objects vs Enums](https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums), [Reverse mappings](https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings) etc.
614614
615615
```ts
616616
// .eslintrc.js
@@ -678,7 +678,7 @@ In TypeScript types `null` and `undefined` many times can be used interchangeabl
678678
Strive to:
679679
680680
- Use `null` to explicitly state it has no value - assignment, return function type etc.
681-
- Use `undefined` assignment when the value doesn't exist. E.g. exclude fields in form, request payload, database query ([Prisma differentiation](https://www.prisma.io/docs/concepts/components/prisma-client/null-and-undefined))...
681+
- Use `undefined` assignment when the value doesn't exist. E.g. exclude fields in form, request payload, database query ([Prisma differentiation](https://www.prisma.io/docs/concepts/components/prisma-client/null-and-undefined)) etc.
682682
683683
## Naming
684684
@@ -687,7 +687,7 @@ Strive to keep naming conventions consistent and readable, with important contex
687687
### Named Export
688688
689689
Named exports must be used to ensure that all imports follow a uniform pattern <Rule href='https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md' />.
690-
This keeps variables, functions... names consistent across the entire codebase.
690+
This keeps variables, functions etc. names consistent across the entire codebase.
691691
Named exports have the benefit of erroring when import statements try to import something that hasn't been declared.
692692
693693
In case of exceptions e.g. Next.js pages, disable rule:
@@ -941,7 +941,7 @@ To make import statements more readable and easier to understand:
941941
942942
- **Relative** imports `./sortItems` must be used when importing files within the same feature, that are 'close' to each other, which also allows moving feature around the codebase without introducing changes in these imports.
943943
- **Absolute** imports `@common/utils` must be used in all other cases.
944-
- **All** imports must be auto sorted by tooling e.g. [prettier-plugin-sort-imports](https://github.com/trivago/prettier-plugin-sort-imports), [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md)...
944+
- **All** imports must be auto sorted by tooling e.g. [prettier-plugin-sort-imports](https://github.com/trivago/prettier-plugin-sort-imports), [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md) etc.
945945
946946
```ts
947947
// ❌ Avoid
@@ -1201,7 +1201,7 @@ export const Foo = ({ name, score }: FooProps) => {...
12011201
- Utilize storing state in the URL, especially for filtering, sorting etc.
12021202
- Don't sync URL state with local state.
12031203
- Consider passing data simply through props, using the URL, or composing children. Use global state (Zustand, Context) as a last resort.
1204-
- Use React compound components when components should belong and work together: `menu`, `accordion`,`navigation`, `tabs`, `list`,...
1204+
- Use React compound components when components should belong and work together: `menu`, `accordion`,`navigation`, `tabs`, `list`, etc.
12051205
Always export compound components as:
12061206
12071207
```tsx
@@ -1238,7 +1238,7 @@ export const Foo = ({ name, score }: FooProps) => {...
12381238
React components are no different, where prop drilling should not become an issue.
12391239
If with app scaling prop drilling truly becomes an issue, try to refactor render method, local states in parent components, using composition etc.
12401240
- Data fetching is only allowed in container components.
1241-
- Use of server-state library is encouraged ([react-query](https://github.com/tanstack/query), [apollo client](https://github.com/apollographql/apollo-client)...).
1241+
- Use of server-state library is encouraged ([react-query](https://github.com/tanstack/query), [apollo client](https://github.com/apollographql/apollo-client) etc.).
12421242
- Use of client-state library for global state is discouraged.
12431243
Reconsider if something should be truly global across application, e.g. `themeMode`, `Permissions` or even that can be put in server-state (e.g. user settings - `/me` endpoint). If still global state is truly needed use [Zustand](https://github.com/pmndrs/zustand) or [Context](https://react.dev/reference/react/createContext).
12441244

0 commit comments

Comments
 (0)