3.0 KiB
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname
}
}
- Replace
plugin:@typescript-eslint/recommendedtoplugin:@typescript-eslint/recommended-type-checkedorplugin:@typescript-eslint/strict-type-checked - Optionally add
plugin:@typescript-eslint/stylistic-type-checked - Install eslint-plugin-react and add
plugin:react/recommended&plugin:react/jsx-runtimeto theextendslist 1
Проверка совместимости зависимостей
После обновления зависимостей выполните npm ci, npm run lint, npm run build
и npm run test:dependencies. Последняя команда собирает отдельную проверочную
страницу. Запустите npm run preview -- --outDir build/dependency-smoke --port 4174
и откройте http://localhost:4174/tests/dependency-smoke.html.
Успешный результат — Dependency checks passed. Проверяются DOMPurify, Mermaid
(включая формулы), KaTeX, JSON Schema/RJSF, ReDoc, Router и JSON worker Monaco.
Страница проверки не входит в основную production-сборку.
В overrides закреплены исправленные DOMPurify и KaTeX без обновления Monaco и
Mermaid на новые основные версии. Overrides minimatch/glob относятся к инструментам
разработки. Override react-router-dom позволяет использовать исправленную ветку 7
с опубликованным isp-admin-ui-kit@1.14.2, чей peer-диапазон ещё требует ветку 6.
После перехода на выпуск UI-kit с поддержкой Router 7 этот override можно удалить.
React остаётся в ветке 18. Вместо всех Node-полифилов подключаются только Buffer/process и браузерные реализации path/http/url,
необходимые парсерам JSON Schema/OpenAPI и ReDoc. Криптографические полифилы удалены.