Error:110:14 error 'moment' is not defined no-undef
Error:150:6 error React Hook useMemo has a missing dependency:'task.startDate'. Either include it or remove the dependency array react-hooks/exhaustive-deps
✖ 2problems(2 errors,0 warnings)
Собственно, эти две ошибки ты и должен был увидеть в редакторе своем, а не только тайпскриптовые. Вопрос, у тебя расширение Eslint стоит в редакторе?
Просто TypeScript ругается на ошибки в типизации (они были, потому что ты не импортировал модуль moment). А вот проверки кода синтаксические выполняются эслинтом (чтобы переменные все были, не было не используемых, правила именования и т.п.).
То есть ты должен был при наведении мышкой видеть такую всплывашку:
(alias)moment(inp?: moment.MomentInput, strict?:boolean|undefined):moment.Moment(+2 overloads)
export namespacemoment
@param strict
Strict parsing disables the deprecated fallback to the native Date constructor when parsing a string.'moment' is not defined.eslintno-undef
'moment' refers to a UMDglobal, but the current file is a module. Consider adding an import instead.ts(2686)
Вот ты или не все скопировал прислал, или просто плагин эслинг не стоит.
Проверку можно выполнить еще через терминал.
yarn lint - запускает эслинт на проверку кода всего проекта.
Результат по твоей репе:
yarn lint
yarn run v1.22.5
$ eslint .--ext ts --ext tsx --ext js
/disk480/www/freecode.academy/test/p1aton/src/pages/Tasks/Task/View/index.tsx
75:14 error 'moment' is not defined no-undef
111:6 error React Hook useMemo has a missing dependency:'task.startDate'. Either include it or remove the dependency array react-hooks/exhaustive-deps
✖ 2problems(2 errors,0 warnings)
error Command failed with exit code 1.
yarn types - Запускает тайпскрипт на проверку всего кода.
yarn types
yarn run v1.22.5
$ tsc --pretty --noEmit
src/pages/Tasks/Task/View/index.tsx:75:14- error TS2686:'moment' refers to a UMDglobal, but the current file is a module. Consider adding an import instead.75{moment(task.startDate).format('lll')}~~~~~~
Found 1 error.
error Command failed with exit code 2.
Эти проверки уже показывают, что в проекте все плохо.