Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js-tools: Add missing eslint plugin dep #21642

Merged
merged 1 commit into from
Nov 4, 2021

Conversation

anomiex
Copy link
Contributor

@anomiex anomiex commented Nov 4, 2021

Changes proposed in this Pull Request:

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.

Jetpack product discussion

p1635982454440000-slack-CBG1CP4EN

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • git checkout 8cd0bd281db6d01e8fc73f2aeb59d6f4175221eb (from Display notice when user has unactivated product license keys #21474)
  • pnpm install
  • pnpx eslint-changed --ext .js,.jsx,.cjs,.mjs,.ts,.tsx --git "--git-base=f6bb136d3c6101589303a4686a80851065fca426" projects/plugins/jetpack/_inc/client/state/licensing/reducer.js
    • See that it fails with an error about "Failed to load plugin 'react-hooks'"
  • git cherry-pick fix/missing-eslint-plugin-dep
  • pnpm install
  • pnpx eslint-changed --ext .js,.jsx,.cjs,.mjs,.ts,.tsx --git "--git-base=f6bb136d3c6101589303a4686a80851065fca426" projects/plugins/jetpack/_inc/client/state/licensing/reducer.js
    • Now it should work, producing no output because there are no lint errors.

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.
@anomiex anomiex added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Pri] Normal labels Nov 4, 2021
@anomiex anomiex self-assigned this Nov 4, 2021
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello anomiex! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D69608-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.

@kraftbj kraftbj added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 4, 2021
@anomiex anomiex merged commit 42fb814 into master Nov 4, 2021
@anomiex anomiex deleted the fix/missing-eslint-plugin-dep branch November 4, 2021 15:44
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Nov 4, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2021

Great news! One last step: head over to your WordPress.com diff, D69608-code, and commit it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

@anomiex
Copy link
Contributor Author

anomiex commented Nov 4, 2021

r234525-wpcom

davidlonjon added a commit that referenced this pull request Nov 5, 2021
# By Brad Jorsch (2) and others
# Via GitHub
* master:
  Boost: Fix the official name to the JavaScript word reference (#21638)
  tools: Allow extra spaces in next-version tags (#21647)
  Publicize: always add an alt text to Open Graph Images (#21520)
  js-tools: Add missing eslint plugin dep (#21642)
  * Deactivate SSO in e2e environment (#21644)
  Publicize: Handling feature availability information and upgrading (#21567)
  Nav Unification: Remove `preferred-view` param after update (#21632)
  [Plugin] Backup: Update/upgrade button link (#21590)

# Conflicts:
#	projects/plugins/boost/app/assets/src/js/pages/settings/sections/Modules.svelte
davidlonjon added a commit that referenced this pull request Nov 9, 2021
* master: (24 commits)
  Update dependency preact to v10.5.15 (#21635)
  Search: Migrate helper classes to standalone package (#21552)
  Release script: fix small typo (#21675)
  Update babel monorepo (#21668)
  Lock file maintenance (#21664)
  E2E tests: clean unused dependencies (#21639)
  Create JS Config package (#21592)
  Use webpack config JS package in Jetpack (#21581)
  add test runner to dev dependencies (#21591)
  Pexels Integration: Make the initial image search for example query run only once (#21641)
  Boost: make progress bar corners round on small screens (#21626)
  Full Sync :: limit to contributors and above (#21648)
  Sync Checksums : limit users based on user_level (#21645)
  Storybook: add Jetpack Spinner (#21511)
  Contact Info and Map widget: widget deprecation (#21554)
  Use webpack config js package in everything except Jetpack (#21580)
  Boost: Fix the official name to the JavaScript word reference (#21638)
  tools: Allow extra spaces in next-version tags (#21647)
  Publicize: always add an alt text to Open Graph Images (#21520)
  js-tools: Add missing eslint plugin dep (#21642)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Pri] Normal Touches WP.com Files [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants