#!/bin/sh -e
# Lint core, client, and docs
export SOURCE_FILES="src/pywire"

set -x

cargo fmt

uv run --with ruff ruff format $SOURCE_FILES
uv run --with ruff ruff check --fix $SOURCE_FILES
uv run --with ty ty check $SOURCE_FILES

echo "-> Linting client..."
if [ -d "src/pywire/client" ]; then
    (
        cd src/pywire/client
        if [ ! -x node_modules/.bin/eslint ]; then
            pnpm install
        fi
        pnpm format
        pnpm lint:fix
    )
fi

