Skip to content

Commit 69b31eb

Browse files
authored
chore: Update the environment (#64)
This pull request updates project configuration files to modernize tooling and clarify environment requirements. The main changes include updating dependencies to newer versions, renaming a script for consistency, and specifying the required Node.js version and package manager. **Tooling and dependency updates:** * Updated development dependencies in `package.json` to newer versions for tools such as `jest`, `eslint`, `typescript`, and related plugins. * Improved the `jest` transform configuration formatting for better readability. **Project configuration and environment:** * Renamed the `lint-fix` script to `lint:fix` in `package.json` for consistency with common naming conventions. * Added `engines` field to specify required Node.js version (>=22) and declared the package manager as `[email protected]` in `package.json`. * Removed the `.node-version` file, which previously pinned Node.js to version 22.12.0, in favor of the new `engines` field.
1 parent 8512404 commit 69b31eb

File tree

7 files changed

+1590
-1340
lines changed

7 files changed

+1590
-1340
lines changed

.node-version

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

algorithms/dp/knapsack/knapsack.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Knapsack', () => {
5151
{weight: 3, value: 4},
5252
];
5353
const capacity = 5;
54-
expect(() => Knapsack.solve(items, capacity)).toThrowError(
54+
expect(() => Knapsack.solve(items, capacity)).toThrow(
5555
'Item weights and values must be non-negative',
5656
);
5757
});
@@ -94,7 +94,7 @@ describe('Knapsack', () => {
9494
{weight: 10, value: 50},
9595
];
9696
const capacity = 15;
97-
expect(() => Knapsack.solveFractional(items, capacity)).toThrowError(
97+
expect(() => Knapsack.solveFractional(items, capacity)).toThrow(
9898
'Item weights and values must be non-negative',
9999
);
100100
});

algorithms/search/bellman-ford-search/bellmanFordSearch.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ describe('BellmanFord', () => {
3434
{source: 0, target: 1, weight: 4},
3535
{source: 1, target: 2, weight: 3},
3636
];
37-
expect(() => BellmanFord.findShortestPaths(0, edges, 0)).toThrowError(
37+
expect(() => BellmanFord.findShortestPaths(0, edges, 0)).toThrow(
3838
'Number of vertices must be positive',
3939
);
4040
});
4141
test('should throw error for invalid edge vertices', () => {
4242
const edges = [{source: 0, target: 5, weight: 4}];
43-
expect(() => BellmanFord.findShortestPaths(4, edges, 0)).toThrowError(
43+
expect(() => BellmanFord.findShortestPaths(4, edges, 0)).toThrow(
4444
'Edge contains an invalid vertex',
4545
);
4646
});

data-structures/trie/trie.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ describe('Trie', () => {
3333
expect(trie.findWords('cat')).toEqual([]);
3434
});
3535
test('should throw an error for empty string insertion', () => {
36-
expect(() => trie.insert('')).toThrowError('Cannot insert an empty string');
36+
expect(() => trie.insert('')).toThrow('Cannot insert an empty string');
3737
});
3838
});

data-structures/union-find/unionFind.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('UnionFind', () => {
1313
expect(uf.connected(1, 1)).toBe(true);
1414
});
1515
test('should throw an error when find is called on a non-existent element', () => {
16-
expect(() => uf.find(1)).toThrowError('Element 1 not found in any set');
16+
expect(() => uf.find(1)).toThrow('Element 1 not found in any set');
1717
});
1818
test('should connect two elements using union', () => {
1919
uf.makeSet(1);
@@ -58,7 +58,7 @@ describe('UnionFind', () => {
5858
expect(uf.connected(1, 2)).toBe(false);
5959
});
6060
test('should throw an error when getSize is called on a non-existent element', () => {
61-
expect(() => uf.getSize(1)).toThrowError('Element 1 not found in any set');
61+
expect(() => uf.getSize(1)).toThrow('Element 1 not found in any set');
6262
});
6363
test('should correctly manage set sizes', () => {
6464
uf.makeSet(1);

package.json

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
"name": "computer-science",
33
"version": "1.0.0",
44
"description": "Computer Science in TypeScript",
5+
"license": "ISC",
56
"main": "",
67
"scripts": {
78
"test": "jest",
89
"typecheck": "tsc --noEmit --skipLibCheck",
910
"lint": "eslint ./**/*.ts",
10-
"lint-fix": "eslint --fix ./**/*.ts",
11+
"lint:fix": "eslint --fix ./**/*.ts",
1112
"prettier": "prettier --write './**/*.{js,ts,tsx}' --ignore-path '.gitignore'"
1213
},
1314
"devDependencies": {
14-
"@types/jest": "^29.5.14",
15-
"@typescript-eslint/eslint-plugin": "^8.18.2",
16-
"@typescript-eslint/parser": "^8.18.2",
17-
"eslint": "^9.17.0",
15+
"@types/jest": "^30.0.0",
16+
"@typescript-eslint/eslint-plugin": "^8.43.0",
17+
"@typescript-eslint/parser": "^8.43.0",
18+
"eslint": "^9.35.0",
1819
"husky": "^9.1.7",
19-
"jest": "^29.7.0",
20-
"lint-staged": "^15.2.11",
21-
"prettier": "^3.4.2",
22-
"ts-jest": "^29.2.5",
23-
"ts-node": "^10.9.2",
24-
"typescript": "^5.7.2"
20+
"jest": "^30.1.3",
21+
"lint-staged": "^16.1.6",
22+
"prettier": "^3.6.2",
23+
"ts-jest": "^29.4.1",
24+
"typescript": "^5.9.2"
2525
},
2626
"lint-staged": {
2727
"*.{ts,tsx}": [
@@ -32,17 +32,16 @@
3232
},
3333
"jest": {
3434
"transform": {
35-
"^.+\\.tsx?$": ["ts-jest", { "tsconfig": "tsconfig.json" }]
35+
"^.+\\.tsx?$": [
36+
"ts-jest",
37+
{
38+
"tsconfig": "tsconfig.json"
39+
}
40+
]
3641
}
3742
},
38-
"repository": {
39-
"type": "git",
40-
"url": "git+https://github.com/monkey0722/computer-science.git"
41-
},
42-
"author": "monkey0722",
43-
"license": "ISC",
44-
"bugs": {
45-
"url": "https://github.com/monkey0722/computer-science/issues"
43+
"engines": {
44+
"node": ">=22"
4645
},
47-
"homepage": "https://github.com/monkey0722/computer-science#readme"
46+
"packageManager": "[email protected]"
4847
}

0 commit comments

Comments
 (0)