diff --git a/.gitea/workflows/check.yaml b/.gitea/workflows/check.yaml new file mode 100644 index 0000000..25fcc22 --- /dev/null +++ b/.gitea/workflows/check.yaml @@ -0,0 +1,28 @@ +name: Code Quality Checks +run-name: Проверка кода (lint & typecheck) от ${{ gitea.actor }} +on: [push] + +jobs: + lint-and-typecheck: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run ESLint + run: npm run eslint -- --quiet + + - name: Run TypeScript type check + run: npx tsc --noEmit + + - name: Run tests + run: npm test -- --quiet \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index c53c59a..e1d5760 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,43 +1,43 @@ /** - * For a detailed explanation regarding each configuration property, visit: + * Для подробного объяснения каждого свойства конфигурации, посетите: * https://jestjs.io/docs/configuration */ /** @type {import('jest').Config} */ const config = { - // All imported modules in your tests should be mocked automatically + // Все импортированные модули в тестах должны быть автоматически замоканы // automock: false, - // Stop running tests after `n` failures + // Остановить выполнение тестов после `n` неудач // bail: 0, - // The directory where Jest should store its cached dependency information + // Директория, где Jest должен хранить кэшированную информацию о зависимостях // cacheDirectory: "C:\\Users\\alex\\AppData\\Local\\Temp\\jest", - // Automatically clear mock calls, instances, contexts and results before every test + // Автоматически очищать вызовы моков, экземпляры, контексты и результаты перед каждым тестом clearMocks: true, - // Indicates whether the coverage information should be collected while executing the test + // Указывает, должна ли собираться информация о покрытии во время выполнения тестов collectCoverage: true, - // An array of glob patterns indicating a set of files for which coverage information should be collected + // Массив glob-паттернов, указывающих набор файлов, для которых должна собираться информация о покрытии collectCoverageFrom: [ "/server/routers/**/*.js" ], - // The directory where Jest should output its coverage files + // Директория, куда Jest должен выводить файлы покрытия coverageDirectory: "coverage", - // An array of regexp pattern strings used to skip coverage collection + // Массив строк regexp-паттернов, используемых для пропуска сбора покрытия coveragePathIgnorePatterns: [ "\\\\node_modules\\\\", "/server/routers/old" ], - // Indicates which provider should be used to instrument code for coverage + // Указывает, какой провайдер должен использоваться для инструментирования кода для покрытия coverageProvider: "v8", - // A list of reporter names that Jest uses when writing coverage reports + // Список имен репортеров, которые Jest использует при записи отчетов о покрытии // coverageReporters: [ // "json", // "text", @@ -45,156 +45,159 @@ const config = { // "clover" // ], - // An object that configures minimum threshold enforcement for coverage results + // Объект, который настраивает принудительное применение минимальных порогов для результатов покрытия // coverageThreshold: undefined, - // A path to a custom dependency extractor + // Путь к пользовательскому извлекателю зависимостей // dependencyExtractor: undefined, - // Make calling deprecated APIs throw helpful error messages + // Заставить вызовы устаревших API выбрасывать полезные сообщения об ошибках // errorOnDeprecated: false, - // The default configuration for fake timers + // Конфигурация по умолчанию для поддельных таймеров // fakeTimers: { // "enableGlobally": false // }, - // Force coverage collection from ignored files using an array of glob patterns + // Принудительно собирать покрытие из игнорируемых файлов, используя массив glob-паттернов // forceCoverageMatch: [], - // A path to a module which exports an async function that is triggered once before all test suites + // Путь к модулю, который экспортирует асинхронную функцию, вызываемую один раз перед всеми наборами тестов // globalSetup: undefined, - // A path to a module which exports an async function that is triggered once after all test suites + // Путь к модулю, который экспортирует асинхронную функцию, вызываемую один раз после всех наборов тестов // globalTeardown: undefined, - // A set of global variables that need to be available in all test environments + // Набор глобальных переменных, которые должны быть доступны во всех тестовых окружениях // globals: {}, - // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. + // Максимальное количество воркеров, используемых для запуска тестов. Может быть указано в % или числом. Например, maxWorkers: 10% будет использовать 10% от количества CPU + 1 в качестве максимального числа воркеров. maxWorkers: 2 будет использовать максимум 2 воркера. // maxWorkers: "50%", - // An array of directory names to be searched recursively up from the requiring module's location + // Массив имен директорий, которые должны быть рекурсивно найдены вверх от местоположения требуемого модуля // moduleDirectories: [ // "node_modules" // ], - // An array of file extensions your modules use - // moduleFileExtensions: [ - // "js", - // "mjs", - // "cjs", - // "jsx", - // "ts", - // "tsx", - // "json", - // "node" - // ], + // Массив расширений файлов, которые используют ваши модули + moduleFileExtensions: [ + "js", + "mjs", + "cjs", + "jsx", + "ts", + "tsx", + "json", + "node" + ], - // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module + // Карта из регулярных выражений в имена модулей или массивы имен модулей, которые позволяют заглушить ресурсы одним модулем // moduleNameMapper: {}, - // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader + // Массив строк regexp-паттернов, сопоставляемых со всеми путями модулей перед тем, как они будут считаться 'видимыми' для загрузчика модулей // modulePathIgnorePatterns: [], - // Activates notifications for test results + // Активирует уведомления для результатов тестов // notify: false, - // An enum that specifies notification mode. Requires { notify: true } + // Перечисление, которое указывает режим уведомлений. Требует { notify: true } // notifyMode: "failure-change", - // A preset that is used as a base for Jest's configuration - // preset: undefined, + // Пресет, который используется в качестве основы для конфигурации Jest + preset: 'ts-jest', - // Run tests from one or more projects + // Запускать тесты из одного или нескольких проектов // projects: undefined, - // Use this configuration option to add custom reporters to Jest + // Используйте эту опцию конфигурации для добавления пользовательских репортеров в Jest // reporters: undefined, - // Automatically reset mock state before every test + // Автоматически сбрасывать состояние моков перед каждым тестом // resetMocks: false, - // Reset the module registry before running each individual test + // Сбрасывать реестр модулей перед запуском каждого отдельного теста // resetModules: false, - // A path to a custom resolver + // Путь к пользовательскому резолверу // resolver: undefined, - // Automatically restore mock state and implementation before every test + // Автоматически восстанавливать состояние моков и реализацию перед каждым тестом // restoreMocks: false, - // The root directory that Jest should scan for tests and modules within + // Корневая директория, которую Jest должен сканировать для поиска тестов и модулей // rootDir: undefined, - // A list of paths to directories that Jest should use to search for files in + // Список путей к директориям, которые Jest должен использовать для поиска файлов // roots: [ // "" // ], - // Allows you to use a custom runner instead of Jest's default test runner + // Позволяет использовать пользовательский раннер вместо стандартного тестового раннера Jest // runner: "jest-runner", - // The paths to modules that run some code to configure or set up the testing environment before each test + // Пути к модулям, которые выполняют некоторый код для настройки или подготовки тестового окружения перед каждым тестом // setupFiles: [], - // A list of paths to modules that run some code to configure or set up the testing framework before each test + // Список путей к модулям, которые выполняют некоторый код для настройки или подготовки тестового фреймворка перед каждым тестом // setupFilesAfterEnv: [], - // The number of seconds after which a test is considered as slow and reported as such in the results. + // Количество секунд, после которого тест считается медленным и сообщается как таковой в результатах. // slowTestThreshold: 5, - // A list of paths to snapshot serializer modules Jest should use for snapshot testing + // Список путей к модулям сериализаторов снимков, которые Jest должен использовать для тестирования снимков // snapshotSerializers: [], - // The test environment that will be used for testing - // testEnvironment: "jest-environment-node", + // Тестовое окружение, которое будет использоваться для тестирования + testEnvironment: "node", - // Options that will be passed to the testEnvironment + // Опции, которые будут переданы в testEnvironment // testEnvironmentOptions: {}, - // Adds a location field to test results + // Добавляет поле местоположения к результатам тестов // testLocationInResults: false, - // The glob patterns Jest uses to detect test files - // testMatch: [ - // "**/__tests__/**/*.[jt]s?(x)", - // "**/?(*.)+(spec|test).[tj]s?(x)" - // ], + // Glob-паттерны, которые Jest использует для обнаружения тестовых файлов + testMatch: [ + "**/__tests__/**/*.[jt]s?(x)", + "**/?(*.)+(spec|test).[tj]s?(x)" + ], - // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped + // Массив строк regexp-паттернов, которые сопоставляются со всеми тестовыми путями, сопоставленные тесты пропускаются // testPathIgnorePatterns: [ // "\\\\node_modules\\\\" // ], - // The regexp pattern or array of patterns that Jest uses to detect test files + // Regexp-паттерн или массив паттернов, которые Jest использует для обнаружения тестовых файлов // testRegex: [], - // This option allows the use of a custom results processor + // Эта опция позволяет использовать пользовательский процессор результатов // testResultsProcessor: undefined, - // This option allows use of a custom test runner + // Эта опция позволяет использовать пользовательский тестовый раннер // testRunner: "jest-circus/runner", - // A map from regular expressions to paths to transformers - // transform: undefined, + // Карта из регулярных выражений в пути к трансформерам + transform: { + '^.+\\.ts$': 'ts-jest', + '^.+\\.tsx$': 'ts-jest', + }, - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation + // Массив строк regexp-паттернов, которые сопоставляются со всеми путями исходных файлов, сопоставленные файлы будут пропускать трансформацию // transformIgnorePatterns: [ // "\\\\node_modules\\\\", // "\\.pnp\\.[^\\\\]+$" // ], - // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them + // Массив строк regexp-паттернов, которые сопоставляются со всеми модулями перед тем, как загрузчик модулей автоматически вернет мок для них // unmockedModulePathPatterns: undefined, - // Indicates whether each individual test should be reported during the run + // Указывает, должен ли каждый отдельный тест сообщаться во время выполнения verbose: true, - // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode + // Массив regexp-паттернов, которые сопоставляются со всеми путями исходных файлов перед повторным запуском тестов в режиме наблюдения // watchPathIgnorePatterns: [], - // Whether to use watchman for file crawling + // Использовать ли watchman для обхода файлов // watchman: true, }; diff --git a/package-lock.json b/package-lock.json index cbf818f..64ef6f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,6 +42,7 @@ }, "devDependencies": { "@eslint/js": "^9.17.0", + "@types/jest": "^30.0.0", "@types/node": "22.10.2", "eslint": "^9.17.0", "globals": "^15.14.0", @@ -49,6 +50,7 @@ "mockingoose": "^2.16.2", "nodemon": "3.1.9", "supertest": "^7.0.0", + "ts-jest": "^29.4.6", "ts-node-dev": "2.0.0", "typescript": "5.7.3" } @@ -225,14 +227,15 @@ "license": "ISC" }, "node_modules/@babel/code-frame": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.25.7.tgz", - "integrity": "sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/highlight": "^7.25.7", - "picocolors": "^1.0.0" + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" }, "engines": { "node": ">=6.9.0" @@ -442,9 +445,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz", - "integrity": "sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", "dev": true, "license": "MIT", "engines": { @@ -475,100 +478,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/highlight": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.25.7.tgz", - "integrity": "sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.25.7", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/parser": { "version": "7.25.8", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.8.tgz", @@ -1638,6 +1547,16 @@ } } }, + "node_modules/@jest/diff-sequences": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/@jest/diff-sequences/-/diff-sequences-30.0.1.tgz", + "integrity": "sha512-n5H8QLDJ47QqbCNn5SuFjCRDrOLEZ0h8vAHCK5RL9Ls7Xa8AQLa/YxAc9UjFqoEDM48muwtBGjtMY5cr0PLDCw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, "node_modules/@jest/environment": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", @@ -1699,6 +1618,16 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/get-type": { + "version": "30.1.0", + "resolved": "https://registry.npmjs.org/@jest/get-type/-/get-type-30.1.0.tgz", + "integrity": "sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, "node_modules/@jest/globals": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", @@ -1715,6 +1644,30 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/pattern": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/@jest/pattern/-/pattern-30.0.1.tgz", + "integrity": "sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "jest-regex-util": "30.0.1" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/pattern/node_modules/jest-regex-util": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-30.0.1.tgz", + "integrity": "sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, "node_modules/@jest/reporters": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", @@ -3103,6 +3056,230 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/jest": { + "version": "30.0.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-30.0.0.tgz", + "integrity": "sha512-XTYugzhuwqWjws0CVz8QpM36+T+Dz5mTEBKhNs/esGLnCIlGdRy+Dq78NRjd7ls7r8BC8ZRMOrKlkO1hU0JOwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^30.0.0", + "pretty-format": "^30.0.0" + } + }, + "node_modules/@types/jest/node_modules/@jest/expect-utils": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-30.2.0.tgz", + "integrity": "sha512-1JnRfhqpD8HGpOmQp180Fo9Zt69zNtC+9lR+kT7NVL05tNXIi+QC8Csz7lfidMoVLPD3FnOtcmp0CEFnxExGEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/get-type": "30.1.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@types/jest/node_modules/@jest/schemas": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.0.5.tgz", + "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.34.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@types/jest/node_modules/@jest/types": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.2.0.tgz", + "integrity": "sha512-H9xg1/sfVvyfU7o3zMfBEjQ1gcsdeTMgqHoYdN79tuLqfTtuu7WckRA1R5whDwOzxaZAeMKTYWqP+WCAi0CHsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/pattern": "30.0.1", + "@jest/schemas": "30.0.5", + "@types/istanbul-lib-coverage": "^2.0.6", + "@types/istanbul-reports": "^3.0.4", + "@types/node": "*", + "@types/yargs": "^17.0.33", + "chalk": "^4.1.2" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@types/jest/node_modules/@sinclair/typebox": { + "version": "0.34.41", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.41.tgz", + "integrity": "sha512-6gS8pZzSXdyRHTIqoqSVknxolr1kzfy4/CeDnrzsVz8TTIWUbOBr6gnzOmTYJ3eXQNh4IYHIGi5aIL7sOZ2G/g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/jest/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@types/jest/node_modules/ci-info": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.1.tgz", + "integrity": "sha512-Wdy2Igu8OcBpI2pZePZ5oWjPC38tmDVx5WKUXKwlLYkA0ozo85sLsLvkBbBn/sZaSCMFOGZJ14fvW9t5/d7kdA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@types/jest/node_modules/expect": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-30.2.0.tgz", + "integrity": "sha512-u/feCi0GPsI+988gU2FLcsHyAHTU0MX1Wg68NhAnN7z/+C5wqG+CY8J53N9ioe8RXgaoz0nBR/TYMf3AycUuPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "30.2.0", + "@jest/get-type": "30.1.0", + "jest-matcher-utils": "30.2.0", + "jest-message-util": "30.2.0", + "jest-mock": "30.2.0", + "jest-util": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-diff": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-30.2.0.tgz", + "integrity": "sha512-dQHFo3Pt4/NLlG5z4PxZ/3yZTZ1C7s9hveiOj+GCN+uT109NC2QgsoVZsVOAvbJ3RgKkvyLGXZV9+piDpWbm6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/diff-sequences": "30.0.1", + "@jest/get-type": "30.1.0", + "chalk": "^4.1.2", + "pretty-format": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-matcher-utils": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-30.2.0.tgz", + "integrity": "sha512-dQ94Nq4dbzmUWkQ0ANAWS9tBRfqCrn0bV9AMYdOi/MHW726xn7eQmMeRTpX2ViC00bpNaWXq+7o4lIQ3AX13Hg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/get-type": "30.1.0", + "chalk": "^4.1.2", + "jest-diff": "30.2.0", + "pretty-format": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-message-util": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.2.0.tgz", + "integrity": "sha512-y4DKFLZ2y6DxTWD4cDe07RglV88ZiNEdlRfGtqahfbIjfsw1nMCPx49Uev4IA/hWn3sDKyAnSPwoYSsAEdcimw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@jest/types": "30.2.0", + "@types/stack-utils": "^2.0.3", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "micromatch": "^4.0.8", + "pretty-format": "30.2.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.6" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-mock": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.2.0.tgz", + "integrity": "sha512-JNNNl2rj4b5ICpmAcq+WbLH83XswjPbjH4T7yvGzfAGCPh1rw+xVNbtk+FnRslvt9lkCcdn9i1oAoKUuFsOxRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "30.2.0", + "@types/node": "*", + "jest-util": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-util": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.2.0.tgz", + "integrity": "sha512-QKNsM0o3Xe6ISQU869e+DhG+4CK/48aHYdJZGlFQVTjnbvgpcKyxpzk29fGiO7i/J8VENZ+d2iGnSsvmuHywlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "30.2.0", + "@types/node": "*", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "graceful-fs": "^4.2.11", + "picomatch": "^4.0.2" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@types/jest/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@types/jest/node_modules/pretty-format": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.2.0.tgz", + "integrity": "sha512-9uBdv/B4EefsuAL+pWqueZyZS2Ba+LxfFeQ9DN14HU4bN8bhaxKdkpjpB6fs9+pSjIBu+FXQHImEg8j/Lw0+vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "30.0.5", + "ansi-styles": "^5.2.0", + "react-is": "^18.3.1" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -3818,6 +3995,19 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -5882,6 +6072,28 @@ "graphql": "14 - 16" } }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -7688,6 +7900,13 @@ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true, + "license": "MIT" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -8245,6 +8464,13 @@ "node": ">= 0.6" } }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "devOptional": true, + "license": "MIT" + }, "node_modules/nice-grpc": { "version": "2.1.12", "resolved": "https://registry.npmjs.org/nice-grpc/-/nice-grpc-2.1.12.tgz", @@ -8800,9 +9026,9 @@ } }, "node_modules/picocolors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", - "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true, "license": "ISC" }, @@ -9431,9 +9657,9 @@ "license": "BSD-3-Clause" }, "node_modules/semver": { - "version": "7.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", - "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -9789,7 +10015,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, + "devOptional": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -10255,6 +10481,72 @@ "integrity": "sha512-tLJxacIQUM82IR7JO1UUkKlYuUTmoY9HBJAmNWFzheSlDS5SPMcNIepejHJa4BpPQLAcbRhRf3GDJzyj6rbKvA==", "license": "MIT" }, + "node_modules/ts-jest": { + "version": "29.4.6", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.4.6.tgz", + "integrity": "sha512-fSpWtOO/1AjSNQguk43hb/JCo16oJDnMJf3CdEGNkqsEX3t0KX96xvyX1D7PfLCpVoKu4MfVrqUkFyblYoY4lA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bs-logger": "^0.2.6", + "fast-json-stable-stringify": "^2.1.0", + "handlebars": "^4.7.8", + "json5": "^2.2.3", + "lodash.memoize": "^4.1.2", + "make-error": "^1.3.6", + "semver": "^7.7.3", + "type-fest": "^4.41.0", + "yargs-parser": "^21.1.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/transform": "^29.0.0 || ^30.0.0", + "@jest/types": "^29.0.0 || ^30.0.0", + "babel-jest": "^29.0.0 || ^30.0.0", + "jest": "^29.0.0 || ^30.0.0", + "jest-util": "^29.0.0 || ^30.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/transform": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jest-util": { + "optional": true + } + } + }, + "node_modules/ts-jest/node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -10449,6 +10741,20 @@ "node": ">=14.17" } }, + "node_modules/uglify-js": { + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/uid-safe": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", @@ -10749,6 +11055,13 @@ "node": ">=0.10.0" } }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "devOptional": true, + "license": "MIT" + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index cf42802..4dca919 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ }, "devDependencies": { "@eslint/js": "^9.17.0", + "@types/jest": "^30.0.0", "@types/node": "22.10.2", "eslint": "^9.17.0", "globals": "^15.14.0", @@ -61,6 +62,7 @@ "mockingoose": "^2.16.2", "nodemon": "3.1.9", "supertest": "^7.0.0", + "ts-jest": "^29.4.6", "ts-node-dev": "2.0.0", "typescript": "5.7.3" } diff --git a/server/__tests__/__snapshots__/todo.test.js.snap b/server/__tests__/__snapshots__/todo.test.js.snap index 2573ff1..46ffa2a 100644 --- a/server/__tests__/__snapshots__/todo.test.js.snap +++ b/server/__tests__/__snapshots__/todo.test.js.snap @@ -4,7 +4,6 @@ exports[`todo list app get list 1`] = ` { "body": [ { - "_id": "670f69b5796ce7a9069da2f7", "created": "2024-10-16T07:22:29.042Z", "id": "670f69b5796ce7a9069da2f7", "items": [], diff --git a/server/__tests__/todo.test.js b/server/__tests__/todo.test.js index 8ee1701..8972cb3 100644 --- a/server/__tests__/todo.test.js +++ b/server/__tests__/todo.test.js @@ -2,7 +2,7 @@ const { describe, it, expect } = require('@jest/globals') const request = require('supertest') const express = require('express') const mockingoose = require('mockingoose') -const { ListModel } = require('../data/model/todo/list') +const { ListModel } = require('../routers/todo/model/todo/list') const todo = require('../routers/todo/routes') diff --git a/server/routers/kfu-m-24-1/back-new/features/image/image.controller.js b/server/routers/kfu-m-24-1/back-new/features/image/image.controller.js index 49b4489..f7b2451 100644 --- a/server/routers/kfu-m-24-1/back-new/features/image/image.controller.js +++ b/server/routers/kfu-m-24-1/back-new/features/image/image.controller.js @@ -48,6 +48,7 @@ exports.generate = async (req, res) => { } ); const content = chatResp.data.choices[0].message.content; + // eslint-disable-next-line no-useless-escape const match = content.match(/ { diff --git a/server/routers/procurement/routes/auth.js b/server/routers/procurement/routes/auth.js index ec54893..254a152 100644 --- a/server/routers/procurement/routes/auth.js +++ b/server/routers/procurement/routes/auth.js @@ -136,6 +136,7 @@ const waitForDatabaseConnection = async () => { } try { + // eslint-disable-next-line no-undef const connection = await connectDB(); if (!connection) { break; @@ -218,6 +219,7 @@ const initializeTestUser = async () => { console.error('Error initializing test data:', error.message); if (error?.code === 13 || /auth/i.test(error?.message || '')) { try { + // eslint-disable-next-line no-undef await connectDB(); } catch (connectError) { if (process.env.DEV === 'true') { diff --git a/server/routers/procurement/routes/buy.js b/server/routers/procurement/routes/buy.js index 69f22f2..58b1d66 100644 --- a/server/routers/procurement/routes/buy.js +++ b/server/routers/procurement/routes/buy.js @@ -202,6 +202,7 @@ router.get('/docs/:id/file', async (req, res) => { } const mimeType = mimeTypes[doc.type] || 'application/octet-stream' + // eslint-disable-next-line no-useless-escape const sanitizedName = doc.name.replace(/[^\w\s\-\.]/g, '_') res.setHeader('Content-Type', mimeType) diff --git a/server/routers/procurement/routes/buyProducts.js b/server/routers/procurement/routes/buyProducts.js index b844b18..af0912c 100644 --- a/server/routers/procurement/routes/buyProducts.js +++ b/server/routers/procurement/routes/buyProducts.js @@ -37,6 +37,7 @@ const storage = multer.diskStorage({ const originalExtension = path.extname(fixedName) || ''; const baseName = path .basename(fixedName, originalExtension) + // eslint-disable-next-line no-control-regex .replace(/[<>:"/\\|?*\x00-\x1F]+/g, '_'); // Убираем только недопустимые символы Windows, оставляем кириллицу cb(null, `${Date.now()}_${baseName}${originalExtension}`); }, diff --git a/server/routers/questioneer/public/static/js/common.js b/server/routers/questioneer/public/static/js/common.js index 7007de8..9a6a943 100644 --- a/server/routers/questioneer/public/static/js/common.js +++ b/server/routers/questioneer/public/static/js/common.js @@ -187,6 +187,7 @@ function showConfirm(message, callback, title) { function generateQRCode(data, size) { const typeNumber = 0; // Автоматическое определение const errorCorrectionLevel = 'L'; // Низкий уровень коррекции ошибок + // eslint-disable-next-line no-undef const qr = qrcode(typeNumber, errorCorrectionLevel); qr.addData(data); qr.make(); diff --git a/server/routers/questioneer/public/static/js/create.js b/server/routers/questioneer/public/static/js/create.js index e979449..6bb97a0 100644 --- a/server/routers/questioneer/public/static/js/create.js +++ b/server/routers/questioneer/public/static/js/create.js @@ -344,21 +344,21 @@ $(document).ready(function() { // Инициализируем атрибуты required updateRequiredAttributes(); -}); - -// Обработчик удаления вопроса -$(document).on('click', '.remove-question', function() { - $(this).closest('.question-item').remove(); - updateQuestionNumbers(); - // Вызываем функцию обновления атрибутов required - updateRequiredAttributes(); -}); - -// Обработчик удаления опции -$(document).on('click', '.remove-option', function() { - $(this).closest('.option-item').remove(); + // Обработчик удаления вопроса + $(document).on('click', '.remove-question', function() { + $(this).closest('.question-item').remove(); + updateQuestionNumbers(); + + // Вызываем функцию обновления атрибутов required + updateRequiredAttributes(); + }); - // Вызываем функцию обновления атрибутов required - updateRequiredAttributes(); + // Обработчик удаления опции + $(document).on('click', '.remove-option', function() { + $(this).closest('.option-item').remove(); + + // Вызываем функцию обновления атрибутов required + updateRequiredAttributes(); + }); }); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 72ecfc4..b1980b8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,109 +1,109 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ + /* Посетите https://aka.ms/tsconfig чтобы узнать больше об этом файле */ - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + /* Проекты */ + // "incremental": true, /* Сохранять .tsbuildinfo файлы для инкрементальной компиляции проектов. */ + // "composite": true, /* Включить ограничения, которые позволяют использовать проект TypeScript со ссылками на проекты. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Указать путь к файлу инкрементальной компиляции .tsbuildinfo. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Отключить предпочтение исходных файлов вместо файлов объявлений при ссылке на составные проекты. */ + // "disableSolutionSearching": true, /* Исключить проект из проверки ссылок нескольких проектов при редактировании. */ + // "disableReferencedProjectLoad": true, /* Уменьшить количество проектов, загружаемых автоматически TypeScript. */ - /* Language and Environment */ - "target": "es2018", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + /* Язык и окружение */ + "target": "es2018", /* Установить версию языка JavaScript для сгенерированного JavaScript и включить совместимые объявления библиотек. */ + // "lib": [], /* Указать набор объединенных файлов объявлений библиотек, описывающих целевое окружение выполнения. */ + // "jsx": "preserve", /* Указать, какой JSX код генерируется. */ + // "experimentalDecorators": true, /* Включить экспериментальную поддержку устаревших экспериментальных декораторов. */ + // "emitDecoratorMetadata": true, /* Генерировать метаданные типов дизайна для декорированных объявлений в исходных файлах. */ + // "jsxFactory": "", /* Указать функцию фабрики JSX, используемую при таргетинге на React JSX, например 'React.createElement' или 'h'. */ + // "jsxFragmentFactory": "", /* Указать ссылку на JSX Fragment, используемую для фрагментов при таргетинге на React JSX, например 'React.Fragment' или 'Fragment'. */ + // "jsxImportSource": "", /* Указать спецификатор модуля, используемый для импорта функций фабрики JSX при использовании 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Указать объект, вызываемый для 'createElement'. Применяется только при таргетинге на 'react' JSX. */ + // "noLib": true, /* Отключить включение любых файлов библиотек, включая lib.d.ts по умолчанию. */ + // "useDefineForClassFields": true, /* Генерировать поля классов, совместимые со стандартом ECMAScript. */ + // "moduleDetection": "auto", /* Управлять методом, используемым для обнаружения JS файлов формата модулей. */ - /* Modules */ - "module": "NodeNext", /* Specify what module code is generated. */ - "rootDir": ".", /* Specify the root folder within your source files. */ - "moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ - "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ - // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ - // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ - "resolveJsonModule": true, /* Enable importing .json files. */ - // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + /* Модули */ + "module": "NodeNext", /* Указать, какой код модулей генерируется. */ + "rootDir": ".", /* Указать корневую папку в ваших исходных файлах. */ + "moduleResolution": "nodenext", /* Указать, как TypeScript ищет файл по заданному спецификатору модуля. */ + // "baseUrl": "./", /* Указать базовую директорию для разрешения неотносительных имен модулей. */ + // "paths": {}, /* Указать набор записей, которые переопределяют импорты для дополнительных мест поиска. */ + // "rootDirs": [], /* Разрешить обработку нескольких папок как одной при разрешении модулей. */ + // "typeRoots": [], /* Указать несколько папок, которые действуют как './node_modules/@types'. */ + // "types": [], /* Указать имена пакетов типов, которые должны быть включены без ссылки в исходном файле. */ + // "allowUmdGlobalAccess": true, /* Разрешить доступ к UMD глобальным переменным из модулей. */ + // "moduleSuffixes": [], /* Список суффиксов имен файлов для поиска при разрешении модуля. */ + // "allowImportingTsExtensions": true, /* Разрешить импорты с расширениями файлов TypeScript. Требует '--moduleResolution bundler' и либо '--noEmit', либо '--emitDeclarationOnly'. */ + "resolvePackageJsonExports": true, /* Использовать поле 'exports' из package.json при разрешении импортов пакетов. */ + // "resolvePackageJsonImports": true, /* Использовать поле 'imports' из package.json при разрешении импортов. */ + // "customConditions": [], /* Условия для установки в дополнение к специфичным для резолвера значениям по умолчанию при разрешении импортов. */ + "resolveJsonModule": true, /* Включить импорт .json файлов. */ + // "allowArbitraryExtensions": true, /* Включить импорт файлов с любым расширением, при условии наличия файла объявлений. */ + // "noResolve": true, /* Запретить 'import's, 'require's или ''s от расширения количества файлов, которые TypeScript должен добавить в проект. */ - /* JavaScript Support */ - "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + /* Поддержка JavaScript */ + "allowJs": true, /* Разрешить файлам JavaScript быть частью вашей программы. Используйте опцию 'checkJS' для получения ошибок из этих файлов. */ + // "checkJs": true, /* Включить сообщения об ошибках в файлах JavaScript с проверкой типов. */ + // "maxNodeModuleJsDepth": 1, /* Указать максимальную глубину папок, используемую для проверки JavaScript файлов из 'node_modules'. Применимо только с 'allowJs'. */ - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./dist", /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + /* Генерация */ + // "declaration": true, /* Генерировать .d.ts файлы из файлов TypeScript и JavaScript в вашем проекте. */ + // "declarationMap": true, /* Создавать sourcemaps для d.ts файлов. */ + // "emitDeclarationOnly": true, /* Выводить только d.ts файлы, а не JavaScript файлы. */ + // "sourceMap": true, /* Создавать файлы source map для сгенерированных JavaScript файлов. */ + // "inlineSourceMap": true, /* Включать файлы sourcemap внутри сгенерированного JavaScript. */ + // "outFile": "./", /* Указать файл, который объединяет все выходные данные в один JavaScript файл. Если 'declaration' равно true, также обозначает файл, который объединяет весь .d.ts вывод. */ + "outDir": "./dist", /* Указать выходную папку для всех сгенерированных файлов. */ + // "removeComments": true, /* Отключить генерацию комментариев. */ + // "noEmit": true, /* Отключить генерацию файлов из компиляции. */ + // "importHelpers": true, /* Разрешить импорт вспомогательных функций из tslib один раз на проект, вместо включения их в каждый файл. */ + // "importsNotUsedAsValues": "remove", /* Указать поведение генерации/проверки для импортов, которые используются только для типов. */ + // "downlevelIteration": true, /* Генерировать более совместимый, но многословный и менее производительный JavaScript для итерации. */ + // "sourceRoot": "", /* Указать корневой путь для отладчиков для поиска эталонного исходного кода. */ + // "mapRoot": "", /* Указать местоположение, где отладчик должен найти map файлы вместо сгенерированных местоположений. */ + // "inlineSources": true, /* Включать исходный код в sourcemaps внутри сгенерированного JavaScript. */ + // "emitBOM": true, /* Генерировать UTF-8 Byte Order Mark (BOM) в начале выходных файлов. */ + // "newLine": "crlf", /* Установить символ новой строки для генерации файлов. */ + // "stripInternal": true, /* Отключить генерацию объявлений, которые имеют '@internal' в их JSDoc комментариях. */ + // "noEmitHelpers": true, /* Отключить генерацию пользовательских вспомогательных функций, таких как '__extends' в скомпилированном выводе. */ + // "noEmitOnError": true, /* Отключить генерацию файлов, если сообщается о любых ошибках проверки типов. */ + // "preserveConstEnums": true, /* Отключить стирание объявлений 'const enum' в сгенерированном коде. */ + // "declarationDir": "./", /* Указать выходную директорию для сгенерированных файлов объявлений. */ + // "preserveValueImports": true, /* Сохранять неиспользуемые импортированные значения в выводе JavaScript, которые в противном случае были бы удалены. */ - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + /* Ограничения взаимодействия */ + "isolatedModules": true, /* Обеспечить, чтобы каждый файл мог быть безопасно транслирован без зависимости от других импортов. */ + // "verbatimModuleSyntax": true, /* Не преобразовывать или опускать любые импорты или экспорты, не помеченные как только для типов, обеспечивая их запись в формате выходного файла на основе настройки 'module'. */ + // "allowSyntheticDefaultImports": true, /* Разрешить 'import x from y' когда модуль не имеет экспорта по умолчанию. */ + "esModuleInterop": true, /* Генерировать дополнительный JavaScript для упрощения поддержки импорта модулей CommonJS. Это включает 'allowSyntheticDefaultImports' для совместимости типов. */ + // "preserveSymlinks": true, /* Отключить разрешение символических ссылок к их реальному пути. Соответствует тому же флагу в node. */ + "forceConsistentCasingInFileNames": true, /* Обеспечить правильный регистр в импортах. */ - /* Type Checking */ - "strict": false, /* Enable all strict type-checking options. */ - "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + /* Проверка типов */ + "strict": false, /* Включить все строгие опции проверки типов. */ + "noImplicitAny": false, /* Включить сообщения об ошибках для выражений и объявлений с подразумеваемым типом 'any'. */ + // "strictNullChecks": true, /* При проверке типов учитывать 'null' и 'undefined'. */ + // "strictFunctionTypes": true, /* При присваивании функций проверять, чтобы параметры и возвращаемые значения были совместимы по подтипам. */ + // "strictBindCallApply": true, /* Проверять, что аргументы для методов 'bind', 'call' и 'apply' соответствуют исходной функции. */ + // "strictPropertyInitialization": true, /* Проверять свойства классов, которые объявлены, но не установлены в конструкторе. */ + // "noImplicitThis": true, /* Включить сообщения об ошибках, когда 'this' получает тип 'any'. */ + // "useUnknownInCatchVariables": true, /* Переменные предложения catch по умолчанию как 'unknown' вместо 'any'. */ + // "alwaysStrict": true, /* Обеспечить, чтобы 'use strict' всегда генерировался. */ + // "noUnusedLocals": true, /* Включить сообщения об ошибках, когда локальные переменные не читаются. */ + // "noUnusedParameters": true, /* Вызывать ошибку, когда параметр функции не читается. */ + // "exactOptionalPropertyTypes": true, /* Интерпретировать типы необязательных свойств как написано, а не добавлять 'undefined'. */ + // "noImplicitReturns": true, /* Включить сообщения об ошибках для путей кода, которые не возвращают явно в функции. */ + // "noFallthroughCasesInSwitch": true, /* Включить сообщения об ошибках для случаев провала в операторах switch. */ + // "noUncheckedIndexedAccess": true, /* Добавлять 'undefined' к типу при доступе с использованием индекса. */ + // "noImplicitOverride": true, /* Обеспечить, чтобы переопределяющие члены в производных классах были помечены модификатором override. */ + // "noPropertyAccessFromIndexSignature": true, /* Принуждает использовать индексированные аксессоры для ключей, объявленных с использованием индексированного типа. */ + // "allowUnusedLabels": true, /* Отключить сообщения об ошибках для неиспользуемых меток. */ + // "allowUnreachableCode": true, /* Отключить сообщения об ошибках для недостижимого кода. */ + /* Полнота */ + // "skipDefaultLibCheck": true, /* Пропускать проверку типов .d.ts файлов, которые включены в TypeScript. */ + "skipLibCheck": true /* Пропускать проверку типов всех .d.ts файлов. */ }, "exclude": [ "node_modules",