Skip to content

Commit 3f3a6b0

Browse files
committed
Merge branch 'development' into add-dynamic-legend-color-differentiation-percent-tools-returned-late
# Conflicts: # src/components/BMDashboard/RentalChart/ReturnedLateChart.module.css
2 parents 4859a4e + 9703d9f commit 3f3a6b0

File tree

298 files changed

+24967
-52370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+24967
-52370
lines changed

.husky/pre-commit

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
#!/bin/sh
22
# Load nvm if available
3-
# Try to load nvm (non-blocking)
43
export NVM_DIR="$HOME/.nvm"
5-
6-
if [ -s "$NVM_DIR/nvm.sh" ]; then
7-
. "$NVM_DIR/nvm.sh"
8-
nvm use >/dev/null 2>&1
9-
echo "Using Node via nvm"
10-
else
11-
echo "nvm not available, using system Node"
4+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
5+
# Use Node 20 if available (or install if needed)
6+
if [ -f .nvmrc ]; then
7+
nvm use 20 2>/dev/null || nvm install 20 && nvm use 20
128
fi
139

1410
echo ""
1511
echo "🛡️ Husky pre-commit hook triggered"
1612

13+
if git rev-parse -q --verify MERGE_HEAD >/dev/null 2>&1; then
14+
echo "ℹ️ Merge commit detected. Skipping lint-staged auto-fix on the merged file set."
15+
exit 0
16+
fi
17+
1718
# Block plain .css files (except .module.css and index.css)
1819
for file in $(git diff --cached --name-only --diff-filter=ACM | grep '\.css$'); do
1920
case "$file" in
@@ -44,4 +45,4 @@ if git diff --cached --name-only | grep -qE '\.(js|jsx|ts|tsx|css)$'; then
4445
fi
4546
else
4647
echo "ℹ️ No JS/TS/CSS files to lint. Skipping lint-staged."
47-
fi
48+
fi

.husky/pre-push

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,45 @@ fi
99

1010
. "$(dirname "$0")/_/husky.sh"
1111

12-
echo "🧪 Running tests before push..."
13-
npm run test -- --bail=1
14-
test_status=$?
12+
changed_files=$(git diff --name-only @{upstream}...HEAD 2>/dev/null)
1513

16-
echo "🧹 Running lint before push..."
17-
npm run lint
18-
lint_status=$?
14+
if [ -z "$changed_files" ]; then
15+
echo "ℹ️ No outgoing changes to validate. Skipping pre-push checks."
16+
exit 0
17+
fi
18+
19+
if ! printf '%s\n' "$changed_files" | grep -qvE '^\.husky/'; then
20+
echo "ℹ️ Only Husky hook changes detected. Skipping full test and lint checks."
21+
exit 0
22+
fi
23+
24+
js_files=$(printf '%s\n' "$changed_files" | grep -E '\.(js|jsx|ts|tsx)$' || true)
25+
style_files=$(printf '%s\n' "$changed_files" | grep -E '\.(css|scss|sass)$' || true)
26+
27+
test_status=0
28+
lint_status=0
29+
style_status=0
30+
31+
if [ -n "$js_files" ]; then
32+
echo "🧪 Running related tests before push..."
33+
yarn vitest related --run $js_files
34+
test_status=$?
35+
36+
echo "🧹 Running ESLint on changed files before push..."
37+
yarn eslint $js_files
38+
lint_status=$?
39+
fi
40+
41+
if [ -n "$style_files" ]; then
42+
echo "🎨 Running Stylelint on changed files before push..."
43+
yarn stylelint $style_files
44+
style_status=$?
45+
fi
1946

2047
# Block push if either fails
21-
if [ $test_status -ne 0 ] || [ $lint_status -ne 0 ]; then
22-
echo "❌ Push blocked: Lint or test failed."
48+
if [ $test_status -ne 0 ] || [ $lint_status -ne 0 ] || [ $style_status -ne 0 ]; then
49+
echo "❌ Push blocked: changed-file validation failed."
2350
exit 1
2451
fi
2552

26-
echo "✅ All checks passed. Proceeding with push..."
53+
echo "✅ All checks passed. Proceeding with push..."

jest.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module.exports = {
2020
'react-leaflet': '<rootDir>/src/_tests_/__mocks__/react-leaflet.js',
2121
'marker-cluster-group': '<rootDir>/src/_tests_/__mocks__/react-leaflet-cluster.js',
2222
'\\.(css|less|scss|sass)$': 'identity-obj-proxy', // <-- Added to mock CSS/SCSS files
23+
// Fix for Node.js built-in modules in Node 20
24+
'^node:(.*)$': '$1',
2325
},
2426

2527
// The paths to modules that run some code to configure or set up the testing environment before each test

0 commit comments

Comments
 (0)