Skip to content

Commit adcc5dd

Browse files
committed
Move error messaging inside prettier:check script
Adding additional error messaging because with the `--list-different` flag (which is needed to force a non-zero exit code) and without the `--write` flag (which would cause a 0/successful exit code) the default error messaging confusingly says both success and error.
1 parent 72fb221 commit adcc5dd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bin/ci-checks-js.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fi
1616
if [ "$CHECK_CORRECTNESS" = true ] ; then
1717
yarn flow || pFail
1818
yarn lint || pFail
19-
yarn prettier:check || { echo "ERROR: 'yarn prettier:check' found a problem"; pFail; }
19+
yarn prettier:check || pFail
2020
fi
2121

2222
if [ "$GUTENBERG_AS_PARENT" = true ] ; then

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454
"husky": {
5555
"hooks": {
56-
"pre-commit": "yarn prettier:check || { echo '\nERROR: `yarn prettier:check` found a problem\n'; exit 1; }"
56+
"pre-commit": "yarn prettier:check"
5757
}
5858
},
5959
"scripts": {
@@ -107,7 +107,7 @@
107107
"test:e2e:install-app:ios": "yarn test:e2e:build-app:ios",
108108
"flow": "flow",
109109
"prettier": "prettier-eslint --write $npm_package_config_jsfiles $npm_package_config_scssfiles",
110-
"prettier:check": "prettier-eslint --list-different $npm_package_config_jsfiles $npm_package_config_scssfiles",
110+
"prettier:check": "prettier-eslint --list-different $npm_package_config_jsfiles $npm_package_config_scssfiles || { echo '\nERROR: `yarn prettier:check` found a formatting problem.\nNo files have been changed. Try running `yarn prettier` to fix any formatting issues.\n'; exit 1; }",
111111
"clean": "yarn clean:aztec; yarn cache clean; yarn clean:haste; yarn clean:jest; yarn clean:metro; yarn clean:react; yarn clean:watchman; yarn clean:node;",
112112
"clean:runtime": "yarn clean:haste; yarn clean:react; yarn clean:metro; yarn clean:jest; yarn clean:watchman; yarn clean:babel-cache",
113113
"clean:aztec": "cd react-native-aztec && yarn clean && cd example && yarn clean",

0 commit comments

Comments
 (0)