Skip to content

Commit 7891a6d

Browse files
committed
♻️ Refactor: Improved code style
Improved code style consistency by adding semicolons, adjusting trailing comma settings, and modifying ESLint configurations. Also added a model argument to the tokenCount function to enhance encoding selection.
1 parent 1fed8e4 commit 7891a6d

26 files changed

Lines changed: 961 additions & 1306 deletions

.devcontainer/devcontainer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"esbenp.prettier-vscode"
1212
]
1313
}
14+
},
15+
"containerEnv": {
16+
"TZ": "${localEnv:TZ:JST-9}" // ホストの環境変数TZの値がnullの場合、'JST-9'を設定
1417
}
1518

1619
// Features to add to the dev container. More info: https://containers.dev/features.
@@ -28,11 +31,10 @@
2831
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
2932
// "remoteUser": "root"
3033
}
31-
// 鍵についてはssh-add -l で確認
34+
// 鍵についてはssh-add -l で確認
3235
// 環境変数http_proxyや~/.gitconfigは、コンテナ作成時の値が自動的に登録されている。
3336
// # Devコンテナでgit commitするときに必要な設定
3437
// scp -p user@example.com:.ssh/config ~/.ssh/
3538
// sudo sh -c "apt update && apt install git-secrets connect-proxy"
36-
// # OpenCommitの設定
37-
// scp -p user@example.com:.opencommit /home/node/
39+
// # OpenCommitの設定は、.opencommetではなく環境変数で行う。
3840

.github/copilot-instructions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
- 新たに生成するコメントは日本語にしてください。ただし元のコメントが英語の場合は英語にしてください。
22
- コード変更時に元からあるコメントは、そのまま残してください。
33
- JavaScriptやTypeScriptで行末のセミコロンは省略してください。
4+
- gitのコミットメッセージを作る時には以下の規則に従ってください。
5+
- 従来のコミット規則に従ってください。
6+
- GitMoji 規則を使用してください。
7+
- 一行目には、明確で包括的なコミットメッセージを作成し、変更内容と変更が行われた理由を説明てください。
8+
- 追加で、変更が行われた理由の短い説明を追加します。「このコミット」で始めず、変更内容のみを現在形で記述してください。一行の長さは 74 文字以下にしてください。
9+
- 最後に英語でコミットメッセージ全体の翻訳を挿入してください。
10+

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ temp/
44
build/
55
application.log
66
.DS_Store
7-
/*.env
7+
/.env*
88
logfile.log
99
uncaughtExceptions.log
10-
.vscode
1110
src/*.json
1211
.idea
1312
test.ts

.prettierrc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2-
"trailingComma": "none",
3-
"singleQuote": true
4-
}
2+
"semi": false,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"printWidth": 120,
6+
"arrowParens": "avoid"
7+
}

eslint.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ export default tseslint.config({
1818
"max-lines": ["warn", {"max": 500}], //GitLab250
1919
//"complexity": ["error", { "max": 5 }], //GitLab5
2020
"import/order": "off",
21-
"sort-imports": "warn",
21+
"sort-imports": "off",
2222
"@typescript-eslint/no-non-null-assertion": "off",
2323
"@typescript-eslint/no-unused-vars": ["error", {
2424
"argsIgnorePattern": "^_",
25+
"caughtErrorsIgnorePattern": "^_",
2526
"varsIgnorePattern": "^[A-Z]"
2627
}],
2728
/** 命名規則 */
@@ -44,6 +45,7 @@ export default tseslint.config({
4445
// 未使用の変数や関数は宣言禁止、ただし大文字で始まっているものはクラスなので許す
4546
"no-unused-vars": ["error", {
4647
"argsIgnorePattern": "^_",
48+
"caughtErrorsIgnorePattern": "^_",
4749
"varsIgnorePattern": "^[A-Z]"
4850
}],
4951
"no-console": "error"

opencommit.code-workspace

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"version": "0.2.0",
1010
"configurations": [
1111
{ // https://www.npmjs.com/package/tsx#debugging-method-1-run-tsx-directly-from-vscode
12-
"name": "Node TypeScript テスト",
12+
"name": "Google Gemin Test",
1313
"type": "node",
1414
"request": "launch",
15-
//"envFile": "${workspaceFolder}/.env.debug",
15+
"envFile": "${workspaceFolder}/.env.debug.gemini",
1616
// Debug current file in VSCode
1717
"program": "${workspaceFolder}/src/cli.ts", //"${file}",
1818
//"stopOnEntry": true,
@@ -25,9 +25,36 @@
2525
Open terminal when debugging starts (Optional)
2626
Useful to see console.logs
2727
*/
28-
"console": "integratedTerminal",
28+
"console": "integratedTerminal", //Defaultの"internalConsole"だとデバッグコンソールなのでインタラクティブなYes/Noの入力ができない
2929
"internalConsoleOptions": "neverOpen", //デバッグ セッション中の [デバッグ コンソール] パネルの表示/非表示を制御
30-
//"outputCapture": "std", //LogがDEBUG CONSOLEに出る
30+
"outputCapture": "std", //LogがDEBUG CONSOLEに出る
31+
// Files to exclude from debugger (e.g. call stack)
32+
"skipFiles": [
33+
// Node.js internal core modules
34+
"<node_internals>/**",
35+
// Ignore all dependencies (optional)
36+
"${workspaceFolder}/node_modules/**",
37+
],
38+
},
39+
{
40+
"name": "Azure OpenAI Test",
41+
"type": "node",
42+
"request": "launch",
43+
"envFile": "${workspaceFolder}/.env.debug.azure",
44+
// Debug current file in VSCode
45+
"program": "${workspaceFolder}/src/cli.ts",
46+
//"stopOnEntry": true,
47+
/*
48+
Path to tsx binary
49+
Assuming locally installed
50+
*/
51+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/tsx",
52+
/*
53+
Open terminal when debugging starts (Optional)
54+
Useful to see console.logs
55+
*/
56+
"console": "integratedTerminal",
57+
"internalConsoleOptions": "neverOpen",
3158
// Files to exclude from debugger (e.g. call stack)
3259
"skipFiles": [
3360
// Node.js internal core modules
@@ -36,6 +63,21 @@
3663
"${workspaceFolder}/node_modules/**",
3764
],
3865
},
66+
// IntelliSense を使用して利用可能な属性を学べます。
67+
// 既存の属性の説明をホバーして表示します。
68+
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
69+
{
70+
"type": "node",
71+
"request": "launch",
72+
"name": "Launch Program",
73+
"skipFiles": [
74+
"<node_internals>/**"
75+
],
76+
"program": "${file}",
77+
"outFiles": [
78+
"${workspaceFolder}/**/*.js"
79+
]
80+
},
3981
]
4082
},
4183
"extensions": {

0 commit comments

Comments
 (0)