This repository has been archived by the owner on May 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from magopian/27-prettier-with-useful-output
Better output when running lint:prettier
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
prelude() { | ||
echo " | ||
You have prettier linting errors! | ||
---------------------------------- | ||
The following files would turn out different if you process them with prettier. | ||
" | ||
} | ||
|
||
any=false | ||
first=true | ||
while read line | ||
do | ||
$first && prelude | ||
echo "To fix:" | ||
echo " prettier --write ${line}" | ||
echo "To see:" | ||
echo " prettier ${line} | diff ${line} -" | ||
echo "" | ||
# echo "$line" | ||
any=true | ||
first=false | ||
done < "${1:-/dev/stdin}" | ||
|
||
|
||
$any && echo " | ||
If you're not interested in how they're different, consider running: | ||
yarn run lint:prettierfix | ||
" | ||
|
||
$any && exit 1 || exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters