Skip to content

Commit d110b06

Browse files
authored
Merge pull request #61 from monkey0722/refactoring-0103
Improve Code Style and Config, Plus Minor Refactoring
2 parents 88e7a6e + 90eb2a1 commit d110b06

File tree

7 files changed

+36
-33
lines changed

7 files changed

+36
-33
lines changed

.gitignore

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
# npm yarn
2-
/node_modules
3-
/npm-debug.log
4-
package-lock.json
5-
yarn-*.log
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# node.js
6+
#
7+
node_modules/
8+
npm-debug.log
9+
yarn-error.log
File renamed without changes.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ export class BellmanFord {
1616
* @throws {Error} If the input parameters are invalid.
1717
*/
1818
static findShortestPaths(vertices: number, edges: Edge[], source: number): number[] | null {
19-
// Validate input
2019
this.validateInput(vertices, edges, source);
2120

22-
// Initialize distances
2321
const distances = new Array(vertices).fill(Infinity);
2422
distances[source] = 0;
2523

eslint.config.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
1-
const parser = require("@typescript-eslint/parser");
2-
const typescriptPlugin = require("@typescript-eslint/eslint-plugin");
1+
const parser = require('@typescript-eslint/parser');
2+
const typescriptPlugin = require('@typescript-eslint/eslint-plugin');
33

44
module.exports = [
55
{
6-
files: ["**/*.ts"],
6+
files: ['**/*.ts'],
77
languageOptions: {
88
parser: parser,
99
parserOptions: {
10-
sourceType: "module",
11-
project: "./tsconfig.json",
10+
sourceType: 'module',
11+
project: './tsconfig.json',
1212
tsconfigRootDir: __dirname,
1313
},
1414
},
1515
plugins: {
16-
"@typescript-eslint": typescriptPlugin,
16+
'@typescript-eslint': typescriptPlugin,
1717
},
1818
rules: {
19-
"no-extra-semi": "off",
20-
"no-irregular-whitespace": ["error", { skipTemplates: true }],
21-
"@typescript-eslint/no-unused-vars": "error",
22-
"@typescript-eslint/no-useless-constructor": "error",
23-
"@typescript-eslint/explicit-function-return-type": ["warn", {
24-
allowExpressions: true,
25-
allowTypedFunctionExpressions: true,
26-
}],
27-
"@typescript-eslint/no-floating-promises": "error",
28-
"@typescript-eslint/await-thenable": "error",
29-
"eqeqeq": ["error", "always", { null: "ignore" }],
19+
'no-extra-semi': 'off',
20+
'no-irregular-whitespace': ['error', {skipTemplates: true}],
21+
'@typescript-eslint/no-unused-vars': 'error',
22+
'@typescript-eslint/no-useless-constructor': 'error',
23+
'@typescript-eslint/explicit-function-return-type': [
24+
'warn',
25+
{
26+
allowExpressions: true,
27+
allowTypedFunctionExpressions: true,
28+
},
29+
],
30+
'@typescript-eslint/no-floating-promises': 'error',
31+
'@typescript-eslint/await-thenable': 'error',
32+
eqeqeq: ['error', 'always', {null: 'ignore'}],
3033
},
3134
},
3235
];

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
{
22
"name": "computer-science",
33
"version": "1.0.0",
4-
"description": "",
4+
"description": "Computer Science in TypeScript",
55
"main": "",
66
"scripts": {
77
"test": "jest",
88
"typecheck": "tsc --noEmit --skipLibCheck",
99
"lint": "eslint ./**/*.ts",
1010
"lint-fix": "eslint --fix ./**/*.ts",
11-
"prettier": "prettier --write \"./**/*.{ts,tsx}\" --ignore-path \".gitignore\""
12-
},
13-
"dependencies": {
14-
"typescript": "^5.7.2"
11+
"prettier": "prettier --write './**/*.{js,ts,tsx}' --ignore-path '.gitignore'"
1512
},
1613
"devDependencies": {
1714
"@types/jest": "^29.5.14",
@@ -23,7 +20,8 @@
2320
"lint-staged": "^15.2.11",
2421
"prettier": "^3.4.2",
2522
"ts-jest": "^29.2.5",
26-
"ts-node": "^10.9.2"
23+
"ts-node": "^10.9.2",
24+
"typescript": "^5.7.2"
2725
},
2826
"lint-staged": {
2927
"*.{ts,tsx}": [
@@ -34,7 +32,7 @@
3432
},
3533
"jest": {
3634
"transform": {
37-
"^.+\\.tsx?$": "ts-jest"
35+
"^.+\\.tsx?$": ["ts-jest", { "tsconfig": "tsconfig.json" }]
3836
}
3937
},
4038
"repository": {

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"module": "NodeNext",
4-
"target": "ES2023",
4+
"target": "ESNext",
55
"lib": ["ES2023", "DOM"],
66
"sourceMap": true,
77
"allowJs": true,
@@ -18,7 +18,7 @@
1818
"forceConsistentCasingInFileNames": true,
1919
"baseUrl": ".",
2020
"paths": {
21-
"~": ["/"]
21+
"~": ["./"]
2222
}
2323
},
2424
"include": [

0 commit comments

Comments
 (0)