mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
fix pre-commit
This commit is contained in:
@ -8,30 +8,30 @@ repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: typescript
|
||||
name: Frontend TypeScript Check
|
||||
name: TypeScript
|
||||
files: 'hyperglass/ui/*'
|
||||
exclude: 'hyperglass/ui/node_modules|hyperglass/ui/.next'
|
||||
stages:
|
||||
- commit
|
||||
entry: ./hyperglass/ui/node_modules/.bin/tsc -p ./hyperglass/ui
|
||||
entry: ./.tests/pre-commit-frontend.sh --typescript
|
||||
language: script
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: eslint
|
||||
name: Frontend ESLint Check
|
||||
name: ESLint
|
||||
files: 'hyperglass/ui/*'
|
||||
exclude: 'hyperglass/ui/node_modules|hyperglass/ui/.next'
|
||||
stages:
|
||||
- commit
|
||||
entry: ./hyperglass/ui/node_modules/.bin/eslint ./hyperglass/ui
|
||||
entry: ./.tests/pre-commit-frontend.sh --eslint
|
||||
language: script
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: prettier
|
||||
name: Frontend Prettier Check
|
||||
name: Prettier
|
||||
files: 'hyperglass/ui/*'
|
||||
exclude: 'hyperglass/ui/node_modules|hyperglass/ui/.next'
|
||||
stages:
|
||||
- commit
|
||||
entry: ./hyperglass/ui/node_modules/.bin/prettier -c -w ./hyperglass/ui
|
||||
entry: ./.tests/pre-commit-frontend.sh --prettier
|
||||
language: script
|
||||
|
@ -1,15 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
UI_DIR="./hyperglass/ui"
|
||||
UI_DIR="$(pwd)/hyperglass/ui"
|
||||
|
||||
cd $UI_DIR
|
||||
node_modules/.bin/tsc
|
||||
check_typescript () {
|
||||
cd $UI_DIR
|
||||
node_modules/.bin/tsc
|
||||
}
|
||||
|
||||
# if git diff --cached --name-only | grep --quiet $UI_DIR
|
||||
# then
|
||||
# cd $UI_DIR
|
||||
# node_modules/.bin/tsc
|
||||
# else
|
||||
# echo "No frontend files have changed, skipping pre-commit check..."
|
||||
# exit 0
|
||||
# fi
|
||||
check_eslint () {
|
||||
cd $UI_DIR
|
||||
node_modules/.bin/eslint .
|
||||
}
|
||||
|
||||
check_prettier () {
|
||||
cd $UI_DIR
|
||||
node_modules/.bin/prettier -c -w .
|
||||
}
|
||||
|
||||
for arg in "$@"
|
||||
do
|
||||
if [ "$arg" == "--typescript" ]
|
||||
then
|
||||
check_typescript
|
||||
else [ "$arg" == "--eslint" ]
|
||||
then
|
||||
check_eslint
|
||||
else [ "$arg" == "--prettier" ]
|
||||
then
|
||||
check_prettier
|
||||
fi
|
||||
done
|
||||
|
Reference in New Issue
Block a user