add pre-commit pkg, to run eslint & htmlproofer

This commit is contained in:
Joshua Seigler 2017-06-06 23:53:18 -04:00 committed by mr.wong
parent 8c55cdd3d5
commit dffe2f9d13
3 changed files with 3646 additions and 20 deletions

View file

@ -1,17 +0,0 @@
#!/bin/bash
jsfiles=$(git diff --cached --name-only --diff-filter=M | grep '\.js\?$')
jsfailed=0
if [[ $jsfiles != "" ]] ; then
for file in ${jsfiles}; do
git show :$file | eslint --stdin --stdin-filename "$file"
if [[ $? != 0 ]] ; then
jsfailed=1
fi
done;
fi
if [[ $jsfailed != 0 ]] ; then
echo "🚫🚫🚫ESLint must pass before committing .js files"
exit 1
fi

3636
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,7 @@
"uglify:dist": "mkdir -p dist/js/ && ./node_modules/uglify-js/bin/uglifyjs src/js/*.js -m -o dist/js/main.min.js",
"uglify:dev": "mkdir -p dist/js/ && ./node_modules/uglify-js/bin/uglifyjs src/js/*.js -c -o dist/js/main.min.js",
"uglify": "npm run uglify:dist",
"htmlproof": "htmlproofer ./_site --disable-external --allow-hash-href --assume-extension --alt-ignore '/.*/' --file-ignore /assets/,/dist/,/style-guide/,/blog/ --url-ignore '/^\/binaries\/.+$/,/^\/forum\/?.*$/'",
"htmlproof": "htmlproofer ./_site --disable-external --allow-hash-href --assume-extension --alt-ignore '/.*/' --file-ignore /assets/,/dist/,/style-guide/,/blog/ --url-ignore '/^/binaries/.+$/,/^/forum/?.*$/'",
"test": "echo \"No Tests.\" && exit 0",
"clean:dist": "rm -rf dist && rm -rf _site",
"clean": "npm run clean:dist",
@ -37,7 +37,8 @@
"watch": "run-p serve watch:jekyll watch:css watch:js",
"serve": "browser-sync start --server _site -f '_site/dist/css'",
"start": "npm run build -s && npm run watch",
"postinstall": "gem install bundler && bundle install"
"postinstall": "gem install bundler && bundle install",
"validate": "npm ls"
},
"author": "0xfff <0xfff@protonmail.com>",
"license": "MIT",
@ -52,6 +53,7 @@
"onchange": "3.0.2",
"postcss": "5.0.14",
"postcss-cli": "2.5.0",
"precommit-hook": "^3.0.0",
"uglify-js": "2.7.3",
"watch": "0.19.2"
},
@ -59,5 +61,10 @@
"no-scroll": "^2.0.0",
"sass-burger": "^1.3.1",
"slick-carousel": "^1.6.0"
}
},
"jshintConfig": {},
"pre-commit": [
"eslint",
"htmlproof"
]
}