Start extracting language-specific formatters
This commit is contained in:
28
prettier.sh
Executable file
28
prettier.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -uo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
source "$DIR/_reformat-common.bash"
|
||||
|
||||
file="$1"
|
||||
|
||||
wrflog running against file $file
|
||||
|
||||
out=$(npx prettier --check $file 2>&1 >/dev/null)
|
||||
|
||||
if [[ x"$WOULD_REFORMAT" = x"would_reformat" ]] ; then
|
||||
out=$(npx prettier --check $file 2>&1 >/dev/null)
|
||||
retval="$?"
|
||||
exit "$retval"
|
||||
fi
|
||||
|
||||
if [[ x"$WOULD_REFORMAT" = x"do_reformat" ]] ; then #
|
||||
out=$(npx prettier --write $file 2>&1 >/dev/null)
|
||||
retval="$?"
|
||||
exit "$retval"
|
||||
fi
|
||||
|
||||
exit 255
|
||||
Reference in New Issue
Block a user