#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Validate rust formatting
cargo fmt --check

# Lint
# keep list in sync with .vscode/settings.json
cargo clippy -- -Wclippy::cargo \
		-Wclippy::pedantic \
		-Wclippy::exit \
		-Wclippy::expect_used \
		-Wclippy::panic \
		-Dclippy::print_stderr \
		-Dclippy::print_stdout \
		-Wclippy::semicolon_inside_block \
		-Wclippy::str_to_string \
		-Wclippy::string_to_string \
		-Wclippy::unnecessary_self_imports \
		-Wclippy::use_debug \
		;

# Validate other formatting
yarn express-check-in --staged

# Check for duplicate dependencies
if ! git diff --cached --quiet yarn.lock; then
	yarn dedupe --check
fi
