From 7543dc7c504d52625d49a85c38b173be5c72bdba Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Wed, 12 Aug 2020 13:50:47 -0500 Subject: [PATCH] Add support for tsx and jsx --- _reformat-common.sh | 4 ++++ do-reformat.sh | 4 +++- would-reformat.sh | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/_reformat-common.sh b/_reformat-common.sh index a857a84..a104934 100644 --- a/_reformat-common.sh +++ b/_reformat-common.sh @@ -17,6 +17,10 @@ function sniff_file_type () { file_type="php" elif [[ $ff == *.html ]] ; then file_type="html" + elif [[ $ff == *.jsx ]] ; then + file_type="jsx" + elif [[ $ff == *.tsx ]] ; then + file_type="tsx" fi echo $file_type diff --git a/do-reformat.sh b/do-reformat.sh index 2eb4b83..c43ea2a 100755 --- a/do-reformat.sh +++ b/do-reformat.sh @@ -16,7 +16,9 @@ if [[ $file_type == "javascript" || \ $file_type == "css" || \ $file_type == "typescript" || \ $file_type == "php" || \ - $file_type == "html" ]] ; then + $file_type == "html" || \ + $file_type == "jsx" || \ + $file_type == "tsx" ]] ; then out=$(npx prettier --write $file) retval="$?" success_retval=0 diff --git a/would-reformat.sh b/would-reformat.sh index ad47cb2..f9bb601 100755 --- a/would-reformat.sh +++ b/would-reformat.sh @@ -16,7 +16,9 @@ if [[ $file_type == "javascript" || \ $file_type == "typescript" || \ $file_type == "css" || \ $file_type == "php" || \ - $file_type == "html" ]] ; then + $file_type == "html" || \ + $file_type == "jsx" || \ + $file_type == "tsx" ]] ; then out=$(npx prettier --check $file 2>&1 > /dev/null) retval="$?" success_retval=0