-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlint.sh
46 lines (32 loc) · 1.34 KB
/
lint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
set -euo pipefail # Exit on errors and undefined variables.
# Get the directory of this script:
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
SECONDS=0
cd "$DIR"
# Use Prettier to check formatting.
# "--loglevel warn" makes it only output errors.
npx prettier --loglevel warn --check .
# Use ESLint to lint the TypeScript.
# "--max-warnings 0" makes warnings fail in CI, since we set all ESLint errors to warnings.
npx eslint --max-warnings 0 .
# Check for unused exports.
# "--error" makes it return an error code of 1 if unused exports are found.
npx ts-prune --error
# Use `isaac-xml-validator` to validate XML files.
# (Skip this step if Python is not currently installed for whatever reason.)
if command -v python &> /dev/null; then
pip install isaac-xml-validator --upgrade --quiet
isaac-xml-validator --quiet
fi
# Spell check every file using CSpell.
# "--no-progress" and "--no-summary" make it only output errors.
npx cspell --no-progress --no-summary .
# Check for unused CSpell words.
npx cspell-check-unused-words
# @template-customization-start
# Check for base file updates.
npx isaacscript check --ignore "tsconfig.json"
# @template-customization-end
echo "Successfully linted in $SECONDS seconds."