feat: add typescript #9

This commit is contained in:
Sergey Krylov 2024-04-23 06:40:00 +03:00
parent 950fbee317
commit a603f31c1a
11 changed files with 105 additions and 5 deletions

View File

@ -55,6 +55,12 @@
"order": "asc",
"caseInsensitive": true
}
}],
"import/extensions": ["error", {
"js": "never",
"jsx": "never",
"tsx": "never",
"ts": "never"
}]
}
}

View File

@ -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

Binary file not shown.

View File

@ -1,5 +1,6 @@
module.exports = {
presets: [
'@babel/preset-typescript',
'@babel/preset-env',
['@babel/preset-react', {
runtime: 'automatic',

View File

@ -1,7 +1,7 @@
module.exports = {
testEnvironment: 'jsdom',
transform: {
'\\.jsx?$': ['babel-jest', {
'\\.[j|t]sx?$': ['babel-jest', {
configFile: './configs/jest/babel-jest.config.js',
}],
},

Binary file not shown.

Binary file not shown.

View File

@ -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"
}

View File

@ -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(<MoneyControllApp />);
root.render(<MoneyControllApp />);
}

55
tsconfig.json Normal file
View File

@ -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
}
}

View File

@ -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<compat/typescript>":
version: 5.4.5
resolution: "typescript@patch:typescript@npm%3A5.4.5#optional!builtin<compat/typescript>::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"