systemPatterns.json•2.86 kB
{
  "schema": "memory_document_v2",
  "metadata": {
    "id": "feature-lint-mcp-system-patterns",
    "title": "System Patterns for feature/lint-mcp",
    "documentType": "system_patterns",
    "path": "systemPatterns.json",
    "tags": [],
    "createdAt": "2025-04-10T10:03:36.638Z",
    "lastModified": "2025-04-10T11:08:10.560Z"
  },
  "content": {
    "patterns": [
      {
        "pattern_type": "linting",
        "title": "TypeScriptの回避すべきパターン",
        "description": "ESLintで検出される、プロジェクトで回避すべきパターン",
        "examples": [
          "1. @typescript-eslint/explicit-function-return-type - 関数の戻り値型を常に明示する。特にPromiseを返す非同期関数で重要。",
          "2. no-case-declarations - switch文のcase句内で変数宣言を行う場合はブロックスコープ{ }で囲む。",
          "3. @typescript-eslint/no-explicit-any - any型の使用を避け、具体的な型を指定する。",
          "4. no-console - 許可されたwarn, error, info以外のconsoleメソッドは使用しない。"
        ],
        "date_identified": "2025-04-10",
        "status": "active"
      },
      {
        "pattern_type": "type-safety",
        "title": "TypeScriptでのany型回避パターン",
        "description": "any型を避け、より具体的な型に置き換えるパターン",
        "examples": [
          "1. Record<string, unknown>を使用して、不明なオブジェクト構造を表現",
          "2. 例外などのerrorパラメータにはunknown型を使用し、使用時にinstanceof Errorでチェック",
          "3. JSON処理を行う場合はJSON.parse()の結果をas Record<string, unknown>などで型アサーション",
          "4. コールバック関数などへの引数もanyではなく具体的な型または型パラメータを使用"
        ],
        "date_identified": "2025-04-10",
        "status": "active"
      },
      {
        "pattern_type": "logging",
        "title": "適切なロギング手法",
        "description": "コンソール出力の代わりに適切なロギング方法を使用するパターン",
        "examples": [
          "1. VSCodeの拡張機能ではconsole.log/debugの代わりにvscode.window.showInformationMessage/showWarningMessage/showErrorMessageを使用",
          "2. ノードアプリケーションでは専用のロガー(logger.info/warn/error)を使用",
          "3. エラーハンドリング時に詳細情報をログに残す際はerrorオブジェクトをそのまま渡す(文字列化しない)",
          "4. デバッグ用のログはproduction環境では出力しないように条件分岐を使用"
        ],
        "date_identified": "2025-04-10",
        "status": "active"
      }
    ]
  }
}