Commit 1ede7c7126d for woocommerce
commit 1ede7c7126d4d27fee2af1d27ef84e8acdf0ba77
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date: Fri Jun 19 13:23:07 2026 +0200
Fix e2e-pw ESLint import/no-extraneous-dependencies false positives (#65862)
diff --git a/plugins/woocommerce/tests/e2e-pw/.eslintrc.cjs b/plugins/woocommerce/tests/e2e-pw/.eslintrc.cjs
index 9c0f427162e..8a6d775d1e4 100644
--- a/plugins/woocommerce/tests/e2e-pw/.eslintrc.cjs
+++ b/plugins/woocommerce/tests/e2e-pw/.eslintrc.cjs
@@ -1,3 +1,4 @@
+const path = require( 'path' );
const rulesDirPlugin = require( 'eslint-plugin-rulesdir' );
rulesDirPlugin.RULES_DIR = `${ __dirname }/rules/blocks`;
@@ -15,14 +16,24 @@ module.exports = {
'jest/valid-title': 'off',
'testing-library/await-async-utils': 'off',
/*
- * The e2e-pw tests use dependencies from the parent woocommerce package.
- * This configuration tells ESLint to check both the local package.json
- * and the parent package.json when validating imports.
+ * The e2e-pw tests use dependencies from the parent woocommerce package
+ * (this directory has no package.json of its own). Resolve packageDir from
+ * __dirname so the check is independent of ESLint's working directory: VS
+ * Code / root-level ESLint can run from the monorepo root, and relative
+ * entries would otherwise point at the wrong package.json.
+ *
+ * Both entries must point at directories that contain a package.json:
+ * eslint-plugin-import throws on the first missing one and aborts the
+ * whole dependency merge, so we list the parent woocommerce package and
+ * the monorepo root rather than this dir.
*/
'import/no-extraneous-dependencies': [
'warn',
{
- packageDir: [ '.', '../..' ],
+ packageDir: [
+ path.resolve( __dirname, '../..' ),
+ path.resolve( __dirname, '../../../..' ),
+ ],
},
],
},