mirror of
https://github.com/heavyai/heavyai-charting.git
synced 2026-01-25 14:57:45 +00:00
* Run `npm run format` on entire codebase * Add script to check formatting and make it part of the test suite The script just runs `prettier`, but gives helpful headers and footers, since people seem perpetually confused about the test output when there's a formatting error. (To their credit, `prettier`'s output is less than helpful here.)
18 lines
546 B
Bash
Executable File
18 lines
546 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script basically just runs `prettier`, but it adds a header and footer so that people aren't
|
|
# confused why their CI builds failed, since prettier's output is less-than-helpful.
|
|
|
|
echo -e "=====> Checking code formatting\n"
|
|
|
|
prettier --list-different '{src,test}/**/*.js'
|
|
|
|
PRETTIER_RES=$?
|
|
|
|
if [[ $PRETTIER_RES -ne 0 ]]; then
|
|
echo -e "\n!!! FATAL ERROR: The above files have formatting problems. Run \`npm run format\` to fix.\n\n"
|
|
else
|
|
echo -e "---> No code formatting problems found\n\n"
|
|
fi
|
|
|
|
exit $PRETTIER_RES |