- Shared код: Убедитесь, что общий функционал не дублируется между shared и features. Код должен быть в shared папке, если используется в нескольких местах.
- Состояние и store: Проверяйте корректность обработки состояния в MobX stores, особенно при работе с nullable значениями.
- Type safety: Все новые поля в типах должны иметь явное определение типа, предпочтительно с optional chaining для nullable значений.
- Минимизация useState/useEffect: Минимизировать использование useState/useEffect, логику выносить в mobx сторы, кроме shared слоя. В shared/components компоненты должны быть без сторов.
- Размер компонентов и сторов: Компоненты и сторы не должны быть объемными (условно не больше 600 строк), разбивать на логические части.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getIn = (data, keys) => { | |
| let current = data; | |
| for (const key of keys) { | |
| if (!has(current, key)) { | |
| return null; | |
| } | |
| current = current[key]; | |
| } | |
| return current; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| compareObject(objOne, objTwo) { | |
| return Object.keys(objTwo).every( | |
| key => objOne.hasOwnProperty(key) && objOne[key] == objTwo[key] | |
| ); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| // Use IntelliSense to learn about possible attributes. | |
| // Hover to view descriptions of existing attributes. | |
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "type": "node", | |
| "request": "launch", | |
| "name": "Mocha All", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "editor.tabSize": 2, | |
| "editor.insertSpaces": true, | |
| "editor.detectIndentation": false, | |
| "editor.formatOnSave": false, | |
| // "css.fileExtensions": [ | |
| // "css", | |
| // "scss", | |
| // "less" | |
| // ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| capitalize(value) { | |
| return ( | |
| value | |
| .toString() | |
| .charAt(0) | |
| .toUpperCase() + value.slice(1) | |
| ); | |
| }, | |
| date(value) { | |
| return new Intl.DateTimeFormat('ru-RU', { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return new Intl.DateTimeFormat('ru-RU', { | |
| year: 'numeric', | |
| month: 'long', | |
| day: '2-digit', | |
| }).format(new Date(value)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (event.target.classList[0] === "points") { | |
| this.toggleSortTable.points ? this.users.sort((a, b) => b.points_earned - a.points_earned) : this.users.sort((a, b) => a.points_earned - b.points_earned); | |
| this.toggleSortTable.points = !this.toggleSortTable.points; | |
| } else if (event.target.classList[0] === "name") { | |
| if(this.toggleSortTable.name) { | |
| this.users.sort(function (a, b) { | |
| if (a.name < b.name) { | |
| return 1; | |
| } | |
| if (a.name > b.name) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fn = (f, list) => { | |
| if(list.length === 0) { | |
| return []; | |
| } | |
| const [x, ...xs] = list | |
| return f(x) ? [x, ...fn(f, xs)]: fn(f,xs) | |
| } | |
| const arrEx = [4, 2, 5, 1, 3]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { getQueue } from '../test/data'; | |
| import ExecutorExt from '../test/ExecutorExt'; | |
| import { IExecutor } from './Executor'; | |
| import ITask from './Task'; | |
| export default async function run(executor: IExecutor, queue: Iterable<ITask>, maxThreads = 0) { | |
| maxThreads = Math.max(0, maxThreads); | |
| /** | |
| * Код надо писать сюда | |
| * Тут что-то вызываем в правильном порядке executor.executeTask для тасков из очереди queue |
NewerOlder