Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Dec 13, 2024
1 parent f788cee commit 70c60c5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion frontend/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"singleQuote": true,
"overrides": [
{
"files": "**/*.json",
"files": "**/*.{json,scss}",
"options": {
"tabWidth": 2
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"e2e": "ng e2e",
"format:all": "npm run lint:format && npm run prettier:lint:format",
"check-linting:all": "npm run lint && npm run prettier:lint",
"lint:format:specific": "eslint --fix --no-error-on-unmatched-pattern --no-warn-ignored",
"lint:format:specific": "eslint --fix --no-warn-ignored",
"lint:format": "eslint --fix .",
"lint": "eslint .",
"prettier:lint:format:specific": "prettier --no-error-on-unmatched-pattern --write ",
"prettier:lint:format:specific": "prettier --write ",
"prettier:lint:format": "prettier --write .",
"prettier:lint": "prettier --check ."
},
Expand Down
16 changes: 7 additions & 9 deletions frontend/scripts/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ FORMATTED_FILE_EXTENSIONS="java|ts|html|css|scss|xml|json|yml|yaml|mjs"
get_changed_files() {
path=$1
GIT_BASE_PATH=$(git rev-parse --show-toplevel)


# shellcheck disable=SC1087
git diff --cached --name-only --diff-filter=d --line-prefix="$GIT_BASE_PATH"/ "$path" | grep -E "\.($FORMATTED_FILE_EXTENSIONS)$" | tr '\n' ' ' | xargs
}

Expand All @@ -22,31 +21,30 @@ frontend_files=$(get_changed_files "$FRONTEND_PATH")
backend_files=$(get_changed_files "$BACKEND_PATH")
echo "*****Running prettier******"
cd "$FRONTEND_PATH" || exit
has_changed "$frontend_files" && npm run prettier:lint:format:specific "$frontend_files" || echo "No files found to format"
echo "*****Finish running eslint******"
has_changed "$frontend_files" && npm run prettier:lint:format:specific $frontend_files || echo "No files found to format"
echo "*****Finish running prettier******"

echo "---------------------------------------------------------"

echo "*****Running eslint******"
cd "$FRONTEND_PATH" || exit
has_changed "$frontend_files" && npm run lint:format:specific "$frontend_files" || echo "No files found to format"
has_changed "$frontend_files" && npm run lint:format:specific $frontend_files || echo "No files found to format"
echo "*****Finish running eslint******"

echo "---------------------------------------------------------"

echo "*****Running maven formatter******"
cd "$BACKEND_PATH" || exit
# shellcheck disable=SC2091
has_changed "$backend_files" && mvn -f pom.xml spotless:apply -DspotlessFiles="$backend_files" || echo "No files found to format"
echo "*****Finish running maven formatter******"

echo "---------------------------------------------------------"

echo "*****Adding changes to git******"
cd "$GIT_BASE_PATH" || exit

has_changed "$frontend_files" && git add "$frontend_files" -v || echo "No frontend files changed, nothing to add"
has_changed "$backend_files" && git add "$backend_files" -v || echo "No backend files files changed, nothing to add"
echo "$frontend_files"
has_changed "$frontend_files" && git add $frontend_files -v || echo "No frontend files changed, nothing to add"
has_changed "$backend_files" && git add $backend_files -v || echo "No backend files files changed, nothing to add"
echo "*****Formatted files added again******"

status=$?
Expand Down

0 comments on commit 70c60c5

Please sign in to comment.