Skip to content

Commit e2fe62f

Browse files
committed
use vite with typescript
1 parent c831d16 commit e2fe62f

14 files changed

+2377
-589
lines changed

typescript/.eslintrc.cjs

Lines changed: 0 additions & 17 deletions
This file was deleted.

typescript/.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
node_modules
2-
dist
3-
42
.idea
5-
.DS_store
6-
3+
.vite
4+
dist

typescript/.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

typescript/.prettierrc.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module.exports = {
44
jsxSingleQuote: true,
55
printWidth: 120,
66
semi: false,
7-
tabSize: 2,
8-
};
7+
plugins: [],
8+
}

typescript/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

typescript/eslint.config.cjs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
const tsParser = require('@typescript-eslint/parser')
2+
const tsPlugin = require('@typescript-eslint/eslint-plugin')
3+
const prettierPlugin = require('eslint-plugin-prettier')
4+
const importPlugin = require('eslint-plugin-import')
5+
6+
module.exports = [
7+
{
8+
ignores: ['**/dist/**', '**/node_modules/**'],
9+
},
10+
{
11+
files: ['**/*.ts', '**/*.js'],
12+
languageOptions: {
13+
globals: {
14+
es6: true,
15+
node: true,
16+
},
17+
parser: tsParser,
18+
parserOptions: {
19+
ecmaVersion: 'latest',
20+
sourceType: 'module',
21+
},
22+
},
23+
plugins: {
24+
'@typescript-eslint': tsPlugin,
25+
prettier: prettierPlugin,
26+
import: importPlugin,
27+
},
28+
rules: {
29+
...tsPlugin.configs.recommended.rules,
30+
'@typescript-eslint/ban-ts-comment': 'off',
31+
'prettier/prettier': [
32+
'error',
33+
{
34+
trailingComma: 'es5',
35+
singleQuote: true,
36+
jsxSingleQuote: true,
37+
printWidth: 120,
38+
semi: false,
39+
},
40+
],
41+
'no-restricted-syntax': [
42+
'error',
43+
{
44+
selector: 'FunctionDeclaration',
45+
message: 'Use arrow functions with const instead of the "function" keyword.',
46+
},
47+
],
48+
},
49+
},
50+
]

typescript/package.json

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
{
2-
"name": "algo-tdd-starters",
2+
"name": "2025-02-12-toptal-telcoin-preparation",
33
"version": "1.0.0",
4+
"main": "index.js",
45
"license": "MIT",
5-
"description": "",
6-
"type": "module",
76
"scripts": {
8-
"test": "vitest --run",
9-
"test:watch": "vitest",
7+
"test": "vitest",
108
"lint": "eslint . --fix"
119
},
12-
"author": "GA1",
13-
"dependencies": {
14-
},
1510
"devDependencies": {
16-
"typescript": "5.2.2",
17-
"vitest": "^0.34.6"
18-
},
19-
"engines": {
20-
"node": ">=18.12.0",
21-
"npm": ">=8.19.2"
11+
"@typescript-eslint/eslint-plugin": "^8.24.0",
12+
"@typescript-eslint/parser": "^8.24.0",
13+
"eslint": "^9.20.1",
14+
"eslint-plugin-import": "^2.31.0",
15+
"eslint-plugin-prettier": "^5.2.3",
16+
"prettier": "^3.5.0",
17+
"typescript": "^5.7.3",
18+
"vitest": "^3.0.5"
2219
}
2320
}

typescript/src/math-utils.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

typescript/src/some-functions.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { describe, expect, test } from "vitest";
2+
import { someFunction1, someFunction2 } from "./some-functions";
3+
4+
describe("tests", () => {
5+
test("someFunction1", () => {
6+
expect(someFunction1()).toEqual(5);
7+
});
8+
9+
test("someFunction2", () => {
10+
expect(() => someFunction2()).toThrow(Error("some error"));
11+
});
12+
});

typescript/src/some-functions.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const someFunction1 = () => {
2+
return 5;
3+
};
4+
5+
export const someFunction2 = () => {
6+
throw Error("some error");
7+
};

0 commit comments

Comments
 (0)