Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sptint 2 #38

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Sptint 2 #38

wants to merge 10 commits into from

Conversation

AlDmitOl
Copy link
Collaborator

No description provided.

Copy link

@gennady-bars gennady-bars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поздравляю! Ваша работа принята.

Вы отлично потрудились.

  • Readme хорошо оформлен
  • Проект задеплоен и отлично работает
  • Отлично, что не забыли про .gitignore
  • Отлично, что ограничиваете версию node
  • Отлично, что нет EOF ошибок в гите
  • Хорошая структура папок и файлов
  • Добавлен ESLint и Stylelint
  • Отлично, что цвета вынесены в css-константы
  • Отлично, что не забываете про alt в тегах img
  • Отлично, что не забываете про тег main для главной части страницы
  • Отлично, что почти нет типов any
  • Отлично, что указываете понятный текст ошибки под инпутом

Удачного дальнейшего обучения.

Можно лучше

  • Если типизация повторяется в каждом методе (функции), то нужно типизировать сам метод (функцию), а не дублировать типизацию аргументов. Код станет чище
  • Лучше всего передавать тип пропсов в виде дженерика в Block, чтобы можно было конкретный тип пропсов всегда иметь под каждый отдельный экземпляр класса Block. Будет очень универсально
  • Обработчик сабмита нужно навешивать только на тег form с событием submit, а не на кнопку сабмита с событием click, так как сабмит формы происходит ещё при нажатии Enter, и он не будет работать, если навесить обработчик клика на кнопку только. Это нужно исправить везде, где есть инпуты и форма
  • В scripts нужно добавить скрипты для запуска ESLint и Stylelint

method?: string,
timeout?: number
};
type HTTPMethod = (url: string, options?: TOptions) => Promise<unknown>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отличный тип для методов

xhr.open(
method,
isGet && !!data
? `${url}${queryStringify(data)}`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно лучше

queryStringify лучше сразу в методе get вызывать, чтобы не проверять METHODS.GET при каждом запросе

};

// Нельзя создавать экземпляр данного класса
abstract class Block {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно лучше

Лучше всего передавать тип пропсов в виде дженерика в Block, чтобы можно было конкретный тип пропсов всегда иметь под каждый отдельный экземпляр класса Block. Будет очень универсально

abstract class Block<Props extends Record<string, any> = unknown> {

FLOW_CDM: 'flow:component-did-mount',
FLOW_CDU: 'flow:component-did-update',
FLOW_RENDER: 'flow:render',
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут нужно добавить } as const, чтобы зафиксировать литеральный тип строк внутри объекта

Подробнее https://igorfonin.gitbook.io/typescript-book-ru/typescript-type-system/literals

});
}

// Not used anywhere yet

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_removeEvents нужно использовать на строке 171 перед тем, как заменить элемент другим, чтобы удалить обработчики предыдущего элемента

constructor(props: Props) {
super({
...props,
onBlur: () => this.validate(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отлично, что обработчик валидации находится внутри InputField, а не дублируется под каждый инпут отдельно

"engines": {
"node": "16.15.0"
},
"scripts": {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В scripts нужно добавить скрипты для запуска ESLint и Stylelint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants