Commit 8a3d7636c9 for woocommerce
commit 8a3d7636c9f3c248c597c050439adee15fb9561d
Author: Vladimir Reznichenko <kalessil@gmail.com>
Date: Thu Apr 17 09:39:31 2025 +0200
[dev] Monorepo: speedup pre-push linting for blocks and admin packages (#57338)
diff --git a/bin/pre-push.sh b/bin/pre-push.sh
index cbe1360711..ddb381f866 100755
--- a/bin/pre-push.sh
+++ b/bin/pre-push.sh
@@ -48,12 +48,14 @@ if [ -n "$changedFiles" ]; then
while read job; do
command=$(echo $job | jq --raw-output '( "pnpm --filter=" + .projectName + " " + .command )')
echo -n "-> Executing '$command' ($iteration of $iterations) "
+ start=$SECONDS
result=$($command 2>&1)
+ duration=$(( SECONDS - start ))
if [ $? -ne 0 ]; then
echo "[ERR] (aborting, please run manually to troubleshoot)"
exit 1
fi
- echo "[OK]"
+ echo "($duration sec.) [OK]"
iteration=$(expr $iteration + 1)
done < <(echo $lintingJobs | jq --compact-output '.[]')
fi
diff --git a/plugins/woocommerce/changelog/57338-dev-prepush-qol-improvements b/plugins/woocommerce/changelog/57338-dev-prepush-qol-improvements
new file mode 100644
index 0000000000..53072810ea
--- /dev/null
+++ b/plugins/woocommerce/changelog/57338-dev-prepush-qol-improvements
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Monorepo: pre-push linting improvements (additional output and linting speed for blocks/admin packages).
\ No newline at end of file
diff --git a/plugins/woocommerce/client/admin/package.json b/plugins/woocommerce/client/admin/package.json
index 3512c64dad..062e614071 100644
--- a/plugins/woocommerce/client/admin/package.json
+++ b/plugins/woocommerce/client/admin/package.json
@@ -23,8 +23,8 @@
"lint:fix": "pnpm --if-present '/^lint:fix:lang:.*$/'",
"lint:fix:lang:css": "stylelint '**/*.scss' --fix --ip 'storybook/wordpress'",
"lint:fix:lang:js": "pnpm lint:lang:js --fix --ext=js,ts,tsx",
- "lint:lang:css": "stylelint '**/*.scss'",
- "lint:lang:js": "eslint ./client --ext=js,ts,tsx",
+ "lint:lang:css": "stylelint '**/*.scss' --cache --cache-location=node_modules/.cache/stylelint",
+ "lint:lang:js": "eslint ./client --ext=js,ts,tsx --cache --cache-location=node_modules/.cache/eslint",
"test:js": "jest --config client/jest.config.js",
"ts:check": "tsc --build",
"watch:build": "pnpm --if-present --workspace-concurrency=Infinity --filter=\"$npm_package_name...\" --parallel '/^watch:build:project:.*$/'",
diff --git a/plugins/woocommerce/client/blocks/package.json b/plugins/woocommerce/client/blocks/package.json
index 0e1ece6571..833bed48b7 100644
--- a/plugins/woocommerce/client/blocks/package.json
+++ b/plugins/woocommerce/client/blocks/package.json
@@ -62,9 +62,9 @@
"lint:lang:css": "pnpm lint:css",
"lint:lang:js": "pnpm lint:js",
"lint:ci": "pnpm run lint:js && pnpm run lint:css",
- "lint:css": "stylelint '**/*.scss'",
+ "lint:css": "stylelint '**/*.scss' --cache --cache-location=node_modules/.cache/stylelint",
"lint:css-fix": "stylelint '**/*.scss' --fix",
- "lint:js": "wp-scripts lint-js --ext=js,ts,tsx",
+ "lint:js": "wp-scripts lint-js --ext=js,ts,tsx --cache --cache-location=node_modules/.cache/eslint",
"lint:js:report": "pnpm run lint:js -- --output-file eslint_report.json --ext=js,ts,tsx --format json",
"lint:js-fix": "eslint assets/js --ext=js,jsx,ts,tsx --fix",
"lint:md:docs": "wp-scripts lint-md-docs",
diff --git a/plugins/woocommerce/package.json b/plugins/woocommerce/package.json
index d38695158b..de06af1aa0 100644
--- a/plugins/woocommerce/package.json
+++ b/plugins/woocommerce/package.json
@@ -39,7 +39,7 @@
"lint:fix": "pnpm --if-present '/^lint:fix:lang:.*$/'",
"lint:fix:lang:php": "composer run-script phpcbf",
"lint:changes:branch:js": "bash ./bin/eslint-branch.sh",
- "lint:changes:branch:php": "pnpm lint:php:changes:branch",
+ "lint:changes:branch:php": "XDEBUG_MODE=off pnpm lint:php:changes:branch",
"lint:lang:js": "eslint . --ext=js,ts",
"lint:lang:php": "composer run-script phpcs",
"lint:php": "composer run-script phpcs",