File tree 4 files changed +33
-7
lines changed
4 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ parserOptions:
11
11
rules :
12
12
indent :
13
13
- error
14
- - 4
14
+ - 2
15
15
linebreak-style :
16
16
- error
17
17
- unix
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ set -euo pipefail
3
+
4
+ FILES_PRETTIER=$( git diff --cached --name-only --diff-filter=ACMR " *.js" " *.css" " *.html" " *.json" | sed ' s| |\\ |g' )
5
+ FILES_ESLINT=$( git diff --cached --name-only --diff-filter=ACMR " *.js" | sed ' s| |\\ |g' )
6
+ FILES_ORMOLU=$( git diff --cached --name-only --diff-filter=ACMR " *.hs" | sed ' s| |\\ |g' )
7
+
8
+ echo " Reprinting any staged JS, CSS and HTML files with Prettier ..."
9
+ echo " $FILES_PRETTIER " | xargs npx prettier --write
10
+ echo " Reprinting complete."
11
+ echo " Linting any staged JS files with ESLint ..."
12
+ echo " $FILES_ESLINT " | xargs npx eslint --fix
13
+ echo " Linting complete."
14
+ echo " Formatting any staged Haskell files with Ormolu ..."
15
+ for f in $FILES_ORMOLU
16
+ do
17
+ ormolu --mode inplace $f
18
+ done
19
+ echo " Formatting complete."
20
+
21
+ # Add modified files back to staging
22
+ echo " $FILES_PRETTIER " | xargs git add
23
+ echo " $FILES_ESLINT " | xargs git add
24
+ echo " $FILES_ORMOLU " | xargs git add
25
+
26
+ exit 0
Original file line number Diff line number Diff line change @@ -19,15 +19,13 @@ set -euo pipefail
19
19
source base.sh
20
20
21
21
mkdir -p $BUILD /node_modules
22
- run $BUILD npm install --silent js-beautify
23
- run $BUILD npm install --silent eslint
24
22
25
23
function formatall_js {
26
- nodejs build/node_modules/js-beautify/js/bin/js-beautify.js -n -m 2 $( find web/js -regex .* \\ .js$ -type f)
27
- nodejs build/node_modules/js-beautify/js/bin/css-beautify.js -n $( find web/css -regex .* \\ .css$ -type f)
28
- nodejs build/node_modules/js-beautify/js/bin/html-beautify.js -n $( find web -regex .* \\ .html$ -type f)
24
+ npx prettier --write $( find web/js -regex .* \\ .js$ -type f)
25
+ npx prettier --write $( find web/css -regex .* \\ .css$ -type f)
26
+ npx prettier --write $( find web -regex .* \\ .html$ -type f)
29
27
30
- nodejs build/node_modules/ eslint/bin/eslint.js --fix $( find web/js -regex .* \\ .js$ -type f) || true
28
+ npx eslint --fix $( find web/js -regex .* \\ .js$ -type f) || true
31
29
}
32
30
33
31
run . formatall_js
Original file line number Diff line number Diff line change 253
253
run . git submodule init
254
254
run . git submodule update
255
255
256
+ run . git config core.hooksPath .githooks
257
+
256
258
# Go ahead and run a first build, which installs more local packages.
257
259
./build.sh
You can’t perform that action at this time.
0 commit comments