#!/usr/bin/env bash

# Exit script on first failure.
set -e

# Echo commands before executing them, by default to stderr.
set -x

# Exit on unset variable.
set -u

./node_modules/.bin/prettier --check .
mapfile -t frontend_files < <(
  git ls-files -- '*.js' '*.ts' 'handlers/templates/**/*.html'
)
./node_modules/.bin/eslint --no-warn-ignored "${frontend_files[@]}"
./node_modules/.bin/mocha --recursive handlers/static/js/.tests/*.test.js
