gendesign/.pre-commit-config.yaml
Light1YT ce6e693ea7
All checks were successful
CI / changes (pull_request) Successful in 6s
CI / frontend-tests (pull_request) Successful in 1m13s
CI / backend-tests (pull_request) Successful in 12m25s
CI / openapi-codegen-check (pull_request) Successful in 2m10s
fix(ci): pin prettier 3.9.0 for codegen check + pre-commit so api-types is byte-stable
openapi-codegen-check был RED на каждом PR: CI шаг гонял bare `npx prettier`
(резолвится в плавающий latest), а committed api-types.ts был отформатирован
старым prettier (≤3.6.2, union-типы multi-line). 3.9.0 переносит union-wrapping
на single-line → CI-регенерация всегда давала diff → gate падал.

Чиним детерминизмом одной версии на обоих путях:
- frontend/package.json: добавлен prettier@3.9.0 (exact) в devDependencies
  + обновлён package-lock.json.
- CI openapi-codegen-check: bare `npx prettier` → ./node_modules/.bin/prettier
  (project-local pinned, не плавает).
- .pre-commit-config.yaml: prettier hook additional_dependencies=["prettier@3.9.0"]
  — тот же движок, что в CI (alpha.8-обёртка байт-в-байт == prettier 3.9.0).
- api-types.ts перегенерирован prettier 3.9.0 (union-типы single-line).

Backend OpenAPI-схема не менялась — только формат. CI-регенерация теперь
байт-в-байт совпадает с committed-файлом и с выводом pre-commit hook.
2026-06-27 16:11:26 +05:00

46 lines
1.8 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Local pre-commit hooks. Install once with:
# pip install pre-commit
# pre-commit install
#
# After install: every `git commit` runs these checks against staged files.
# Failures abort the commit.
repos:
# Generic hygiene
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: ^backend/alembic/script.py.mako$
- id: check-toml
- id: check-added-large-files
args: ["--maxkb=512"]
- id: check-merge-conflict
- id: detect-private-key
# Python — ruff (lint + format) on backend/ + tradein-mvp/backend/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
hooks:
- id: ruff
args: [--fix]
files: ^(backend|tradein-mvp/backend)/
- id: ruff-format
files: ^(backend|tradein-mvp/backend)/
# Frontend — prettier on TS/TSX/JSON.
# additional_dependencies pins the EXACT prettier engine (3.9.0) so this hook
# and CI (`openapi-codegen-check` → ./node_modules/.bin/prettier, also 3.9.0
# via frontend/package.json) format byte-for-byte identically. Без явного pin
# mirrors-prettier@v4.0.0-alpha.8 тянет CLI-обёртку, а CI `npx prettier`
# плавает в latest → расхождение формата → codegen-gate RED. Меняешь версию
# здесь — синхронно меняй prettier в frontend/package.json + lockfile.
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
additional_dependencies: ["prettier@3.9.0"]
files: ^frontend/.*\.(ts|tsx|js|jsx|json|css|md)$
exclude: ^frontend/(node_modules|\.next|package-lock\.json)/