From 1dcf03cfa6fabc999272a83b23f417ff17653639 Mon Sep 17 00:00:00 2001 From: kamask Date: Thu, 22 Oct 2026 13:07:47 +0300 Subject: [PATCH] chore: track claude project settings and lint hook Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01QwNRDG9WaKM3Bb9WJddFzx --- .claude/hooks/lint-format-file.sh | 21 +++++++++++++++++++++ .claude/settings.json | 27 +++++++++++++++++++++++++++ .gitignore | 4 +++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .claude/hooks/lint-format-file.sh create mode 100644 .claude/settings.json diff --git a/.claude/hooks/lint-format-file.sh b/.claude/hooks/lint-format-file.sh new file mode 100644 index 0000000..595baa9 --- /dev/null +++ b/.claude/hooks/lint-format-file.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Usage: lint-format-file.sh +# Run by the Claude Code PostToolUse hook after every Edit/Write (see .claude/settings.json). +# ESLint --fix runs on .ts/.html only, then Prettier on anything it supports. +# Exit 2 + stderr when ESLint still has errors after the autofix, so Claude sees and fixes them. +f=$1 +cd "$(dirname "$0")/../.." || exit 0 + +rc=0 +case "$f" in +*.ts | *.html) + out=$(node_modules/.bin/eslint --fix --no-warn-ignored "$f" 2>&1) || rc=2 + ;; +esac + +node_modules/.bin/prettier --write --ignore-unknown "$f" >/dev/null 2>&1 + +if [ "$rc" -ne 0 ]; then + echo "$out" >&2 + exit 2 +fi diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..9ba9a21 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,27 @@ +{ + "permissions": { + "allow": [ + "mcp__angular-cli__list_projects", + "mcp__angular-cli__get_best_practices", + "Bash(git switch *)" + ] + }, + "enabledMcpjsonServers": ["angular-cli"], + "enabledPlugins": { + "frontend-design@anthropic-plugin-directory": true + }, + "hooks": { + "PostToolUse": [ + { + "matcher": "Edit|Write", + "hooks": [ + { + "type": "command", + "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/lint-format-file.sh\" \"$(jq -r '.tool_response.filePath // .tool_input.file_path')\"", + "statusMessage": "ESLint --fix + Prettier..." + } + ] + } + ] + } +} diff --git a/.gitignore b/.gitignore index abc6aa7..d32cd8b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,9 @@ yarn-error.log *.launch .settings/ *.sublime-workspace -.claude/ + +# Claude Code (personal settings only, the rest of .claude/ is tracked) +.claude/settings.local.json # Visual Studio Code .vscode/*