-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlint
executable file
·48 lines (37 loc) · 1.23 KB
/
lint
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
47
48
#!/bin/zsh -e
# For a repo that's using our container in their CI [test] phase, [lint] job,
# we'll use any of these files from _their_ repo (that they've customized).
# (Otherwise, use these files from us, the 'dyno' repo, located in /app/)
MYDIR=${0:a:h}
typeset -a REMOVES
REMOVES=(.proms)
for i in package.json .eslintrc.cjs .eslint.await.finder.cjs .eslint.await.finder.tsconfig.json deno.json tsconfig.json node_modules; do
if [ ! -e $i ]; then
ln -s $MYDIR/$i
REMOVES+=($i)
fi
done
trap "{ rm -f $REMOVES; }" EXIT
if [ $# -eq 0 ]; then 1=.; fi
set -x
deno lint -c deno.json "$@"
npx eslint "$@"
# Promises - look for missing `await` in callers of `async` functions
# Promises - look for missing parens, eg: `await exe('ls').trim()` => `(await exe('ls')).trim()`
# ^^ cheap approximate: git grep -P 'await[^)]+\)\.'
npx eslint -c .eslint.await.finder.cjs "$@" \
|egrep "\.js|floating-promises" \
|egrep -B1 floating-promises \
|tee .proms
npx tslint --type-check -p tsconfig.json "$@" 2>&1 \
|fgrep -v www/jw/8/jwplayer.js \
|fgrep Promise \
|fgrep roperty \
|fgrep "does not exist" \
|tee -a .proms
if [ -s .proms ]; then
echo "promises made, promises broken"
exit 1
fi
set +x
echo LINT SUCCESS