From e0f577ccd8aeaf7a81d937eb3d37f86e81be90fb Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 4 Nov 2021 09:38:43 -0400 Subject: [PATCH] js-tools: Add missing eslint plugin dep Eslint "sharable configs" are supposed to peer-depend on any plugins they need. But people usually forget this because npm hoisting makes it usually work anyway. In this case, eslint-config-wpcalypso was missing a peer dep on eslint-plugin-react-hooks. This happened to work before because eslint-changed was shelling out to eslint, which runs from `node_modules/.pnpm/eslint@7.32.0/node_modules/eslint`, which was picking up the dep from `node_modules/.pnpm/node_modules` that even pnpm puts in place to handle crap like this. When #21606 switched eslint-changed to use eslint's API instead of shelling out, it doesn't run from within `node_modules/.pnpm/` anymore (because eslint-changed is in the monorepo), so `node_modules/.pnpm/node_modules` is no longer in node's path, so it no longer would find the plugin. The solution is to add the missing plugin to js-tools's deps, because `tools/js-tools/node_modules` will still be in the path with the way we have things set up. --- pnpm-lock.yaml | 2 ++ tools/js-tools/package.json | 1 + 2 files changed, 3 insertions(+) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 408426f8cd9da..ff71ba16300d7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -966,6 +966,7 @@ importers: eslint-plugin-lodash: 7.3.0 eslint-plugin-prettier: 3.4.1 eslint-plugin-react: 7.26.1 + eslint-plugin-react-hooks: 4.2.0 eslint-plugin-wpcalypso: 5.0.0 glob: 7.1.6 ignore: 5.1.8 @@ -995,6 +996,7 @@ importers: eslint-plugin-lodash: 7.3.0_eslint@7.32.0 eslint-plugin-prettier: 3.4.1_36d06c6b3c8f3f25d1a2220e3ee44ebd eslint-plugin-react: 7.26.1_eslint@7.32.0 + eslint-plugin-react-hooks: 4.2.0_eslint@7.32.0 eslint-plugin-wpcalypso: 5.0.0_eslint@7.32.0 glob: 7.1.6 ignore: 5.1.8 diff --git a/tools/js-tools/package.json b/tools/js-tools/package.json index 5bda09a49501f..71768cadd1cfa 100644 --- a/tools/js-tools/package.json +++ b/tools/js-tools/package.json @@ -28,6 +28,7 @@ "eslint-plugin-lodash": "7.3.0", "eslint-plugin-prettier": "3.4.1", "eslint-plugin-react": "7.26.1", + "eslint-plugin-react-hooks": "4.2.0", "eslint-plugin-wpcalypso": "5.0.0", "glob": "7.1.6", "ignore": "5.1.8",