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
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: typescript
|
- id: typescript
|
||||||
name: Frontend TypeScript Check
|
name: TypeScript
|
||||||
files: 'hyperglass/ui/*'
|
files: 'hyperglass/ui/*'
|
||||||
exclude: 'hyperglass/ui/node_modules|hyperglass/ui/.next'
|
exclude: 'hyperglass/ui/node_modules|hyperglass/ui/.next'
|
||||||
stages:
|
stages:
|
||||||
- commit
|
- commit
|
||||||
entry: ./hyperglass/ui/node_modules/.bin/tsc -p ./hyperglass/ui
|
entry: ./.tests/pre-commit-frontend.sh --typescript
|
||||||
language: script
|
language: script
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: eslint
|
- id: eslint
|
||||||
name: Frontend ESLint Check
|
name: ESLint
|
||||||
files: 'hyperglass/ui/*'
|
files: 'hyperglass/ui/*'
|
||||||
exclude: 'hyperglass/ui/node_modules|hyperglass/ui/.next'
|
exclude: 'hyperglass/ui/node_modules|hyperglass/ui/.next'
|
||||||
stages:
|
stages:
|
||||||
- commit
|
- commit
|
||||||
entry: ./hyperglass/ui/node_modules/.bin/eslint ./hyperglass/ui
|
entry: ./.tests/pre-commit-frontend.sh --eslint
|
||||||
language: script
|
language: script
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: prettier
|
- id: prettier
|
||||||
name: Frontend Prettier Check
|
name: Prettier
|
||||||
files: 'hyperglass/ui/*'
|
files: 'hyperglass/ui/*'
|
||||||
exclude: 'hyperglass/ui/node_modules|hyperglass/ui/.next'
|
exclude: 'hyperglass/ui/node_modules|hyperglass/ui/.next'
|
||||||
stages:
|
stages:
|
||||||
- commit
|
- commit
|
||||||
entry: ./hyperglass/ui/node_modules/.bin/prettier -c -w ./hyperglass/ui
|
entry: ./.tests/pre-commit-frontend.sh --prettier
|
||||||
language: script
|
language: script
|
||||||
|
@ -1,15 +1,32 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
UI_DIR="./hyperglass/ui"
|
UI_DIR="$(pwd)/hyperglass/ui"
|
||||||
|
|
||||||
cd $UI_DIR
|
check_typescript () {
|
||||||
node_modules/.bin/tsc
|
cd $UI_DIR
|
||||||
|
node_modules/.bin/tsc
|
||||||
|
}
|
||||||
|
|
||||||
# if git diff --cached --name-only | grep --quiet $UI_DIR
|
check_eslint () {
|
||||||
# then
|
cd $UI_DIR
|
||||||
# cd $UI_DIR
|
node_modules/.bin/eslint .
|
||||||
# node_modules/.bin/tsc
|
}
|
||||||
# else
|
|
||||||
# echo "No frontend files have changed, skipping pre-commit check..."
|
check_prettier () {
|
||||||
# exit 0
|
cd $UI_DIR
|
||||||
# fi
|
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