Guidelines
Как писать хороший код
Организация проекта
Использовать Feature-Sliced Design подход
Следовать SOLID
When using third party packages except Next.js App Router, UI and utilities like
lodash-esalways create wrappers for them with types used in application to make it easier to replace them with other packages later
Javascript
Use constructor dependency injection
Prefer early returns to
if/elsestatementsWhen defining a function always make it arrow function
Use
AbortControllerfor event listeners and actions that could be abortedUse optional chaining when possible instead of
if/elsestatements
Typescript
Don't use runtime constructs that aren't part of ECMAScript like namespaces and enums
When importing types use
import typeand inline type importsUse types instead of interfaces to avoid declaration merging
Always include file extension
.jsfor relative importsInstead of using
privatemodifier use ECMAScript native private propertiesDon't use
publicandprotectedmodifiers
React
Don't import React as a namespace
import * as React from 'react'and don't use default exportimport React from 'react'When registering multiple event listeners inside
useEffectuseAbortControllerfor cleanupAvoid prop drilling
For computed grids and lists use
@tanstack/react-virtualfor virtualizationAlways import
clsxfor conditional class names asimport { clsx } from 'clsx'
State managers
Use MobX-State-Tree for state management
Last updated