diff --git a/.eslintrc b/.eslintrc index 8512c93..d80a2c5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -55,6 +55,12 @@ "order": "asc", "caseInsensitive": true } + }], + "import/extensions": ["error", { + "js": "never", + "jsx": "never", + "tsx": "never", + "ts": "never" }] } } diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1425132..6770adb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,7 +28,18 @@ test: script: - yarn run test:start only: + - branches - merge_requests + - tags + +typechecking: + stage: checking + script: + - yarn run typechecking + only: + - branches + - merge_requests + - tags pages: stage: deploy diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index f472654..89e1783 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/configs/jest/babel-jest.config.js b/configs/jest/babel-jest.config.js index 65874c3..b5926f6 100644 --- a/configs/jest/babel-jest.config.js +++ b/configs/jest/babel-jest.config.js @@ -1,5 +1,6 @@ module.exports = { presets: [ + '@babel/preset-typescript', '@babel/preset-env', ['@babel/preset-react', { runtime: 'automatic', diff --git a/jest.config.js b/jest.config.js index f0804c4..6123f6f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,7 @@ module.exports = { testEnvironment: 'jsdom', transform: { - '\\.jsx?$': ['babel-jest', { + '\\.[j|t]sx?$': ['babel-jest', { configFile: './configs/jest/babel-jest.config.js', }], }, diff --git a/offline_node_modules/typescript-npm-5.4.5-8568a42232-2954022ada.zip b/offline_node_modules/typescript-npm-5.4.5-8568a42232-2954022ada.zip new file mode 100644 index 0000000..4d0caa9 Binary files /dev/null and b/offline_node_modules/typescript-npm-5.4.5-8568a42232-2954022ada.zip differ diff --git a/offline_node_modules/typescript-patch-6e159bfddb-db2ad2a16c.zip b/offline_node_modules/typescript-patch-6e159bfddb-db2ad2a16c.zip new file mode 100644 index 0000000..5611716 Binary files /dev/null and b/offline_node_modules/typescript-patch-6e159bfddb-db2ad2a16c.zip differ diff --git a/package.json b/package.json index cf5b307..ecb5e19 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "lint": "eslint src", "test:start": "jest", "test:coverage": "jest --coverage", + "typechecking": "tsc --noEmit", "release": "standard-version" }, "engines": { @@ -41,6 +42,7 @@ "@babel/core": "7.24.3", "@babel/preset-env": "7.24.3", "@babel/preset-react": "7.24.1", + "@babel/preset-typescript": "7.24.1", "@commitlint/cli": "19.2.1", "@commitlint/config-conventional": "19.1.0", "@testing-library/jest-dom": "6.4.2", @@ -56,7 +58,8 @@ "jest-environment-jsdom": "29.7.0", "ksv741-react-scripts": "0.3.1", "lint-staged": "15.2.2", - "standard-version": "9.5.0" + "standard-version": "9.5.0", + "typescript": "5.4.5" }, "packageManager": "yarn@4.1.1" } diff --git a/src/index.jsx b/src/index.tsx similarity index 66% rename from src/index.jsx rename to src/index.tsx index 0711460..5ba8418 100644 --- a/src/index.jsx +++ b/src/index.tsx @@ -4,6 +4,8 @@ import { createRoot } from 'react-dom/client'; import { MoneyControllApp } from 'apps/MoneyControllApp'; const domNode = document.getElementById('root'); -const root = createRoot(domNode); +if (domNode) { + const root = createRoot(domNode); -root.render(); + root.render(); +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..20888c7 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,55 @@ +{ + "include": [ + "./src", + "./configs" + ], + "compilerOptions": { + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "alwaysStrict": true, + "exactOptionalPropertyTypes": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "useUnknownInCatchVariables": true, + + "allowArbitraryExtensions": true, + "allowImportingTsExtensions": true, + "allowUmdGlobalAccess": true, + + "module": "ESNext", + "moduleResolution": "Bundler", + "paths": { + "*": ["./src/*"] + }, + + "resolveJsonModule": true, + "resolvePackageJsonExports": true, + "resolvePackageJsonImports": true, + "noEmit": true, + "noEmitOnError": true, + "preserveConstEnums": true, + "allowJs": true, + + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, + "jsx": "react-jsx", + "lib": [ + "ESNext", + "DOM" + ], + "skipLibCheck": true + } +} diff --git a/yarn.lock b/yarn.lock index cf8998c..5c1d1b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1559,7 +1559,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-typescript@npm:^7.21.0": +"@babel/preset-typescript@npm:7.24.1, @babel/preset-typescript@npm:^7.21.0": version: 7.24.1 resolution: "@babel/preset-typescript@npm:7.24.1" dependencies: @@ -10901,6 +10901,7 @@ __metadata: "@babel/core": "npm:7.24.3" "@babel/preset-env": "npm:7.24.3" "@babel/preset-react": "npm:7.24.1" + "@babel/preset-typescript": "npm:7.24.1" "@commitlint/cli": "npm:19.2.1" "@commitlint/config-conventional": "npm:19.1.0" "@testing-library/jest-dom": "npm:6.4.2" @@ -10923,6 +10924,7 @@ __metadata: react-dom: "npm:18.2.0" react-router-dom: "npm:6.22.3" standard-version: "npm:9.5.0" + typescript: "npm:5.4.5" languageName: unknown linkType: soft @@ -14510,6 +14512,26 @@ __metadata: languageName: node linkType: hard +"typescript@npm:5.4.5": + version: 5.4.5 + resolution: "typescript@npm:5.4.5" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 10c0/2954022ada340fd3d6a9e2b8e534f65d57c92d5f3989a263754a78aba549f7e6529acc1921913560a4b816c46dce7df4a4d29f9f11a3dc0d4213bb76d043251e + languageName: node + linkType: hard + +"typescript@patch:typescript@npm%3A5.4.5#optional!builtin": + version: 5.4.5 + resolution: "typescript@patch:typescript@npm%3A5.4.5#optional!builtin::version=5.4.5&hash=5adc0c" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 10c0/db2ad2a16ca829f50427eeb1da155e7a45e598eec7b086d8b4e8ba44e5a235f758e606d681c66992230d3fc3b8995865e5fd0b22a2c95486d0b3200f83072ec9 + languageName: node + linkType: hard + "uglify-js@npm:^3.1.4": version: 3.17.4 resolution: "uglify-js@npm:3.17.4"